The idea for Government Simulator originated from watching how real-world governance is influenced by laws and authority, as well as trust, public opinion, accountability, and communication. Leaders actually encounter citizens who think, remember, react emotionally, and judge decisions over time. We aimed to recreate this complexity in a simulation where citizens are not just scripted characters, but intelligent agents who respond realistically to leadership choices. The goal was to build a system where power is never certain and must be earned continuously. Government Simulator is an AI-driven political simulation where players take on the role of a village mayor. Players interact with villagers who have their own personalities, memories, trust levels, and fears. Villagers can ask public questions during speeches, react to answers, remember past interactions, and change their opinions accordingly. The mayor must manage public funds, respond to random village events, face opposition campaigns, and deal with legal challenges. If governance is poor, villagers can file court cases against the mayor, and if public trust drops too low, the mayor can lose the election. Every decision has long-term effects that shape the village's future. The project uses a Node.js and Express backend to manage the simulation logic and API routes. The frontend is built with HTML, CSS, and JavaScript to create an interactive and user-friendly interface. Google Gemini serves as the AI engine to generate realistic NPC dialogue, evaluate public speeches, act as a neutral judge in court cases, and explain election results. The entire village state is consistently stored using JSON files, allowing the simulation to continue even after the server restarts. A trust and fear model, along with memory-based behavior, ensures that NPCs behave logically instead of randomly. One of the main challenges was designing AI behavior that felt real without being unfair or unpredictable. Making sure AI responses followed strict formats for court judgments and speech analysis required careful prompt design. Another challenge was correctly managing persistent state to ensure village data stayed consistent across sessions. Balancing trust, fear, opposition influence, and election outcomes also needed several iterations to avoid extreme or unrealistic results. On the frontend, managing numerous interactive components while keeping the interface clean and readable remained an ongoing challenge. We take pride in creating a system where villagers act independently and are not directly controlled by the player. The AI judge gives neutral and well-reasoned verdicts based on evidence and defense arguments. The election system allows players to genuinely lose power, reinforcing accountability. Instead of scripted endings, the simulation generates outcomes based on accumulated decisions. Most importantly, AI enhances realism while the main governance logic remains rule-based and clear. Through this project, we learned that leadership centers more on trust than on authority. Small decisions can lead to long-term effects as people remember and react emotionally. We also found that AI works best when guided by rules and ethical boundaries and that simulations are much more engaging when players face real consequences instead of guaranteed success. Designing systems that allow outcomes to develop naturally is more impactful than scripting fixed results. In the future, we plan to expand Government Simulator to include larger populations, various leadership roles, and deeper policy systems. Features like regional or national elections, law drafting and voting, public opinion dashboards, and multiplayer governance scenarios could transform this into a powerful educational tool. Our long-term goal is to make this simulator a platform for learning about leadership, ethics, and civic responsibility in a meaningful, interactive way.
Built With
- ai
- api
- apis
- css
- express.js
- gemini
- generative
- html
- javascript
- json
- node.js
- rest
- vanilla
Log in or sign up for Devpost to join the conversation.