Skip to content

0.4.16 preview

Pre-release
Pre-release

Choose a tag to compare

@kramsey458 kramsey458 released this 22 Sep 01:27
· 66 commits to main since this release

Preview of Late Game Performance for Timberborn 1.1.2.4. Not yet played. The latest release is still 0.4.14. One fix and one measuring tool, both from reading a 35-minute Performance Log recording of a 354-beaver colony at speed 7 on 0.4.14.

Multiplayer: every player installs this same version. Nothing in this version changes which ticks run or what they compute.

After a long frame the simulation no longer catches up all at once

The game turns each frame's Time.deltaTime into simulation buckets, and Unity caps that delta at a third of a second. So after a 300 ms frame (an autosave, a garbage collection) at speed 7 the next frame is asked for 2.1 s of game time, three and a half ticks. In the recording every autosave was followed by frames of 131, 66, 142, 290 and 107 ms, and every collection frame by a similar tail: one hitch became about a second of stutter.

From 0.4.16 one frame may catch up at most twice the recent ordinary frame time (at least a thirtieth of a second); the rest is simply not run, so the simulation loses a fraction of a second of wall clock per hitch. Which ticks run, and in what order, is unchanged, and how many buckets one frame runs already differs between players and machines, so this is pacing, not simulation.

  • The limit follows each machine's own frame time. A computer that always needs 70 ms per frame keeps its full share; a guest catching up in BeaverBuddies at a raised speed still catches up.
  • It hooks Ticker.Update, which BeaverBuddies leaves to the game (its own patch there only marks that ticking is in progress).
  • Setting LimitCatchUp = false in LateGamePerformance.cfg switches it off. A CatchUp: line is logged with the stats whenever it did something: how many frames were limited, how much game time was left out, the longest such frame and the ordinary frame time it measured.

Diagnostics now time the game's own path searches

The same recording shows single beaver ticks of 6 to 14 ms, and the frame rate at its lowest at the end of every game day. By reading the game's code, the suspect is the path search the game falls back to when no route map answers: a beaver standing off the road network (a field, a forest) pricing every building that could satisfy a need, or walking to a random spot, runs a full A* search on the main thread inside its own tick, once per building priced. That is not measured yet, so this version measures it.

With Diagnostics = true in the cfg the Diagnostics: line now also reports need selection, walker path finding and both A* searches: calls, total time, the longest single call, and for the searches how many were real searches rather than answers from the previous one, how many nodes they explored and how many explored everything reachable. It adds overhead to hot code; switch it back off after one session. Please send those lines together with the CatchUp: and Timing: lines from a big colony.

What was tested

230 checks pass against the installed game's assemblies, including all 79 patch targets.

  • The catch-up rule: ordinary frames pass unchanged, a 300 ms frame after 16 ms frames is cut to a thirtieth of a second, a steady 70 ms machine keeps its full share, paused frames are left alone, an exception switches the feature off and leaves the game's delta untouched.
  • Not tested: the game running with the limit. The test harness cannot apply patches.

Install

  1. Close Timberborn. Delete any older LateGamePerformance folder, then extract LateGamePerformance-0.4.16.zip into Documents/Timberborn/Mods.
  2. Requires the Harmony (2.4.1+) and Mod Settings Workshop mods.

SHA-256 of the zip: 12ef031422c1a0ad094dca319231c2cb89b840970961fc0bfb5c71f35e7d09c5