Mailopolis: Multi-agent sustainable city simulation game
🌍 Inspiration
In a world where climate change and urban sustainability challenges grow more pressing each day, we asked ourselves: How can we make sustainability policy engaging and accessible? Traditional city simulation games treat sustainability as a simple metric to optimize, but real urban planning involves complex political dynamics, competing interests, and adversarial actors who profit from unsustainable practices.
This realization sparked the creation of Mailopolis - a social deduction strategy game where players compete directly against AI-powered adversarial actors to influence a city's sustainability trajectory. Rather than building yet another city builder, we wanted to simulate the political battle that sustainability advocates face when trying to implement environmental policies.
🎯 What We Built
Core Concept: You're a sustainability advisor competing against AI "bad actors" (developers, corporations) who actively lobby to corrupt the city with unsustainable policies for profit.
Key Features:
- Multi-Agent AI System: Each city department head has unique personalities, corruption resistance, and decision-making patterns
- AgentMail Communication: Real-time messaging system where players and AI agents exchange policy proposals and influence decisions
- Adversarial Gameplay: AI opponents actively counter your sustainability efforts with bribes and competing proposals
- Dynamic City Simulation: City Sustainability Index (0-100) changes based on political battles and policy outcomes
Victory Condition: Maximize the City Sustainability Index while bad actors attempt to minimize it through political corruption.
🏗️ Technical Implementation
Multi-Agent AI System
Each AI agent has a distinct personality matrix:
@dataclass
class AgentPersonality:
corruption_resistance: int # 0-100, resistance to bribes
sustainability_focus: int # 0-100, environmental priority
political_awareness: int # 0-100, considers politics
decision_factors: List[str] # Priority ordering
Example: Dr. Marcus Chen (Energy Dept) has 85% sustainability focus but only 70% corruption resistance - he supports green energy but might be swayed by economic arguments.
Backend Architecture
- Multi-agent system: Integrates models from OpenAI, Anthropic, and Google to simulate diverse agent behaviors
- FastAPI + WebSocket: Real-time updates in gameplay and agent notifications
- State Persistence: Conversation logs and game state storage persist locally for optimal performance
- AgentMail API: Innovative email-based interface where players and AI agents communicate through government-style email threads with subjects, messaging, and political correspondence
Frontend
- React 18 + TypeScript: Modern cyberpunk-inspired UI with interactive city visualization
- CSS-in-JS: Component-specific styles for different parts of the game, to prevent styling conflicts
🚧 Key Challenges Solved
1. Consistency in agent behaviour: Ensuring agents behave according to their personalities in conversations with other agents
- Solution: Prompt engineering with personality profiles and decision history
2. Game engine mechanics: Making the game winnable through skill while keeping it challenging
- Solution: Dynamic difficulty that scales bad actor aggression based on a player's performance
3. Butterfly effects engine: City systems have cascading policy effects across departments. Incorporating this in the game is challenging
- Solution: We utilized a pub-sub model in the game engine to simulate policy effects and unintended consequences
📚 What We Learned
- Multi-agent LLM systems: Mastered multi-agent systems with personality persistence
- Real-time systems: Built a WebSocket architecture for responsive multiplayer-style gameplay
- Game Design: Balanced player agency with a significant AI opposition
- Urban Policy: Gained appreciation for the political complexity of sustainability implementation
🌟 Impact & Future
Educational Value: Makes complex policy topics engaging through strategic gameplay Technical Innovation: Demonstrates cutting-edge AI applications in serious gaming Real-world Relevance: Could be adapted for actual policy simulation and urban planning education
Next Steps: Train reinforcement learning models to autonomously play the game, simulating AI vs AI policy battles, and generating training data for optimal sustainability strategies. Add multiplayer modes, partner with educational institutions for curriculum integration.
Mailopolis demonstrates how multi-agent systems can simulate the true complexity of real-world urban policy-making, where decisions depend on multiple interconnected factors, competing stakeholder interests, and cascading effects across city systems - creating an authentic representation of how sustainability policy actually works in practice.

Log in or sign up for Devpost to join the conversation.