Subreddit Guessr
Inspiration
Subreddit Guessr was inspired by the desire to create an engaging and interactive game directly within the Reddit platform. We aimed to leverage Reddit's vast content and diverse communities to build a fun experience that tests users' knowledge of subreddits, similar to popular trivia or guessing games. The goal was to provide a seamless, native Reddit experience without requiring users to leave the platform.
What it does
Subreddit Guessr is an interactive game embedded directly into Reddit posts. Users are presented with a post title and a selection of five potential subreddits. Their task is to guess the correct subreddit the post originated from. The app tracks user performance, including correct guesses, total games played, and accuracy. It features a personal stats screen and a global leaderboard, allowing users to compete with others and see how they rank. Moderators can easily create new game posts or a main menu for the app within their subreddit.
How we built it
The Subreddit Guessr app is built using Reddit's Devvit platform, which allows for the creation of rich, interactive experiences directly within Reddit's ecosystem.
- Frontend (Devvit App): The user interface and game logic are developed using Devvit's custom components and hooks. This includes screens for loading, main menu, subreddit selection, game results, user statistics, and a global leaderboard. Devvit's
useAsyncanduseStatehooks manage the application's state and asynchronous operations. - Backend (Node.js Serverless Functions): Core game mechanics, data processing, and interactions with Reddit's API and Redis are handled in serverless Node.js functions. This includes preparing random guess games, checking user guesses, updating user points, and managing leaderboard data.
- Data Storage (Redis): All game-related data, user statistics, and leaderboard information are persistently stored using Devvit's Redis-backed storage. This ensures that game states and user progress are saved across sessions.
- Reddit API Integration: The app heavily utilizes Devvit's Reddit API client to fetch hot posts from various subreddits, submit new game posts, and retrieve user information.
Challenges we ran into
Developing within the Devvit ecosystem presented unique challenges:
- Sandboxed Environment: Operating within Devvit's sandboxed environment meant adhering to specific constraints, such as not being able to use standard web APIs or external NPM dependencies directly in the Devvit app. This required careful design and reliance on Devvit's provided APIs.
- Data Persistence and State Management: While Redis was available, designing an efficient and scalable data model for game information, user guesses, and leaderboard statistics required careful planning to ensure data integrity and performance.
- Content Curation: Finding suitable Reddit posts for the game (text-only, non-NSFW, and previously unused) involved iterative filtering and API calls to ensure a good user experience.
- Devvit Setup and Deployment: The initial setup process for Devvit apps, including authentication, initialization, and configuring the playtest subreddit, required specific steps to get the development environment running smoothly.
Accomplishments that we're proud of
- Seamless Reddit Integration: We successfully created a fully functional game that feels like a native part of the Reddit experience, embedded directly within posts.
- Robust Game Logic: The app features a complete game loop, from game creation and subreddit selection to guess validation, result display, and persistent statistics.
- Dynamic Leaderboard and User Stats: The implementation of a real-time leaderboard and individual user statistics provides a competitive and engaging element to the game.
- Efficient Data Handling: We effectively utilized Redis for fast and reliable storage of game states and user data.
What we learned
Through this project, we gained a deeper understanding of:
- Devvit Platform Capabilities: The strengths and limitations of building interactive applications directly on Reddit, including its UI components, API access, and serverless backend.
- Serverless Architecture: Best practices for designing and implementing serverless functions for backend logic and data management.
- Redis for Game Data: How to effectively use Redis for fast read/write operations crucial for game state, user progress, and leaderboards.
- User Experience in Constrained Environments: Designing intuitive and engaging user interfaces within the specific layout and interaction patterns of Reddit posts.
What's next for Subreddit Guessr
- More Game Modes: Explore additional game variations, such as guessing the subreddit from images or videos, or time-based challenges.
- Enhanced User Profiles: Implement more detailed user profiles with historical game data, achievements, and personalized insights.
- Daily Challenges/Quests: Introduce daily or weekly challenges to encourage repeat engagement and reward active players.
- Daily streaks: Introduce a streak system that tracks consecutive days played. Reward users with in-game bonuses, exclusive achievements, and profile flair upgrades for maintaining streaks. High streak counts can unlock special visual flairs displayed in Reddit comment threads, highlighting top players and encouraging daily engagement.
- Community Features: Potentially add features for users to suggest posts or subreddits for future games.
- Improved Content Filtering: Refine the logic for selecting game content to ensure even higher quality and relevance.
Built With
- devvit
- redis
- typescript
Log in or sign up for Devpost to join the conversation.