Democracy – A Reddit-Powered Nation Simulation Game using Devvit
Inspiration
The inspiration behind Democracy came from a desire to blend interactive storytelling, community decision-making, and the power of large language models into a single social game. Reddit, as a platform already rich in opinion-sharing and debate, felt like the perfect foundation for simulating a fictional nation governed entirely by its citizens.
What it does
Democracy is a Reddit-based survival and strategy game where a fictional nation is managed by subreddit members. The nation starts with key resources like Population, Gold, Happiness, and Food Surplus.
Each day:
- The current state of the nation is posted to the subreddit.
- Gemini LLM generates a new crisis or problem based on the current resources.
- Redditors propose solutions via posts and vote on them using upvotes.
- At the end of the day, the top-voted solution is sent to Gemini LLM, which returns the impact and updates the state.
- The new state is posted, and the cycle continues—until the Population drops to 0.
All game data and history (including past 10 decisions and outcomes) are stored in Reddit posts in a human and AI-readable format.
How we built it
We used the official Devvit template as a starting point. The project is built using:
- Devvit Platform: Handles Reddit API interaction, periodic scheduling, and state updates.
- Gemini LLM: Powers both the generation of new problems and the evaluation of chosen solutions.
- Reddit API: Used to read user posts, upvote counts, and update subreddit content.
- Stateless Architecture: All state is stored in posts rather than an external database.
- Frontend Webpage: A minimal single-page website provides game info and a link to the subreddit.
The periodic job runs every 24 hours to:
- Fetch the most upvoted player solution.
- Pass the solution and current state to Gemini.
- Update the nation’s state and publish a new post with the outcome.
Challenges we ran into
- Prompt Engineering: When we do vibe coding and move fast, the LLM sometimes hallucinates or gives unpredictable results. This often leads us into a rabbit hole, and we still need to manually figure out what went wrong and fix it ourselves.
- API Key Limitation: The current Gemini API key has usage limits or fair usage policies, which means we can’t test the system continuously. We either have to wait for the next day or create a new account to continue testing.
Accomplishments that we're proud of
- Built an entirely Reddit-native game without needing a backend server to keep running.
- Seamlessly integrated Devvit and Gemini LLM to drive both gameplay and narrative.
- Created a system where real user input meaningfully shapes the direction of a persistent world.
What we learned
- How to fully leverage the new Devvit ecosystem and Reddit Developer Platform.
- Best practices for prompt engineering when using Bolt LLMs.
- The importance of designing games that are transparent, community-driven, and stateless.
- How to build systems that rely on social mechanisms (like upvotes) as core gameplay features.
What's next for Democracy
- Multi-nation Mode: Allow multiple subreddits to play parallel versions of the game with diverging outcomes.
- Event Visualizer: A web-based timeline to visualize the nation’s progress and past decisions.
- User Roles: Introduce classes like advisors, governors, or rebels to add complexity and engagement.
- Mod Tools: Allow subreddit mods to influence or seed events manually.
- Analytics Dashboard: Track engagement, votes, and survival statistics for all past games.
- AI-Powered Lore and Worldbuilding: Use the LLM to build out rich lore, history, and even national identities based on the actions of the community.
Submission Challenges
We are submitting Democracy to the following challenges:
Useless Sh!t Challenge:
We're fully embracing the chaotic spirit of Reddit by building a weird, wacky, and experimental democracy simulator powered by upvotes, LLMs, and community-driven collapse. It's silly, unpredictable, and extremely Reddit-core.Deploy Challenge (Netlify):
Our landing page for the Democracy game is deployed using Netlify, giving us an easy way to share the game concept and direct users to the official subreddit.Custom Domain Challenge (IONOS + Entri):
We used Entri to get a custom domain via IONOS and published our Bolt.new app to give Democracy a proper name on the web.
Democracy is just getting started—we see it as the beginning of a new era where AI and community storytelling intersect. By integrating LLMs directly into the game loop, we're experimenting with a future where video games are not just scripted experiences, but living, evolving narratives shaped by both players and generative AI.
Built With
- devvit
- gemini
- ionos
- netlify
- node.js
- react
- typescript
Log in or sign up for Devpost to join the conversation.