Authoritative grid hostCryptoThrone Server
The authoritative shared-world host for CryptoThrone — an axum WebSocket router paired with the simgrid headless Bevy grid simulation on tokio. Grid-authoritative: collision is tile occupancy, physics is integer math.
Grid-authoritative
Unlike a physics server, collision is tile occupancy and movement is integer grid math, so the runtime stays light. The sim ticks at 20 Hz and fans out 10 Hz snapshots.
- Auth — verifies inbound Supabase JWT on /ws.
- Lifecycle — Agones Ready / Health / Shutdown.
What it gives you
Features
Terminate /ws + auth
Terminates the WebSocket upgrade and verifies the inbound Supabase JWT (dev-accept fallback when the secret is unset).
Drive the sim tick
Runs the simgrid sim tick at 20 Hz on a tokio multi-thread runtime, fanning out authoritative 10 Hz snapshots.
Admit & spawn
Admits players into roster slots and spawns the CloudCity world — wandering NPCs and monsters — for everyone in the shared map.
Agones lifecycle
Runs the Agones SDK lifecycle (Ready / Health / Shutdown); degrades gracefully outside Agones for local dev.
Responsibilities
Overview & layout
cryptothrone-server is the authoritative shared-world host for CryptoThrone. It pairs an axum WebSocket router with the simgrid headless bevy grid simulation, so movement validation, occupancy, and snapshot framing stay server-owned. Unlike nd-server’s rapier2d match sim, CryptoThrone is grid-authoritative — collision is tile occupancy and “physics” is integer grid math, so the runtime stays light.
Responsibilities
Section titled “Responsibilities”- Terminate the
/wsWebSocket upgrade and verify the inbound Supabase JWT (dev-accept fallback when the secret is unset). - Drive the
simgridsim tick (20 Hz) on a tokio multi-thread runtime, fanning out 10 Hz snapshots. - Admit players into roster slots and spawn the CloudCity world — wandering NPCs and monsters — for everyone in the shared map.
- Run the Agones SDK lifecycle (
Ready/Health/Shutdown) so the Fleet can manage the pod; degrades gracefully outside Agones for local dev.
Layout
Section titled “Layout”apps/agones/cryptothrone/server/├── Cargo.toml # package manifest (path-dep to ../../../../packages/rust/simgrid)├── Dockerfile # multi-stage chisel build (cargo-chef + sccache); no webkit stage├── project.json # nx build / run / container targets├── version.toml # ci-publish version sentinel└── src/ ├── main.rs # tokio entry + Agones lifecycle + graceful shutdown ├── agones.rs # Agones SDK heartbeat └── game.rs # CloudCity spawn config (player tile, monks, birds)Build, run & deploy
Sim core, container & deployment
Build — local build via nx:
nx run cryptothrone-server:build-releaseOr directly through cargo:
cargo build --release -p cryptothrone-serverThe release binary lands at dist/target/release/cryptothrone-server per the workspace target dir convention.
Container —
nx run cryptothrone-server:containerDrops a kbve/cryptothrone-server:latest + version tag locally. CI uses the ci configuration with sccache + registry buildcache (ghcr.io/kbve/cryptothrone-server:buildcache). The runtime image uses the same ghcr.io/kbve/chisel-ubuntu-axum chisel base as the other Axum services. Default listen is 0.0.0.0:7979 (override via CT_SERVER_ADDR).
Sim core — the grid sim lives in the shared simgrid crate (packages/rust/simgrid): postcard wire types, Supabase HS256 auth, axum WS transport, and the bevy headless build_app / run_sim_loop. The host registers its CloudCity spawn systems into simgrid’s ordered SimSet stages, so game content stays in the app crate while transport and movement stay generic.
Deployment — an Agones Fleet (apps/kube/agones/cryptothrone/) runs the GameServer pods; the web tier (axum-cryptothrone) allocates one via POST /api/join. Image must land on ghcr.io/kbve/cryptothrone-server before the Fleet can scale up.
Status — Beta. Shared-world sim with wandering NPCs/monsters; browser client + WSS edge for allocated dynamic ports still in progress.
Questions
Frequently asked
What is the CryptoThrone server?
cryptothrone-server is the authoritative shared-world host for CryptoThrone. It pairs an axum WebSocket router with the simgrid headless Bevy grid simulation on a tokio multi-thread runtime, keeping movement validation, occupancy, and snapshot framing server-owned.
How does CryptoThrone differ from a physics-based server?
CryptoThrone is grid-authoritative rather than physics-based. Collision is tile occupancy and movement is integer grid math, so unlike nd-server's rapier2d match sim, the runtime stays light. The sim ticks at 20 Hz and fans out 10 Hz snapshots.
How is the CryptoThrone server deployed?
An Agones Fleet runs the GameServer pods, and the web tier (axum-cryptothrone) allocates one via POST /api/join. The image must land on ghcr.io/kbve/cryptothrone-server before the Fleet can scale up. The server also runs the Agones SDK lifecycle (Ready, Health, Shutdown).
