Skip to content

Introduction ​

SHAG is a TypeScript and Babylon.js engine that runs in the browser and in Node. SHAGGER is the same engine in Rust, for native desktop clients. The game built on it, wash-fps-rust, connects to the same lobby and game servers as the browser client and can play against it in one match.

What is ported ​

AreaSHAGSHAGGER
Wire protocol and game statesrc/shared/net, src/engine/network/protocolshagger_shared::net
Collision and the shared simulation's inputssrc/shared/collision, src/shared/bsp, src/shared/server/simulationshagger_shared::{collision, bsp, server}
Demos and highlight reelssrc/shared/demoshagger_shared::demo
Game server connectionsrc/engine/network/clientshagger::network::client
Lobby clientsrc/lobby (client side)shagger::lobby
Packages, maps, shaders, textures, modelssrc/engine/loadershagger::loader
RendererBabylon's scene, src/engine/rendering, lighting, effectsshagger::rendering on wgpu
Audiosrc/engine/AudioManager.ts, src/engine/audioshagger::audio on cpal
Input, console, cvarssrc/engine/{input,console,core,debug}shagger::{input, console, core, debug}
Menus and HUDHTML and CSS, src/engine/uishagger::ui with egui and a 2D batch
Camera, view effects, weapon viewsrc/engine/{camera,viewport,weapon}shagger::{camera, viewport, weapon}
RagdollsHavokrapier3d (shagger::physics::physics_system)

What is not ported ​

These stay in TypeScript, and SHAGGER has no counterpart for them:

  • the game server, the lobby server and the bot server;
  • SHAGGED, the map editor, and the raw .map path;
  • the CLI and headless tools, bot training;
  • the Electron and Capacitor shells, since SHAGGER builds native programs itself.

What is SHAGGER's own ​

A few modules have no SHAG source, because a browser provides what they do. They are marked "not a port" or "no TypeScript counterpart" at the top of the file:

  • the network threads that carry WebSockets, and the TLS setup (network::client::{network_session, tls, http_fetch});
  • the on-disk package store that stands in for the browser's CacheStorage (loader::pk3::package_store);
  • the sound card and the mixer that stand in for Web Audio (audio::{device, mixer, spatial});
  • BC7 texture compression on upload (rendering::texture_compression);
  • crash reports, the console log file and whole-file writes (core::{crash_report, console_log, atomic_file});
  • the cursor fix for macOS (input::native_cursor);
  • the parser fuzzer (crates/shagger/tests/fuzz_parsers.rs).

Where the engine ends and the game begins ​

SHAGGER holds what any game on the engine would use. Washoi's own code, such as its snapshot event catalogue, its simulation and its menus, lives in wash-fps-rust (RUST.md 14.1 and 14.2). The engine reaches the game's parts through traits and closures, for example EventCodec for the events in a snapshot.

A few modules carry Washoi weapon names (weapon::rail, weapon::voltaic, weapon::weapon_slash) because SHAG keeps them in src/engine/weapon too.

Released under the MIT License. Babylon.js ports under Apache-2.0.