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

PolisEngine

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.

About the project


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.

Headless

No dependency on a game engine or UI

Deterministic

The same input always gives the same result

Moddable

Content and behaviour can be extended without touching the code

Data-driven

Content is defined in data files

What the engine simulates


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.

Economy

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.

Population

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

Society

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.

Infrastructure and transport

Buildings, transport networks, vehicles and timetables, supply chains, warehouses and detection of breakdowns in supply.

World and space

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.

Modding

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.

What it can be used for


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.

City-building strategy

The frontend sends commands and receives events; the engine runs the whole simulation underneath.

Economic sandbox

Comparing how different economic arrangements respond to the same external shock.

AI training

A deterministic headless loop an agent can work with at the full speed of the hardware.

Scenario modelling

Simulating economic and social transitions and observing what comes out of them.

Technical specifications


Library

Language: C#
Target platform: .NET 10
Licence: LGPL v3
Configuration: fluent builder or TOML
Distribution: .NET class library

Quality and testing

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

Project status


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 development

Code and development


PolisEngine 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.