Pre-Calculated Battles + Time Controls


What Changed

Battles used to run live - the game would simulate and draw at the same time, frame by frame. Now we simulate the entire fight upfront (behind a loading screen), record everything, then play it back like a video.

Why Bother?

Multiplayer: When matches eventually run on a server, we don't want clients simulating in real-time. Instead, the server will run the battle, send the results back, then each player's client can replay the same data.

Speed controls: You can now pause, speed up (0.5x to 3x), and scrub through battles. What's more, you can replay each battle to review your drone's performance.

Deterministic outcomes: The same match with the same random seed produces the same battle. This opens the door for replay sharing and saving past battles. 

Balance: I can also watch back data from simulated battles while balancing the meta. When I'm adding new features, weapons, effects, utilities, etc., it will be easy to generate and replay many matches to ensure they're working as expected. 

The Recording System

Every frame captures drone positions, health, shield states, active buffs/debuffs, and bullet trajectories. Static data like drone names and max health are stored once per recording rather than repeated on every frame, keeping the data lean for eventual network transfer.

Boolean states (alive, cloaked, shield-disrupted, EMP-disabled, etc.) are packed efficiently for serialisation. The format is versioned so we can evolve it without breaking old recordings.

Bullet trajectories are now predictive. Hit/miss is determined by the percentage chance of combat rolls. But now that we know the drone's paths, we can calculate where it will intercept the target and render the projectile on a straight-line trajectory. 

UI Adjustments

The battle HUD now renders directly from snapshot data during playback - since we're already capturing all that state for the recording, we just pipe it straight to the UI. No need to query live entities. Fixed a timing bug where the hover detail panel lagged behind the main cards.

Added a loading screen with thematic messages while pre-calculation runs. Progress bar fills as frames are simulated.

What's Coming

The serialisation format is designed and ready, just needs the network layer wired up. When that happens, matches can run on the server and stream results to spectators in real time.

Files

nodewars-html5.zip Play in browser
Version 0.0.9 9 hours ago
nodewars-windows.zip 114 MB
Version 0.0.9 9 hours ago
nodewars-linux.tar.gz 112 MB
Version 0.0.9 9 hours ago
nodewars-macos.zip 113 MB
Version 0.0.9 9 hours ago

Get Node Wars

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.