Developer diary

Dev Diary #3: Organizing a Game World in Memory

How a strategy game arranges its information so rules can read one kind of value across many game objects.

Contents
A worker collects values from scattered boxes on the left; the same values appear in an ordered row on the right, illustrating two data arrangements.

In brief: MKA Engine keeps the same kinds of game information together. When a rule needs one value across many units, it can read that information without carrying every unrelated detail of each unit along. The engine does not decide which game facts exist; the game does.

Which game information does a calculation really need?

A strategy game may keep information about many countries, towns, or other game objects. For example, a rule might need to add up the population values of all units. If every unit's full record is stored together, details that are not needed for this calculation may travel through the same path as well.

Keeping values of the same kind together

How does a data column work?

MKA Engine organizes game data in tables. A field in a table is one piece of information held for each game object; all values for that field are stored together in memory. We can call this a column layout: one column holds the same kind of information for many game objects.

Imagine population counts in a fictional game. A rule that adds all populations can read that column without visiting each object's culture, treasury, or other fields. The illustration compares the two arrangements; this example explains the layout, not built-in game content shipped with MKA Engine.

A schematic view of the same six example game locations in two layouts: on the left, each location bundles population, money, and map-position values; on the right, the same values are grouped by type, with population in one highlighted lane.

What does the column layout explain?

This article explains the memory layout and the information a calculation can read. The layout alone does not prove a measured speed increase in a particular game; this article does not present a comparative timing result.

Why organize data by field?

A rule often examines the same kind of information across many similar game objects. Keeping that field together lets the calculation follow only the information it needs. The game still chooses its own fields and rules.

The limits of calculations that need several fields

This layout does not make every task faster by itself. A rule that needs several facts about one game object has to read those fields separately; the result depends on the game's data and calculations.

Turning to calculations in a game step

The next diary explains the order in which game rules run within a step, and how independent work can proceed together.

What does a column layout mean?

It keeps the same kind of information for many game objects together. For example, one column could hold the population value of each object.

Does MKA Engine include ready-made countries or populations?

No. The engine provides a way to organize data; the game content defines which objects and facts exist.

Is this layout always faster?

A claim like that requires a comparison using the same game and conditions. This article describes the data layout and does not present a comparative speed result.

Sources and related docs

You may also like

  • How is a strategy game's world map made?

    For MKA Engine we built a 27,357-location world map of 1337 from real data: how terrain, rivers, straits, population and location borders were made.

  • The road to a game engine

    How we started MKA Engine: reading four games, treating determinism as law, moving phase by phase with measurements, and where we are now.