Architecture
Wiki home · Getting started · Testing
Logic Bots runs battles on the server and renders their recordings in the browser. The PHP application handles accounts, loadouts, checkpoints, match setup, and recording access. SQLite stores saved builds, match results, and background work. The replay client uses TypeScript and Three.js to show the recorded match in 3D.
From an editor draft to a match
Bot Builder validates a design against the component catalog and its chassis mount rules. Compile checks the PHP with the same parser and interpreter rules used by the simulator. Test Run exercises the current editor draft, including edits you have yet to save. A human bot save records its loadout and source as a checkpoint. Opening a published bot for battle uses the version the owner published. The owner can continue working on a newer checkpoint and publish it separately.
The match type determines which snapshots the engine runs and who can view the result.
| Match type | Input and rules | Where the result goes |
|---|---|---|
| Builder Test Run | Current draft, chosen scenario and opponents, fixed 48-unit arena, closer spawns, and a 20-second limit. | Private practice replay with a decision trace for the authored pilot. |
| Practice battles | Chosen saved bots and training presets, with configurable arena size, teams, seats, seed, time, pickups, friendly fire, and pilots. | Saved recording in the initiating player's Hangar. |
| Leaderboard battle | One published bot you own and three other eligible published bots picked by the server. One bot per team, with a randomized seed and team order. | Replay available to the four bots' owners. Placements are recorded separately and contribute 4, 3, 2, and 1 points for first through fourth. |
| Tournament fight | Registration snapshots and an engine seed assigned to the fight. Tournament matches use a bracket and a series ends when one entry has two wins. | Public fight replay. A drawn fight remains a draw in the replay while the bracket records a coin flip to award the series point. |
Leaderboard places come from the engine's exact destruction times, with the survivor placed first. Bots eliminated on the same tick share a place. For instance, a tie for second gives finish places 1, 2, 2, and 4. Standings count only these four-bot leaderboard matches. See Testing for the differences between a short Builder run and a normal arena deployment.
Simulation
The simulator initializes units from the selected build snapshots, assigns predetermined spawn positions for the roster, and faces each bot toward the center. The main engine uses 20 fixed ticks per second. Given the same builds, team and seat order, options, seed, and simulation version, it reproduces the match. The seed drives match randomness. Each pilot also receives an independent deterministic stream derived from the seed and its participant ID.
- The engine advances living units' resource recovery, cooldowns, equipment, status effects, and knockback.
- Each living scripted bot observes the updated tick. The interpreter gives it a fresh script frame, plus access to its match memory and the Pilot API. It collects queued commands before applying them.
- Team coordination resolves, then the engine applies equipment toggles and chassis movement. Living bodies block movement and knockback. The engine then resolves aiming and firing and continues pending turret orders.
- Projectiles and pulses advance, pickups update, and sudden-death attrition applies if scheduled. The recorder captures key state transitions. The engine stops when the outcome or the practice end condition is reached.
In normal arena matches the last team with living hull wins, or both or all remaining teams can be destroyed on the same tick for a draw. Once the normal phase ends, each living bot loses one hull point per attrition interval, regardless of shield or armor. Repair pauses and hull pickups expire. Builder practice ends at its deadline if multiple teams still survive. Runtime failures in the traced Builder pilot stop practice and appear in its decision trace. Ordinary battles can stop on invalid saved PHP. Tournament and leaderboard matches use forfeits for invalid pilots. For code and runtime limits, see PHP syntax and Troubleshooting.
Recording and playback
A recording includes a schema version, simulation version, seed, normalized rules, participant IDs and teams, result summary, timestamped frames, and events. Frames contain positions, chassis headings, alive states, resource bars, and mount angles or status when available. Events record launches, impacts, pickup activity, destruction, and other changes. The simulator records at intervals and at important transitions, including destruction and the end of the match. A recording can include equipment effects separately from the main event list.
The browser fetches the authorized recording and interpolates movement between samples. Playback controls change which part of the recording you see. The browser renders the chassis, mounted equipment, smoke, and camera from recorded state. It can still display the timeline and status if WebGL is unavailable. Updating a bot or changing simulation rules affects later matches. A stored replay continues to show its original result.
Access rules and the recorded participant snapshot control what a replay can display. When a recording includes a loadout, the renderer can attach its equipment models to the configured chassis mounts. For older recordings with hidden blueprints, the client displays covered mounts. Pilot PHP, private match memory, and private team messages are absent from ordinary recordings. Builder practice privately adds a trace of the authored pilot's observations, commands, results, and debug samples. See Equipment and Team strategy.
Background workers
Training presets and saved bots run through the same PHP interpreter in the simulator. Model assistance runs separately. Builder chat workers ask a configured model for help, execute available compile and practice tools, and return proposed changes for the owner to save. Workshop workers run model-player assignments such as creating a bot or filling a tournament quota. The workers share a per-provider request queue so inference and local tools can make progress independently. A model bot stability worker runs a standard practice check before a passing model-owned build becomes available for public battles. The tournament scheduler runs registered fights and records bracket progress. See Examples for pilots that exercise the shared interpreter.