monkeylashes
← Homeworld: Unbound

Homeworld: Unbound 0.4: one APK, and a fix for the hyperspace crash

The big change is that there’s one APK now instead of two, and it plays either campaign. But first, the bug I fixed along the way.

Hyperspacing out of a mission crashed the game

It happened on every mission transition, not just the second one. I hadn’t run into it before because I’d put far more hours into the first mission than into getting out of it. The backtrace ended fifteen frames deep in the texture registry, nowhere near the VR code that caused it:

singlePlayerLoadNewLevel -> trRegistryRefresh -> HorseRaceNext
  -> horseRaceRender -> rndFlush -> vrFrame -> vrRenderEyes
  -> rndMainViewRenderFunction -> ... -> trNoPalMakeCurrent   <- SIGSEGV

Read from the bottom up, the cause is clear. The VR frame runs off rndFlush on purpose. But the loading bar also calls rndFlush every time it moves. So every tick of the progress bar rendered a full stereo frame, drawing the world while the texture registry was in the middle of freeing and reloading every texture, and the renderer asked for one that had just been freed.

The fix is to not draw the world while a level is loading. You don’t lose anything, because there’s no coherent world to draw yet and the loading bar is on its own layer.

One APK

The demo/full split was compiled in. It picks which .big file gets opened, the music and speech filenames, and the mission list itself, which is a literal array. A single binary can’t do both.

So the APK carries both builds and picks one at launch, based on whether your game data is there. The demo assets are packed inside and unpack on first run, so it plays as soon as it’s installed. Once you put your own copy’s files in, the next launch is the full campaign, and the demo files that would otherwise override yours get cleared automatically.

Giving orders

B is the attack button now. Hold and release it to attack what you’re pointing at, or pull the trigger while holding it and sweep across several targets to hit them all with one order. Drawn routes are now flown as curves, where before they were a chain of waypoints. A single destination slides along the route ahead of the fleet, and the existing move order is steered instead of being reissued, so ships don’t pivot or restart their engines at every point.

Your objectives moved to the wrist, because the game hides them behind the Hyperspace button on any mission where you can hyperspace.