← Back to all projects

travelers

Interpreted WASM Battle Royale

4 players fighting

The battlefield. Red: your player. Purple: Enemies. Blue: Storm. Brown: Wood. Gray: Rock

Motivation

As I began learning more and more about interpreters and language design, a single idea kept entering my mind. I remembered first learning to code in elementary school, where we would use a language like python to help some robot or duck navigate through a puzzle. Wouldn't it be awesome if you would instead program this animal to *fight*

Battle royale games are pretty popular nowadays, but I am not very good at them. Why not combine something I am pretty good at (random language design) with a battle royale so I can finally be at the top of a leaderboard.

This is the idea that would eventually become travelers, an interpreted language run through WASM to update DOM events happening in a canvas. This canvas would simulate a cellular automata style arena where different programs written by users would control different players, ultimately leading to a glorious battle.

Gameplay Rules

Implementation

Travelers is built around a core interpreter written in Zig that compiles to WebAssembly, creating a sandboxed execution environment where player scripts can run safely while maintaining high performance. The entire system is designed around a deterministic game loop that ensures consistent behavior across all clients.

FightScript Language Design

FightScript is a custom C-style language designed specifically for robot control in the battle royale environment. The language supports:

Language Features:
• Variables and basic arithmetic
• While loops and conditional statements
• Function declarations and calls
• Built-in game actions: move, peek, attack, trap
• Directional parameters: up, down, left, right
                    
Game Tick Sequence:
1. Storm Calculation - Update safe zone boundaries
2. Robot Execution - Run each player's script
3. Action Resolution - Process moves, attacks, traps in priority order
4. Damage Application - Apply storm damage and trap triggers
5. Render Update - Update DOM with new game state
                    

Dojo Training Environment

The 32x32 training dojo provides a sandboxed environment for testing scripts before entering the battlegrounds. It features:

Training in the dojo

A player training their script in the dojo

Leaderboard and Multiplayer

The leaderboard system tracks script performance across multiple battle royale simulations. Each script is evaluated against a diverse set of opponents, with rankings based on survival time, kills, and resource management efficiency. The simulation runs entirely client-side using the same deterministic engine.