Contents
In short: Every game in MKA Engine carries an authority table: a player can only give commands to the entity they control, while an observer gives only the commands open to observers. In a new game the AI player controls every starting country; when a human player picks a country, that country is taken from the AI. In ironman mode, switching countries and becoming an observer are refused.
When two people play in the same world of a grand strategy game, everyone has to know what they may command. Otherwise one player could order another player's army. In the engine this works like a table layout: each player has their own country in front of them and cannot touch the country at the far end of the table. This diary explains how we set up that layout and what switching countries and observing cost.
Who has what at the table?
Every project game carries eight player rows. One of the rows belongs to the AI. When a new game is set up, the AI controls every starting country in the world. No human player controls any of these countries, so on the first day everyone watches a world run by the AI.
When a human player picks a country, two things happen: the player takes control of that country, and the AI lets go of it. A country that another human controls cannot be picked, and a country that does not exist cannot be picked either.
An observer controls no country. An observer watches the world and can give only the commands that are open to observers.
Why a separate table?
In lockstep multiplayer, every machine receives the same commands in the same order. That is why the authority rule has to live inside the engine: if every machine reaches the same decision, the world the players share does not split. The authority state is also part of the world state: it is saved, and loading brings it back. A player who resumes from a save therefore continues as the owner of the country they saved with.
Ironman mode
In ironman mode the save rules are strict: a manual save cannot be made, and a run can be marked as broken. Two things are closed in that mode as far as authority goes: switching countries and becoming an observer. There is one exception: if the player no longer controls any country, they can pick a new one. A player who has lost their country does not have to abandon the run.
Order matters too. In a new game the country choice has to happen before ironman mode is switched on. Once the mode is on, the choice is refused.
The developer console
The same work added a developer console to the engine. Every line typed into the console is compiled against the scopes of the content it uses. There are two kinds of command:
- A read command only asks a question and returns true or false. It does not change the world.
- An effect command changes the world. It runs only when the debug gate is open.
In ironman mode the console is fully closed. The console's screen belongs to the front end; the engine compiles lines, completes command names and keeps the history.
What it costs
- Speed was not measured. We did not measure the effect of the authority check on the time of a game day in this work.
- A real network session was not tested. The checks were done with the engine's own tests; a real session across several machines is not part of this work.
- Game decisions belong to the game. Which country belongs to whom under which rule is the design of the game. The engine guarantees that the rule is applied.
Frequently asked questions
Does the AI control all starting countries in a new game?
Yes. When a game is set up, the AI player controls every starting country. When a human player picks a country, that country is taken from the AI.
What can an observer do?
An observer controls no country. It watches the world and can give only the commands that are open to observers.
Can countries be switched in ironman mode?
No, with one exception: if the player no longer controls any country, they can pick a new one.
Is authority lost when a game is loaded from a save?
No. The authority state is part of the world state; the save keeps it and loading brings it back.
For more on the engine, see the MKA Engine page. For the base of the multiplayer layout, an earlier diary: Lockstep and desync. For questions, reach us through the contact 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.