Phase 5 — Multiplayer & Queues
Version: v0.5.0 Status: 🔲 Planned
Goal
Bring multiple players into the same dungeon. The queue system matches teams, manages dungeon instances, and enforces the two run types — PvE-only co-op and PvPvE with rival teams. Sound effects and the Onion OS launcher package ship here too, making the game feel complete and distributable.
Deliverable
A fully playable multiplayer build launchable from the Miyoo's Onion OS game list: queue into a PvE or PvPvE session, run a dungeon with matched teammates and rivals, hear sound effects, extract successfully, and see corpse-looting work correctly in PvPvE.
Planned
Multiplayer Rules
PvE-only
- Max 4 players, one team, no friendly fire
- On death: half of equipped loot randomly destroyed, the rest remains on the corpse for teammates to retrieve and return
- All portal modes available
PvPvE
- Up to 8 players across multiple teams
- Max 4 players per team — flexible compositions (e.g. 4v4, 3v3v2, 2v2v2v2)
- On death: all equipped loot stays on corpse, looted by anyone
- Required for Empowered portal mode
Queue & Matchmaking (Server)
The server maintains a lobby queue per run type and portal mode combination. When enough players are ready, the server:
- Creates a new dungeon instance (fresh procedural generation)
- Assigns players to teams (tries to balance team sizes)
- Sends each player their
Connectedmessage with the map and spawn assignment - Opens the instance for play
Solo players can queue into either mode with a warning that they will be outnumbered in PvPvE. No forced wait timer — if the queue has at least 1 player and a threshold time passes, the run starts.
Instance management:
- Each dungeon instance is an isolated task on the server (
tokio::spawn) - State is not shared between instances
- Instance cleans itself up when all players have extracted, died, or disconnected
- Max concurrent instances is capped to stay within Pi/VPS memory budget
Server: Interest Management
With up to 8 players, sending every entity state to every player every tick wastes bandwidth. Each player only receives WorldSnapshot data for entities within a configurable radius (~15 tiles). Entities outside that radius are omitted from the snapshot.
This also prevents cheating via packet inspection — players can't see enemies or rivals they shouldn't know about yet.
Client: Other Players
Remote players render the same way as the local player — 32×32 sprite sheet, class-appropriate animation. Team affiliation shown via a small coloured indicator above the name tag:
- Same team: green
- Rival team: red
- PvE session: no indicator (everyone is friendly)
No player names displayed in-run by default — keeps the screen clean on the Miyoo's small display.
Client: Corpse Looting (PvPvE)
When a player dies in PvPvE, their corpse remains in the dungeon as an interactable entity. Walking over it and pressing R1 (SDLK_t) opens a loot grid showing their dropped equipped items. Items are claimed on a first-come basis — server validates each pickup.
In PvE, the corpse only shows to teammates and only holds the surviving half of the loot (the rest was destroyed server-side on death).
Sound Effects
WAV files only — SDL_Mixer OGG is broken on the Miyoo platform. All audio converted to WAV before inclusion.
Target sounds for this phase:
- Melee swing and hit
- Spell cast and projectile impact
- Player hurt and death
- Item pickup and equip
- Portal activation and extraction success
- UI navigation clicks
Audio is client-side only — no sync needed over the network. Volume levels must be tuned for the Miyoo's small speaker.
Onion OS Packaging
The game ships as a proper Onion OS port package, launchable from the Miyoo's game list.
App structure on SD card:
Roms/PORTS/Games/RPG98/
├── rpg98 # ELF ARM binary (statically linked musl)
├── rpg98.port # Launcher config
└── assets/ # Sprites, tilesets, WAV audio
Saves/CurrentProfile/saves/RPG98/
└── config.toml # Server address, session token, keybinds, class cache
rpg98.port fields:
GameName=RPG98
GameExecutable=rpg98
GamePath=/mnt/SDCARD/Roms/PORTS/Games/RPG98
Config path on device: /mnt/SDCARD/Saves/CurrentProfile/saves/RPG98/config.toml
Box art (optional): Roms/PORTS/Imgs/RPG98.png
Build & package script:
# Final Miyoo build
cargo build -p client --release --target armv7-unknown-linux-musleabihf
# Copy binary + assets to package dir, then scp the whole folder (replace 192.0.0.1 with your Miyoo's local IP)
scp -r RPG98/ root@192.0.0.1:/mnt/SDCARD/Roms/PORTS/Games/
Release builds (--release) are significantly smaller and faster than debug — use release for all hardware testing from this phase forward.
Deploy & Test Loop
# Server (production build for Pi/VPS)
cargo build -p server --release
./target/release/server
# Miyoo release build (replace 192.0.0.1 with your Miyoo's local IP)
cargo build -p client --release --target armv7-unknown-linux-musleabihf
scp target/armv7-unknown-linux-musleabihf/release/client root@192.0.0.1:/mnt/SDCARD/Roms/PORTS/Games/RPG98/rpg98
Key multiplayer tests:
- 2-player PvE: one player dies, confirm correct loot destruction/retrieval
- 4v4 PvPvE: full corpse looting works, rival indicators display correctly
- Mixed team sizes (3v3v2): matchmaking assigns teams correctly
- Empowered mode only opens in PvPvE queue
- Sound plays on Miyoo speaker without crackling
- Game launches cleanly from Onion OS launcher (not just SSH)
- Config persists across sessions (server address, class choice)
Completion Checklist (Planned)
- Server queue system per run type + portal mode combination
- Dungeon instance management (isolated tokio tasks, auto-cleanup)
- Team assignment with flexible sizes (max 4 per team, max 8 total)
- Solo queue warning in PvPvE
- Interest management — server only sends nearby entity data
- Remote player rendering (class sprite, team colour indicator)
- PvE corpse: half loot destroyed, half retrievable by teammates only
- PvPvE corpse: full loot, loottable by anyone, server-validated pickup
- WAV sound effects (swing, cast, hit, death, pickup, portal, UI)
- Audio tuned for Miyoo speaker volume
- Onion OS
.portpackage with correct directory structure -
config.tomlpersists server address, session token, keybinds, class cache - Release build (
--release) tested on hardware for performance - Game launches from Onion OS launcher without SSH
Actual
— Not yet started. To be filled in when Phase 5 is complete. —
What Was Built
Deviations & Discoveries
What Was Deferred
Completion Checklist (Actual)
- Server queue system per run type + portal mode combination
- Dungeon instance management (isolated tokio tasks, auto-cleanup)
- Team assignment with flexible sizes (max 4 per team, max 8 total)
- Solo queue warning in PvPvE
- Interest management — server only sends nearby entity data
- Remote player rendering (class sprite, team colour indicator)
- PvE corpse: half loot destroyed, half retrievable by teammates only
- PvPvE corpse: full loot, loottable by anyone, server-validated pickup
- WAV sound effects (swing, cast, hit, death, pickup, portal, UI)
- Audio tuned for Miyoo speaker volume
- Onion OS
.portpackage with correct directory structure -
config.tomlpersists server address, session token, keybinds, class cache - Release build (
--release) tested on hardware for performance - Game launches from Onion OS launcher without SSH
Previous: Phase 4 — Loot, Extraction & Hub Next: Phase 6 — Polish & Release