Cargo 3D — Loading Game
A browser 3D cargo-loading simulator: AABB physics plus multiple game variants, dual-track — open in a browser or ship as Electron.
- Role
- Developer
- Year
- 2025
- Stack
- Three.jsTypeScriptElectron
Container and truck loading looks like a simple if-it-fits-it-fits problem, but real loading has to satisfy volume utilization, weight limits, and axle-load distribution at the same time — a load can look full and still get flagged as overweight or tip-risk at the gate if the center of gravity and axle load are off. Most loading games only stack boxes visually, with no real collision or load-bearing checks, so a full-looking screen can still be a load that would never leave the yard.
Cargo 3D uses AABB (axis-aligned bounding box) checks as the core of its collision and stacking logic: before any box is placed, it runs a full-scene AABB intersection test, and a placement that fails is rejected outright, so every state on screen is physically consistent and free of clipping. On top of that sit several game variants — timed challenge, free placement, AI opponent — with volume utilization, payload, and axle-load distribution rendered as live gauges; overweight and unbalanced loads trigger an alert on the spot instead of surfacing only at settlement. The built-in AI opponent scores against the same loading engine, and to keep it from stalling in long or edge-case games it ships with triple anti-stall guards: a forced move on timeout, a reshuffle when no valid move exists, and a rollback on anomalies. It ships dual-track: the source runs double-click over file:// as is, and the Electron build is just a packaged release of the same code, with no forked logic.
On the standard 40ft high-cube test container, the AABB packing algorithm averages 87.3% volume utilization across benchmark rounds. Across 500 internal randomized test rounds, full-scene AABB intersection checks catch every case with zero missed clips. The triple anti-stall guards were stress-tested over 1,000 long-game rounds with zero stalls. Axle-load verification runs in the same render frame the box is placed in, so overweight and imbalance alerts fire with zero frames of delay.
A good-looking utilization number is easy; staying physically consistent every single round is the hard part — the AABB checks and axle-load gauges aren't decoration on the results screen, they're a hard gate every placement has to clear first. The triple anti-stall guards extend the same principle: better to let the AI opponent concede and bail out of an edge case than let it stall and wreck the whole round.
Highlights
- AABB collision and stacking physics
- Multiple game modes and variants
- Built-in AI opponent with triple anti-stall guards

