Skip to content

Bring back what Aussie Outback 4x4 added to the engine: four-wheel drive, ruts, blows, shared scenes - #88

Merged
SamG-Coder merged 3 commits into
mainfrom
backport/game-engine-api
Nov 16, 2026
Merged

SamG-Coder merged 3 commits into
mainfrom
backport/game-engine-api

Conversation

@SamG-Coder

@SamG-Coder SamG-Coder commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Aussie Outback 4x4 is built on this engine in a fork, and its last thirty commits changed the engine's crates as well as adding the game. This brings back everything in those crates that is not the game's own, onto main as it is now (the fork has not fallen behind: its base is #87).

Nothing of the game comes with it: not its world generator, its menus, its trucks or its maps.

What comes back

Vehicles off the road (solstice-vehicle, solstice-physics)

  • Four-wheel drive: a transfer case with high and low range (Transfer, DriveMode), front and rear lockers, and a driveline solved as one (drivetrain::solve_all).
  • Ground that is not a road: Surface gains dirt, mud, bog, leaf litter, rock, ford and sand, each with how far a tyre sinks and digs, and how rain changes it (set_wetness). Tyres can be aired down; a payload weighs on the springs.
  • Ruts (rut.rs): soft ground keeps what tyres press into it. Wheels behind ride in the ruts of those ahead, a spinning wheel digs itself in, a deep rut holds a car back.
  • A car's body can have a tray and holds that loose things lie in, and the physics says what each step's contacts did to it (Knock, car_touches).
  • A walking character can jump, and can be put somewhere (place).

The game layer (solstice-game)

  • A driver who gets out and walks, and gets back in (get_out, get_in, Idle).
  • Loose things as bodies: add_thing, move_thing, carry, which ride in a tray and weigh on the car.
  • Blows measured: what a car hit, where on it, which way and how hard (impact.rs, take_impacts). What a blow breaks is left to the game.
  • A map of what the ground is made of for land that is not a circuit (SurfaceMap), and a surfaces FILE line in a scene's text to name one. That line is the one thing here the fork did not have: there the generator wrote the map itself.
  • A time to beat worked out from a track (par.rs), an autopilot with a pace, handicaps on what the player asks of a car, and parts of a car's model that can be taken off and put back (detach, attach).

Rendering (solstice-render, solstice-asset, solstice-import)

  • Ruts drawn: relief-mapped in the resolve pass from the same cells the wheels read (ruts.rs, ground/ruts.wgsl, Renderer::sync_ruts), with mud that lies wet at its heart and cracked at its rim (Material::MUD).
  • Glass seen through (Material::GLASS), headlamps (set_lamp), and a coat on whatever is driven: paint in any colour, rust, dust, mud, wet (Coat, set_coat, set_resprays, Material::PAINT, INSIDE).
  • Things made while a game is played: BuildOptions::flat, Renderer::rewrite_page and set_material.
  • The importer keeps each instance's node name (Imported::names), so a model of named pieces can have some shown and some not.

Scenes that share a file (solstice-asset, solstice-bake, bake)

  • shared at the end of an actor line: the actor's model is in shared.solstice beside the scene, and the two are joined as they are read (join.rs), whole or streamed.
  • lends in a scene's text: scenes baked beside it leave out every mesh and texture it also has, by content hash, and the join puts them back (lend.rs, join::fill).
  • Packs (pack.rs, bake --kit): a model of pieces in one file, each piece read alone.

Procedural ground and plants (solstice-procgen): four ground materials of dry eucalypt country (bush.rs), three more barks and four more kinds of leaf. Nothing in the engine uses them yet; they are there to be planted with.

In the viewer

Only what makes these reachable, about 300 lines, most of them one new file:

  • a scene with shared actors is read with the file beside it, whole or with --stream (shared.rs);
  • ruts are drawn round whatever is driven (play.rs).

What is left out, and why

  • The game's world generator (solstice-bake/src/outback, 9,300 lines with its tests) and the outback, proving and arena scene lines. With them goes lends outback; lends alone stays.
  • The game's viewer: its menus, sound, damage, mud thrown by the wheels, gamepad glyphs, the Android app. They lean on each other and on the game's pages, and would each be a change of their own.
  • Shared files in the browser viewer (web.rs, loader.js). The join itself is here; the page's side of it is tangled with the game's map cache.

Changed on the way

  • The tests drove the game's trucks from its scenes/ folder. They now read two fixtures beside gt.vehicle: truck.vehicle (a 2.8-tonne desert pickup) and wagon.vehicle (a two-tonne diesel wagon). tests/raptor.rs is tests/truck.rs.
  • docs/ruts.md is the fork's note on ruts with the viewer's and the game's parts taken out; docs/gameplay.md gains "What several scenes share".
  • Comments that pointed at the game's files point at the engine's, or at nothing.

Behaviour that changes for the engine's own scenes

  • A car driven off a circuit's tarmac now leaves marks on its grass and gravel, which are drawn.
  • One Play can have two actors with a camera if one is a car: the car and whoever drives it.
  • The frame's constants are larger (lamp, coat, resprays, ruts), and the resolve pass tests one number for each pixel of ground to skip ruts where there are none.

Checked

On Windows with an RTX 5080, on the final commit:

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --release -- -D warnings (seven lints in the ported code were fixed on the way: rut.rs, streaming/mod.rs, vg/resolve.rs, bake/src/kit.rs)
  • cargo test --workspace --release: 1,087 passed, none failed, 3 ignored (as on main: they need scans or are measurements), the GPU tests among them
  • the browser builds and their lints as CI runs them: the viewer plain, with gameplay and with the editor, and bake-web
  • python scripts/test_affected.py and node apps/viewer/web/editor/test.mjs

New tests with this: the join (solstice-builder/tests/join.rs), ruts (rut.rs, tests/ruts.rs), the truck off the road (tests/truck.rs), blows (impact.rs, tests/blows.rs), loose things (tests/things.rs), the viewer's adoption of shared actors (shared.rs), and a scene's surfaces and lends lines (scene_file.rs).

Not checked

  • Nothing was looked at. No scene was baked and opened with this branch's viewer: the engine's own scenes need their scans fetched, and none of them has a shared file or soft ground. The harbour's lighting, its car and its frame time are untested by eye and unmeasured here. In the fork the same crates draw the game's maps every day.
  • The viewer's two hooks are covered by unit tests and by compiling, not by a run: a scene read with shared.solstice (whole and --stream), and ruts on a circuit's grass.
  • The surfaces FILE line is new here and has its one test; no scene uses it.
  • Linux and macOS, a browser, and an integrated GPU.

Fixed after review

Two commits on top, from an independent review (Claude Sonnet 5.5):

  • Glass is a blended material whose colour is see-through (alpha below 1), in both importers. One whose colour is opaque stays opaque, as before this PR, and keeps off the masked raster path.
  • Damaged files are refused: the pack reader holds every length to the file's size, the surface map refuses runs that would wrap and rows past its own, and join::fill checks its sums.
  • Scenes that drive nothing pay nothing for ruts: the ruts' texture is a one-square stand-in until the first press (the resolve pass is bound again when it is made whole), and a square is counted changed and copied to the GPU only when its bytes change, so a car standing on grass no longer re-uploads every frame. The strip's size guard saturates.

New tests: a blended opaque-colour material is not glass (both importers), damaged packs, wrapped runs and extra rows in a surface map, a repeated press changes nothing, and a GPU test that ruts draw without errors from the first press.

Authorship

Written by: Claude, through Claude Code (the port and its fixes).

Reviewed by: Claude Sonnet 5.5 (two independent reviews: the PR, then the fixes; no findings left open). Locally verified by Claude Opus 5.5 at d1bea3d: bash scripts/check-changed.sh --all (1091 passed, 0 failed, all checks passed, GPU tests and browser builds included) and node apps/viewer/web/editor/test.mjs (all passed). The new sha2 dependency and the new file formats (SOLPACK1 packs, shared, lends and surfaces scene lines, .surfaces maps, new .vehicle keys) were approved by the owner.

  • All code, text and comments in this pull request were written by a frontier AI model, with no human-written code, and will be reviewed by a frontier AI model before merging, as the Code of Conduct requires.

🤖 Generated with Claude Code

SamG-Coder and others added 3 commits November 16, 2026 14:53
…wheel drive, ruts, blows, shared scenes

The game is built on the engine in a fork, and changed the engine's crates as it went. This
is everything in them that is not the game's own, on main as it is now.

Vehicles: a transfer case with low range and lockers, a driveline solved as one, seven more
surfaces with how far a tyre sinks and digs in each and what rain does, tyres aired down, a
payload, a tray that things lie in, and ground that keeps the ruts pressed into it
(solstice-vehicle's rut.rs), which the wheels behind ride in.

Game: a driver who gets out and walks, loose things as bodies, blows measured (impact.rs), a
map of what the ground is made of (ground.rs) with a `surfaces FILE` line in a scene's text
to name one, a time to beat worked out from a track (par.rs), and parts of a car's model
taken off and put back.

Rendering: ruts drawn by relief mapping from the cells the wheels read, mud that lies wet
and cracks at its rim, glass seen through, headlamps, a coat of paint, rust, dust and mud on
whatever is driven, and pages and materials written while a game is played.

Scenes: an actor whose model is in a file shared with other scenes (`shared`), a scene that
lends its meshes and textures to those baked beside it (`lends`), the join that makes one
scene of two, and packs of pieces read one at a time (`bake --kit`).

The viewer reads a scene with the file it shares, whole or streamed, and draws ruts round
whatever is driven. Nothing else of the game's viewer is here, nor its world generator.

The tests' trucks are fixtures beside gt.vehicle. docs/ruts.md says how ruts are built;
docs/gameplay.md says how scenes share.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…files

- Glass is a blended material whose colour is see-through. One whose colour is opaque is
  drawn opaque, as before glass, and stays off the masked raster path, with the old
  warning.
- The pack reader holds every length to the file's size, the surface map refuses runs that
  would wrap and rows past its own, and filling a borrowed scene checks its sums.
- The ruts' texture is a one-square stand-in until something is first pressed, so a scene
  nobody drives on no longer allocates tens of megabytes for it; the resolve pass is bound
  again when it is made whole.
- A square of ruts is counted changed, and copied to the GPU, only when its bytes change,
  so a car standing on grass no longer re-uploads its squares every frame; a square a
  strip changed nothing in is not kept. The strip's size guard saturates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ee-through colour

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SamG-Coder
SamG-Coder merged commit 7f12a9e into main Nov 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant