Simulating 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 when a state raises taxes, nationalises businesses, or when the supply of goods is cut off. It is being built as a backend for city-building strategy games, but it is usable anywhere a society needs simulating without a game and a UI around it.
PolisEngine is a simulation library written in C# for .NET 10. It simulates the economy, population, society, transport and infrastructure, with all of those systems influencing one another – a shortage of goods drives satisfaction down, falling trust undermines the government's legitimacy, economic collapse triggers migration.
The engine is deliberately headless. It knows the state of the world and the rules of the simulation, but not how any of it looks – the entire visual side is a matter for the frontend, which pulls the engine in as a dependency. The same simulation can therefore be driven by a 3D game, a web interface or a console application.
No dependency on a game engine or UI
The same input always gives the same result
Content and behaviour can be extended without touching the code
Content is defined in data files
PolisEngine models several interlinked domains. Each one works on its own, but the real dynamics only emerge from how they act on each other across simulation ticks.
Markets, prices, businesses, taxes, the state budget and debt, a central bank, privatisation and nationalisation, capital flows and planned economies. Economic models are swappable – the capitalist implementation can be replaced with another without touching the core.
Inhabitants as individual agents or as aggregated groups, depending on the level of detail required. Demographics, education, needs, social strata and migration.
Trust in government, legitimacy, social indicators and their feedback loops, cultural values and norms. Indicators are computed through a dependency graph, so they can be wired together freely.
Buildings, transport networks, vehicles and timetables, supply chains, warehouses and detection of breakdowns in supply.
A grid world divided into simulation chunks, terrain, natural resources and zones. The level of simulation detail is controlled per chunk, so large maps can be computed without losing performance.
The modding API allows new types of buildings, goods and social indicators to be added, custom economic models to be registered and game logic to be written in Lua. More dangerous permissions, such as network access, have to be granted explicitly.
The engine is not being built for games alone. Because it has no ties to graphics or user input, it can be run anywhere a society or an economy needs simulating.
The frontend sends commands and receives events; the engine runs the whole simulation underneath.
Comparing how different economic arrangements respond to the same external shock.
A deterministic headless loop an agent can work with at the full speed of the hardware.
Simulating economic and social transitions and observing what comes out of them.
PolisEngine is at an early stage of development and is not yet usable. The basic infrastructure is being built and most of the simulation systems do not exist yet. The public API is not stable and will change without notice. So it is not something to deploy today.
Early stage of developmentPolisEngine is built in the open on GitHub. The code, the architectural documentation and the development plan are all public – to look at, to use and to comment on.
Current status: early stage of development
PolisEngine is an open-source project. The terms of use can be found in the licence in the repository.