Developer Diaries

The diaries we keep while building MKA Engine: what we built, why, and what we measured.

The diaries we keep while building MKA Engine. Each diary covers one decision, the reason behind it and the result we measured. For the engine itself, see the MKA Engine page.

Developer Diaries

Dev Diary #11: Bounded spread and the nearest source

· Open separately

Several brass lanterns on an old map; soft rings around each lantern meet in thin border lines where they touch

In short: On a strategy map, each capital spreads only to places it can reach within the chosen cost limit. MKA Engine can calculate many sources together; only reachable places with an eligible source in their group are matched to that group's lowest-cost source, and places without one remain unmatched. In a game-scale-like measurement with 30,000 places and 282 sources, the combined path took 13.1 ms versus 2,691.8 ms for calculating each source separately and combining results; this measures one map calculation, not a full game day.

Later measurement note (28 October 2026): The diary keeps its original content date, 17 October 2026; the main comparison below comes from this later seven-round measurement record.

Why was a separate calculation for every capital expensive?

Imagine each capital sending an ink drop across the map. In the old approach, reachable places up to the cost limit were calculated separately for each source, then the results were combined. As the number of sources and reachable places grew, so did the collection of results to combine.

What changed?

MKA Engine can now calculate the spread for many sources together. The game chooses which places each source can reach within the selected cost limit. For nearest-source calculations, the game can also group places. Only reachable places with an eligible source in their group receive a match; the lowest-cost eligible source is selected, and a place with no eligible source remains unmatched.

This brings source results together for one comparison, while the game still defines the cost rule and what each group means.

A schematic map shows multiple sources spreading up to the chosen cost limit; only reachable places with an eligible source in their group are matched to the lowest-cost source, while unmatched areas remain muted.

What did the measurements show?

The 28 October measurement used a 30,000-place map and 282 sources; the figures below are the median of seven rounds. The machine was shared with other work, and its recorded system-load readings were 13.8 / 21.0 / 23.4. Absolute times therefore apply only to these conditions.

PathMedian time
New calculation for many sources13.1 ms
Repeating the calculation for each source and combining results2,691.8 ms
Nearest source in a game-scale-like scenario

These are wall-clock times for the measured engine step, including writes to the two result columns; they are not pure computation times.

This scenario used 282 sources and a cost limit of 226 units. That value describes the example map, not an engine limit. In the same measurement, with a narrower 24-unit limit similar to a country-sized area, the new path took 8.2 ms and the per-source path took 83.3 ms. These numbers come from that same comparison.

Why did we choose this approach?

Proximity, market access and supply can ask the same basic question: which eligible, reachable source can this place reach at the lowest cost? A game may choose different sources and groups, while the calculation remains the same basic operation.

What does it cost?

The result contains one value for every place on the map, not only the nearest place. These measurements did not use a full game turn or a game's own terrain or road costs, so they do not show the total time of a real scenario.

What comes next?

A full turn using the game's own cost rules was outside these measurements. The results compare only the source-finding calculation.

Frequently asked questions

What is bounded spread used for?

It finds which places can be reached from a source before the game-defined cost limit runs out. Several sources can be used on the same map.

How is the nearest source chosen?

The game can divide places into groups. Only reachable places with an eligible source in their group are matched to the lowest-cost source; places without one remain unmatched.

Is 226 units the engine limit?

No. It is an example cost limit used in a game-scale-like measurement. Another game can choose a different cost and limit.

Is 13.1 ms the time for a full game day?

No. The 13.1 ms is the wall-clock time of a measured engine step with 282 sources on a 30,000-place map, including writes to two result columns; it is not pure computation time. A full turn and game-specific cost rules were not measured.

For questions or suggestions, write to us through the contact page. For an overview of the engine, see MKA Engine; the full list is on the Developer Diaries page.