thelongdrive.dev

What we've built for The Long Drive

Work on the game's beta branch, contributed to TLD RevaMP, Normal99's multiplayer and performance mod. Every number below was measured in the game, and every change links to its code.

3changes in TLD RevaMP
2already shipped in releases (0.68.2, 0.69.0)
1.6 millionlog lines gone from a 2-hour session
914 linesof code across 17 files

Timeline

  1. Bat fix merged into RevaMP (pull request #2), released in 0.68.2 the same night.
  2. Rabbit fix added, released in 0.69.0 eight minutes later.
  3. In-game mod browser added to RevaMP's development branch; it reaches players with the next release.

In-game mod browser

on RevaMP's development branch15 files · +822 −17 lines

A Mods screen in the game's settings (Settings → Revamp → Mods): browse, install, update and remove mods without leaving the game.

What it does

  • Lists the mods in RevaMP's catalog with author, size, description, source link and the version you have.
  • Install and Update download the mod's GitHub release and put it in place; the game asks for one restart.
  • Remove sets the mod's file aside (renamed, not deleted) for the next start.
  • Only mods on the approved list that ships with your RevaMP version can be installed, the same list RevaMP already uses when a host sends mods to players joining a game. Anything else is listed but can't be installed.
  • Nothing is downloaded unless the Mods screen is open.

Tested

CheckResult
Catalog loads in the gameevery catalog mod listed, with its state
Remove an installed modfile set aside as .removed
Install it again from its GitHub releaseinstalled, byte-for-byte the approved file
Install a mod that isn't approvedrefused before downloading
A different file passed off as an approved modrefused
Automated checks (no game needed)52 of 52 pass, run on every pull request

The code: commit 62b7282

Rabbits no longer slow the game down

in RevaMP 0.69.01 file · +57 lines

The problem

The game freezes rabbits that are 200–300 m from the player, but their walking and jumping code kept pushing them every frame anyway. Each push wrote a warning to the log, for every frozen rabbit, every frame: 13,800–16,500 lines every 20 seconds. 84% came from walking, 16% from jumping.

Measured with about six rabbits in range

BeforeAfter
Warning lines per 20 s13,800–16,5000
Time spent per second144 ms0.8 ms
Memory churn6 MB/s0

The fix

While a rabbit is frozen, its walk and jump are skipped. Turning, sounds and behaviour are unchanged, and a rabbit that wakes up walks on from where it is.

The code: commit c0c360d

Bats: 1.6 million log lines gone

in RevaMP 0.68.21 file · +35 lines

The problem

In a two-hour session, the game's log grew to about 170 MB: 1.6 million identical physics warnings, 99.8% of the whole log, between 160 and 1,850 every second depending on frame rate.

How it was found

Unity writes this warning without saying where it comes from. So every piece of code in the game and the loaded mods that sets an object's speed was wrapped with a counter. Every single warning came from one place: the bats the game places at some locations, which keep steering while frozen. It happens without RevaMP too (108 warnings in 15 seconds next to one bat), so it's a bug in the game itself.

Measured

Run (new world, 15 s on foot, then eight 400 m jumps)Frozen bat updates skippedWarnings
Without the fix–108 in 15 s
With the fix, run 18640
With the fix, run 24,6870

The fix

While a bat is frozen, its steering is skipped. Its sounds and choice of where to fly are unchanged, and an unfrozen bat flies exactly as before.

The code: commit ca23023 · pull request #2

Get it

The bat and rabbit fixes are in TLD RevaMP 0.69.0 and later, for the game's beta branch (Steam → The Long Drive → Properties → Betas → beta). The mod browser comes with the next RevaMP release.