How sdgoij/goats works
Slag Goat is a JavaScript-driven 3D goat sandbox, with both an interactive client and multiplayer hosting/bridging components. The principal play loop is player input into the scene, which updates goats, herd, terrain, weather, and world presentation; the client also renders lighting, water, and audio. Multiplayer adds a headless host that simulates the shared scene and a session/protocol layer for peers. The README and excerpts support these major branches, but many game modules were not sampled, so internal game-to-game calls are not asserted.
Main entry points: game Scene runtime · net.rs Godot networking · main.rs Dedicated server · headless.rs Headless scene host
Components 23
Game scene
- Scene runtime
crates/goats/src/game - Goat state
crates/goats/src/game/goat.js - Bot herd
crates/goats/src/game/bots.js - Terrain and world
crates/goats/src/game/world.js - Weather and sky
crates/goats/src/game/weather.js - Water pools
crates/goats/src/game/water.js - Lighting and shadows
crates/goats/src/game/lighting.js - Explosions
crates/goats/src/game/explosions.js - Scene audio
crates/goats/src/game/audio.js
Runtime hosts
- Raylib client
crates/goats/src/lib.rs - Audio host
crates/goats/src/audio.rs - Headless scene host
crates/server/src/headless.rs - Dedicated server
crates/server/src/main.rs - Godot bridge
crates/godot/src/lib.rs
Multiplayer
- Godot networking
crates/godot/src/net.rs - Session transport
crates/session/src/lib.rs - Host discovery
crates/session/src/swarm.rs - Protocol messages
crates/proto/src/lib.rs - Datagram encoding
crates/proto/src/wire.rs
Mods and voice
- Mod loading
crates/mods/src/lib.rs - Voice codec
crates/voice/src/lib.rs - Godot voice bridge
crates/godot/src/voice.rs
Other components
- Player
Connections 24
- Player → Scene runtime: controls
- Scene runtime → Goat state: updates
- Scene runtime → Bot herd: simulates
- Scene runtime → Terrain and world: uses
- Scene runtime → Weather and sky: drives
- Scene runtime → Water pools: simulates
- Scene runtime → Lighting and shadows: renders with
- Scene runtime → Explosions: triggers
- Scene runtime → Scene audio: plays
- Raylib client → Scene runtime: evaluates
- Raylib client → Audio host: uses
crates/goats/src/lib.rs - Dedicated server → Headless scene host: starts
crates/server/src/main.rs - Headless scene host → Scene runtime: evaluates
crates/server/src/headless.rs - Headless scene host → Mod loading: loads mods
crates/server/src/headless.rs - Dedicated server → Session transport: hosts session
crates/server/src/main.rs - Dedicated server → Host discovery: starts discovery
crates/server/src/main.rs - Godot bridge → Godot networking: registers
crates/godot/src/lib.rs - Godot networking → Session transport: uses transport
crates/godot/src/net.rs - Godot networking → Protocol messages: uses frames
crates/godot/src/net.rs - Session transport → Protocol messages: encodes messages
crates/session/src/lib.rs - Protocol messages → Datagram encoding: uses datagrams
crates/proto/src/lib.rs - Godot networking → Host discovery: joins topics
crates/godot/src/net.rs - Godot voice bridge → Voice codec: uses codec
crates/godot/src/voice.rs - Godot networking → Godot voice bridge: owns voice state
crates/godot/src/voice.rs