Developer diary

Dev Diary #10: Stable place keys in game map data

We explain why small map-edge changes shifted distant place identities and how the new method reduced key changes in one map comparison.

Contents
An open leather-bound register on a dark wooden desk, with map pieces tagged in brass beside it and a seal stamp

In short: In a strategy game, a place should keep its identity even when a border line moves, including in distant regions. In the map-preparation tool we use with MKA Engine, we look at why a small edge change moved place identities far away, and how our new draw method reduced that effect. Under the same edge change, the old method retired 6,039 place keys and the new method 2,239; this is one map comparison, not a promise of zero changes.

Update note: The content date of this post is 16 October 2026. Lasting keys for places had been added to the game's map grid on 14 October 2026, but most of the work discussed here came later. The option to soften the outline of impassable terrain was added on 23 October 2026, and on the same day the drawing of sea places was made independent of land. The edge measurement is recorded on 26 October 2026, the new land draw was recorded on 27 October 2026, and the lake and sea corrections, with the lake key measurement, are in records dated 28 October 2026. The corrections in this version were made on 4 November 2026, and the post was updated that day. Sections added after the content date say so in the text.

Why do map keys matter?

In a strategy game, a place may be renamed or its border redrawn, but historical events, event texts and game content still have to point to the same place. That is why every place, province and larger region has a lasting key inside the game. Think of a key as a permanent identity number: when the map is prepared again, the same place should come back with the same key.

A name and an identity are not the same thing. A place may be renamed, but its key should stay the same as long as it is still the same place.

While a map is being prepared, a key register matches old places with new ones. A key for a place that no longer exists is retired, not handed to another place. The rule exists so that content does not quietly attach itself to the wrong place.

This post is about how well those keys hold up when the map changes, and what we changed to make them hold up better.

One caveat first. In this version, places, provinces and sea records are still matched by the position of their centres, while hand-named land areas, regions and subcontinents are matched by name. When a centre moves far, the match becomes harder. We come back to this limit below.

How a small border change reached distant places

When a small change is made along one map edge, we expect its effect to stay near that edge. In our old method, however, starting points for land regions were drawn from one shared random sequence. When one region's shape or number of draws changed, the choices for regions processed later could shift as well. It is like a draw in which a small difference in an early pick changes some of the later picks. The expectation that a change stays local did not hold under the old method.

Conceptual diagram, not to scale: a shared draw chain shifts markers in distant regions after a border change, while location-based draws concentrate most changes near the edge, though some distant markers still change. Marker counts are not the measured key counts.

The change we measured was small. Softening the outline of impassable terrain changed the world's impassable area by about one percent (impassable terrain means areas closed to settlement and travel, such as ice, high ground, deserts and mountain peaks). Even so, the old method retired 6,039 place keys. Of those, 3,367 were more than 50 map pixels away from the changed edge. Here a pixel is one small cell of the map's measuring grid. In this measurement, the loss does not look proportional to the size of the change.

The effect did not stop at individual places, either. In the old method, some hand-named land units also gained a second key when their centres moved: places called North Africa, the Himalayas and the Nile Valley each received a second key. If a game event was tied to the North Africa region, the second key would have left unclear which identity that event belonged to.

In this post, the "new method" means the version that, on 23 October, made the drawing of sea places independent of land and, on 27 October, changed the land draw and the place-name keys. The "old method" is the run from before those two changes. Its figures come from the run dated 23 October 2026; the new method's figures come from the run dated 26 October 2026, and the land draw itself was recorded on 27 October. Both measure the same edge change, but the two methods were not run side by side in one pass. Keep that in mind when you read the numbers.

How the measurement was run

We compared two states: one in which the land outlines kept their old shape, and one in which they were softened. The two states differed in outline shape. Their starting key registers differed too: the state with the old outlines began from the register left by an earlier preparation, and the softened state began from the register the first state had left. In each state we counted how many keys survived, how many were retired and how many were newly created, at the levels of place, province, area, region and subcontinent. We also counted separately the retired places that were more than 50 pixels from the changed edge. We counted retired places on land and at sea separately, too. The figures in this post are taken from our measurement records; the key counts were not rounded.

What the same change showed

The table compares both methods under the same map-edge change. It covers one game map grid. Other maps, and a full play session, were not measured.

MeasureOld methodNew method
Retired place keys6,0392,239
Retired place keys on land / at sea4,913 / 1,1262,239 / 0
Retired keys more than 50 pixels from the change3,367131
New place keys created5,8292,020
Retired province keys1,190438
Retired area / region / subcontinent keys65 / 10 / 20 / 0 / 0
Place keys under the same map change

Two results stand out. The number of retired keys far from the change fell from 3,367 to 131. The old method also retired 1,126 water places, while the new method retired none in this comparison. That result cannot be traced to one change: the new side combined the sea-draw change of 23 October with the land-draw and place-name changes of 27 October. The number of new place keys fell as well, from 5,829 to 2,020. A new key is a place identity that was not in the earlier register. So the old draws did not only remove identities; they also created many new ones. At the level of areas, regions and subcontinents, the old method retired 65, 10 and 2 keys; the new method retired none at those levels.

Looking at distance more closely, the difference is smaller, but the direction is the same. Retired keys at most 50 pixels from the changed edge fell from 2,672 to 2,108. So the new method also reduced losses near the edge; the large difference appeared further away.

The measurement attributes the 131 remaining far retirements to the density targets, not to the locality of the draw. Each world group, such as North America, has a fixed target for its land places. When an edge change alters a group's impassable terrain, the group's settled-place scale area changes too, and with it the number of places each of its regions receives. In North America that scale area fell from 2,076 to 1,024 square kilometres, and the count of impassable and corridor places fell from 553 to 300. The remaining far changes are the intended result of the density target.

How the new draw works

We recorded the new land draw on 27 October 2026. Our aim was to keep the effect of a change close to its own edge. Below we explain how the method works and where its limits lie. On land, each map square carries a fixed number derived from its own position. A region's starting points are chosen only from its own squares, their weights and the number of places assigned to it. A change in another region's shape or in the processing order does not shift them. The effect of a change therefore tends to stay around the edge that caused it.

These numbers are not drawn in sequence from one shared stream. Each square's number is computed from a fixed starting value and the square's own position, so a change around one region cannot shift the numbers of squares far away.

A weight is a value that makes a square more or less likely to be chosen within its region. The number of places assigned to a region is set by its world group's fixed target and its settled-place scale.

Three further rules shape the behaviour:

  • When a region is given more places, the earlier choices stay where they are. New places are added; old ones do not move.
  • Hand-named land areas, regions and subcontinents, such as North Africa or the Himalayas, take a fixed key from their name. They are not matched by centre, so their key does not gain a second number when the centre moves. If one was retired and comes back, it gets its old key back. Two entries that would receive the same name key are an error.
  • Sea and lake places draw from their own sequence, so a change on land does not move the seas.

The method has a limit we want to be clear about. Places, provinces and sea records still match by centre, while hand-named land areas, regions and subcontinents match by name. The new draw protects the starting points of land regions, but it does not protect every record. When a centre moves far enough, a record can fail to match and be retired.

We also looked at repeatability, but with one check only. In the smooth-edge state, rerunning the map-structure step with its own keys reproduced the key register and the structure file byte for byte. That check covers this state and this step only. Other preparations with the same inputs, or other maps, are not shown by this measurement.

Lakes and seas need their own keys

Water turned out to be the messier part, and the first problem was names. Unnamed water places took the name of the nearest named sea. Lake Nasser ended up in the Red Sea group, Lake Victoria in the Indian Ocean group, and Lake Baikal in the Bohai group. The lakes had no identity of their own. For the game, this meant a lake could sit inside a sea's group, and an event or rule tied to that lake could then attach to the wrong identity.

After the fix, a lake is a water body inside the land layer of the Natural Earth dataset. Large water bodies outside that land layer, such as the Caspian Sea, stay seas. Lake names come from the HydroLAKES dataset. Lakes are also gathered into regions of their own: each lake area joins the lake region of the land subcontinent it touches most.

The second problem came from separating lakes from seas. In one trial, lakes were removed before the sea groups were built. Smaller seas, including the Gulf of Finland, the Kattegat and the White Sea, then fell under a size rule, merged into their neighbours, and some of their keys were retired. The North Sea region was retired as well. The fix, recorded on 28 October 2026, builds the sea groups over all water first, and only then removes the lake places from them.

Conceptual diagram, not to scale. On the left, lakes are drawn in one linked chain with the sea markers, which shows the earlier grouping. On the right, each lake gets its own orange marker, and the sea markers stay in place. Marker counts are not the measured key counts.

The third problem was numbering, and it appeared on 28 October 2026. After a fix changed how lake records were given keys, for a time each setup gave a lake a new numbered key. A lake named Abaya became Abaya 2 and then Abaya 3. A further fix the same day stopped this pattern. Had it continued, the next setup would have retired 276 water areas and 293 water provinces and reopened them under new identities; in practice, the same map prepared twice could receive different identities. After the fix, a lake keeps the key its name produces, and a shift of its centre does not change that.

In the softened-edge state (B), re-running the grouping of places into provinces, areas and regions with its own keys left the register and the grouping output identical. These results apply only to this map and this register. For game content, this means a lake can be referred to by its own key; the lake keeps its own name and does not get folded into a sea group.

A one-time switch, and what it costs

Moving to the new draw method was a separate, one-time change. It is not a measure of how edge changes persist. The 26 October 2026 measurement shows that when the old register was carried over to the new draw method, 5,098 place keys were retired. That is a measured count of the switch itself. The cause was the change of draw method, so it is the cost of the switch. On the sea side, 28 sea areas, three sea regions and one sea subcontinent received new keys, because sea places are now drawn independently of land, a change made on 23 October. In the edge comparison, even under the new method, not every distant key stayed in place: 131 distant keys were still retired.

For a game, the practical consequence is simple. If an event, a name or a rule is tied to a key, that tie can break during a switch like this. For example, an event attached to a region's old key would need to point to the new one once that key is retired. A one-time content migration is therefore needed for such content. How the game carries this out is its own decision. This measurement does not cover saved games or content migration.

What this comparison did not measure

We want to state the limits plainly. Only one game map grid was measured, so the same proportions should not be expected on other maps. The old and new figures come from separate runs, and the new side carried two changes from different dates together, so this comparison cannot separate their effects. No full play session, saved game or content migration was measured. Distant keys do not stay fully fixed: the density targets leave 131 far retirements in this comparison. Finally, the cause of the one retired water region is not yet verified. This measurement also covers one edge change only, so the effects of larger or differently placed changes do not follow from it. We do not give one summary percentage for the whole comparison, because places, provinces, areas and regions behaved differently, and each level should be read on its own.

What comes next

Three questions remain open. First, the reason one water region was retired still has to be found. A retired key can break any content that points to it, so the reason matters. Second, the density targets involve a game-level choice: how many distant keys should move when an edge changes. That choice belongs to the game. Third, any content tied to keys needs its own migration plan, which is also the game's decision. This post reports what has been measured so far; it does not answer those questions.

Frequently asked questions

What is a map key?

It is the lasting identity that game content uses to refer to a place, province or region. If an old place and a new one can be matched after a map change, the same key can be kept. If an event text points to that key, the event stays with the same place even when the place is renamed.

Does the new method guarantee that no distant key will change?

No. In this comparison, the new method still retired 2,239 place keys, all of them on land. Keys retired more than 50 pixels from the change fell from 3,367 to 131, but not to zero. The measurement attributes the remaining 131 to the density targets of world groups, and the North America example shows the first links of that chain in numbers. In this comparison, no area, region or subcontinent key was retired. Place, province and sea records still match by centre, though, so a record can be retired if its centre moves far enough.

Is the switch to the new method the same as a small border change?

No. The switch was a separate one-time step, outside the edge-change comparison. In that step, 5,098 place keys were retired. That is a measured count of the switch, not a measure of how edge changes persist.

Do these results apply to every game map?

No. The measurement used one map grid and one register copy. Other maps may behave differently.

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

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.