Timberborn 1.1 mod · Version 0.4.9

Late-game colonies that keep up.

Big colonies make the game repeat the same work again and again: finding jobs for haulers, rebuilding routes, searching for trees, cleaning up memory. Late Game Performance removes that repeated work, so you get fewer lag spikes and freezes. It is built to change how quickly the game finds its answers, not what the answers are.

  • Free & open source (MIT)
  • Needs Harmony and Mod Settings
  • Built against Timberborn 1.1.2.4

Played in a real late-game colony. In a save of about 350 beavers it gave noticeably fewer lag spikes (played as 0.4.8; 0.4.9 runs the same code). See exactly what is and isn't tested.

Time per frame a lag spike Without the mod With the mod
Illustration only, not real data.

Big colonies do the same work over and over.

Every decision a hauler makes, every road you finish and every lumberjack's search for a tree makes the game redo calculations whose results mostly have not changed. In a small colony that costs nothing. In a colony of hundreds of beavers it adds up, and you feel it as the game stuttering.

This mod keeps the results the game has already worked out, does the heavy parts on other CPU cores, and skips lookups that could not change the answer. Beavers make the same choices they would have made anyway, just sooner.

It is aimed at big late-game colonies. A small colony has little repeated work to remove, so it is unlikely to notice much.

Features

What it changes in your game

Haulers stop redoing their homework

Every time a hauler looks for work, the game rebuilds and sorts a list of every hauling job in the district. The mod keeps each list until something that feeds it changes. It is the same list, in the same order, that the game would have built.

Road changes stall the game less

After you finish a path, stair or platform, the game has to rebuild the route map of every building with an entrance, and does it on the main thread. The mod spreads that work over up to 7 worker threads, and the maps come out exactly as the game would have built them.

Lumberjacks search smarter

To find a tree, the game measures the path to every marked tree, though most of them are still growing. The mod leaves out the measurements that cannot change the answer. Lumberjacks, gatherers and farmers still get the game's own result.

Fewer memory-cleaning freezes

The game cleans up memory with everything stopped, which in a big colony can freeze it for most of a second, about once a minute. One tick-box in the mod's settings page switches on incremental collection, which does the same work a few milliseconds at a time.

Built for BeaverBuddies co-op

Every speed-up is built to give the game's own answer, and nothing that affects the simulation is a setting, so every player on the same version runs the same code. Compatibility with multiplayer has been the top priority. Details

See what it does for you

The mod writes a timing line to the game log: ticks per second, longest frame, time per system, memory clean-ups and saves. You can measure your own colony instead of taking anyone's word for it.

Co-op first

Built for BeaverBuddies from the start.

In multiplayer every player's game has to calculate exactly the same thing. A performance mod that changed even one answer would be worse than no mod, so keeping BeaverBuddies games in step has come before every speed-up.

It has been played in multiplayer on two computers, and tested extensively against the game's own code. The full list is below.

  • The game's own answers. Hauling lists and tree searches are the game's results, and route maps have exactly the game's contents. Tests compare them against the game's own code.
  • Same version, same behaviour. Nothing that affects the simulation is a setting, so two players cannot drift apart by editing a settings file. A multiplayer mod's version check covers the rest.
  • Independent of what any one player looked at. Which route maps get built never depends on what a single player's screen asked for.
  • Easy to confirm. A startup line in Player.log reads the same on every computer running the same version.
  • Local choices stay local. Memory clean-up, thread counts and timing logs do not affect the simulation, so each player can set them differently.
Safe by construction

What it always does

  • Can be checked against the game: verify modes run the game's own hauling list and tree search alongside it and log any difference.
  • Switches a feature off for the rest of the session if it throws an error, and lets the game's own code run instead.
  • Does not start a feature at all if a game method it needs is missing, for example after a game update.
  • Behaves the same for everyone on the same version.
  • Stores nothing in your saves.
Hard limits

What it never does

  • Approximate: it skips work only when the answer cannot change.
  • Change what your beavers decide on purpose. The one known difference is explained in the FAQ.
  • Touch a game file unless you tick the incremental memory clean-up box.
  • Let a settings file put two players out of step.
  • Need anything besides Harmony and Mod Settings.
Results

What the numbers say

Figures from the mod's own test harness and from play. None of them is a promise about your colony: the gain depends on its size and shape.

Path lookups in one tree search

A model forest of 2,000 marked trees, 50 of them grown. Lower is better

Game's own search 2,000
With the mod 51
View chart data as a table
CaseLookups
Game's own search2,000
With the mod51

A test model of the game's search, not a live game. How much it saves in your colony depends on your forest: a lot when most marked trees are still growing, nothing when every marked tree is grown.

Time to rebuild 420 route maps

A 22,600-tile road network in the test harness. Lower is better

One at a time 1.8 s
On 7 workers 0.23 s
View chart data as a table
CaseTime
One at a timeabout 1.8 s
On 7 workersabout 0.23 s

In the game the workers run alongside the tick, and the main thread still builds a map itself if it needs one before a worker has reached it. The harness road network is heavier than a real colony's.

Memory clean-up freezes

One 35-minute multiplayer session, same save and same mods, on two computers

Without incremental collectionWith it
Freezes from memory clean-up39, median 675 ms each (about 30 seconds in total)1 frame over 50 ms outside of saves
In playDrastic spikes at high tick ratesMuch steadier frame rate at high tick rates

Two different computers in one session, so hardware counts as well as the setting. The memory in use was 1.6 to 2.7 GB on both.

about 350
beavers in the late-game save it was played in
noticeably fewer lag spikes
133
automated checks pass
including 44 patch targets checked against the game
0
differences from the game's tree search
in 4,000 random forests
9.5 million
route map nodes compared with the game's own
every one identical
Status

What is tested, and what isn't

Tested extensively, but it is still a young mod, so here is the honest picture. Try it on a copy of a save first.

Verified

  • Played in a late-game save of about 350 beavers (as 0.4.8): noticeably fewer lag spikes.
  • Played in multiplayer sessions on two computers, including a 35-minute session logged on both.
  • 133 automated checks pass against the installed game's own assemblies, including 44 patch targets.
  • Rebuilt route maps are identical to the game's, node for node, whoever built them, and every map is complete at the moment it is asked for (25 shuffled rounds with workers busy).
  • The tree and plant search gives the same answer as a model of the game's search in 4,000 random forests, with unreachable, dead and destroyed plants and ties.
  • Nothing that affects the simulation can be changed from a file.

Not yet verified

  • This exact 0.4.9 build has not been reported as played yet. It runs the same code paths as 0.4.8 with its default settings.
  • The tree search against the game's own search inside a running game (the model comes from reading the game's code).
  • A controlled frame rate benchmark. The improvement is reported from play and logs, and it depends on your colony.
  • Whether adaptive garbage collection pacing helps at all: it is experimental, and one session each way showed no difference. It is off by default.
  • The main menu notice about incremental collection, because the test computers already have it on.