Why the engine is now in Rust
Until last week the engine of this game, the part that moves every crate and every division, was written in TypeScript, the same language as the interface. Today it is written in Rust. On 17 November I had closed this idea because of a measure. This entry says what that measure looked at, what the second one looked at, and what the change costs. It describes the game as it is today, version 0.129.214.
The measure that said no
Speed 6 is the fastest speed of the game, 12 game hours in one real second. On the continent, with twelve powers and their networks after some hundreds of days, the engine could not hold it. On 17 November I asked Claude if it was possible, in theory, to move the engine to Rust or to another language, for the performance and for the threads. We measured one search, the one the green trucks use to find the divisions they can reach, in seven forms on the same map, from the engine's own TypeScript to native Rust. Every form found the same hexes in the same order.
The result was clear. The flat table alone made the search 2.8 times faster in TypeScript. Rust on the same table added little: on a whole hour of the continent, about 3%. So I said no to the rewrite. The notes of that day also said that the rest of the hour is made of objects, maps and lists, and that a rewrite would have to show its own figure there. We had not measured it.

The measure that said yes
On 20 November I asked for more: an app for Mac, Windows and Linux, speed 6 on maps as large as the continent, with many divisions and a complex logistics. I said that rewriting all the code was not a problem, and I asked Claude to try very different routes on my Mac. Claude tried another JavaScript engine, Rust on more parts of the day, and two shells for the desktop app, Electron and Tauri.
This time the parts measured were the heavy ones of a day at day 1500: the transport plan, the searches, and the code full of small objects that moves the vehicles along their lanes. The solver of the plan, already written on flat arrays, became 1.6 times faster. The object code became 6 to 9 times faster. For the whole engine the figure expected was 1.8 to 2.2 times on one thread. So the first measure was right about what it measured, and it had measured the part that Rust helps least. I opened the question again.
Electron stayed, because there the engine could move to Rust one part at a time while the TypeScript still played the rest. Each part was checked against the TypeScript call by call: the same inputs had to give the same bits. On 21 November I asked to be a bit more ambitious and to design the engine for many threads from the start, because one day I may want to scale to the whole world. That is a direction, with no date. On 23 November the desktop game played on Rust by default. On 24 November the TypeScript engine was deleted, more than 12,000 lines, and in the browser the same Rust code now runs as WebAssembly.
The change has a price, and I chose to pay it. With the old engine gone there is no second engine to compare the Rust with. The saves of the old format do not open any more: I said that I am not interested in the old saves, and there is no converter. The tests that checked that a game gives exactly the result of a recorded one are parked until 1.0, because I change the engine and the balance every day. What stays every night is a check of the speed on twelve big saves of the continent, so a change that makes the game slower reaches me the next morning.
Speed 6 is not held everywhere yet. On a cloud machine with four cores, the continent at day 1500 plays 11.9 game hours a second, where speed 6 asks for 12. Most of that time goes into the AI's transport plan, the part that the language helps least. More than that needs the threads inside an hour and a better method for the plan, as the measure of 20 November already said.
The port did not change the rules: until the TypeScript was deleted, the Rust was checked to play the same hours. If you play the continent, I would like to know at which day it starts to slow down on your computer. Bugs and ideas go to the public tracker.