layered-waves-haikei (1)-svg-svg

PolisEngine

Simulations of Cities, Economies, and Societies

PolisEngine is an open-source simulation library for modelling cities, economies and societies. It can answer questions such as what happens if the state raises taxes, nationalises businesses or the supply of goods is cut off. It is being built as a backend for city-building strategy games, but it can be used anywhere a society needs to be simulated without a game and a user interface around it.

About the Project


PolisEngine is a simulation library written in C# for .NET 10. It simulates the economy, population, society, transportation, and infrastructure, with all these systems influencing one another—a shortage of goods lowers satisfaction, declining trust undermines the government’s legitimacy, and economic collapse triggers migration.

The engine is intentionally headless. It knows the state of the world and the simulation rules, but it doesn’t handle how things look—all visual aspects are handled by the front end, which the engine connects to as a dependency. The same simulation can thus power a 3D game, a web interface, and a console application.

Headless

No dependency on a game engine or UI

Deterministic

The same input always produces the same result

Moddable

Both content and behavior can be extended without modifying the code

Data-driven

The content is defined in data files

What the engine simulates


PolisEngine models several interconnected domains. Each of them operates independently, but the true dynamics emerge only through their interactions across simulation ticks.

Economy

Markets, prices, businesses, taxes, the national budget and debt, the central bank, privatization and nationalization, capital flows, and the planned economy. Economic models are interchangeable—a capitalist implementation can be replaced by another without altering the core.

Population

Residents as individual agents or as aggregated groups, depending on the required level of detail. Demographics, education, needs, social classes, and migration.

Society

Trust in the government, legitimacy, social indicators and their feedback loops, cultural values and norms. The indicators are calculated using a dependency graph, so they can be linked in any way.

Infrastructure and Transportation

Buildings, transportation networks, vehicles and schedules, supply chains, warehouses, and detection of supply disruptions.

The World and Space

A grid world divided into simulation chunks, with terrain, natural resources and zones. The level of simulation detail is controlled per chunk, so large maps can be computed without losing performance.

Modding

The modding API allows you to add new types of buildings, goods, and social indicators, register custom economic models, and write game logic in Lua.

What can it be used for?


The engine isn't designed just for games. Since it has no connection to graphics or user input, it can be run anywhere where a society or economy needs to be simulated.

City-building game

The front end sends commands and receives events, while the engine runs the entire simulation in the background.

Economic Sandbox

A comparison of how different economic systems respond to the same external shock.

AI Training

A deterministic headless loop that allows the agent to operate at full hardware speed.

Scenario Modeling

Simulating economic and social transitions and observing the outcomes.

Technical Specifications


Library

Language: C#
Target platform: .NET 10
License: LGPL v3
Configuration: Fluent Builder or TOML
Distribution: .NET class library

Quality and Testing

Tests: xUnit, FluentAssertions
Benchmarks: BenchmarkDotNet
Design: SOLID, data-driven, separate layers
Modes: real-time and headless

Project Status


PolisEngine is in the early stages of development and is not yet ready for use. The basic infrastructure is still being built, and most of the simulation systems do not yet exist. The public API is not stable and is subject to change without notice. Therefore, it is not yet ready for deployment.

Early stage of development

Code and Development


PolisEngine is being developed openly on GitHub. The code, architectural documentation, and development plan are all public—available for review, use, and feedback.

Current status: early stage of development

PolisEngine is an open-source project. The terms of use can be found in the license in the repository.