A real test server
MushRog now has a test server on the internet. The “Play online” button in the menu connects straight to it, and nobody has to host on their own computer.
Why
Until now, playing together meant someone opened the game as host and shared their IP. That worked for testing between two computers, but not for inviting people. Before renting the machine we measured how much each player costs in network traffic, and the numbers didn’t add up.
How it works
Inside a room, the server sent the entire state of the fight 20 times per second: 7 to 16 KB per send, around 250 KB/s per player. With 50 people in rooms, that would be 100 Mbit/s.
We separated what almost never changes (names, appearance, attributes, the room map) from what changes every instant (positions, health, cooldowns, attacks). The first part only travels when it changes. The second goes in a lean binary format, about 25 bytes per monster. We measured with four players using skills non-stop: from 250 to 15 KB/s per player in the Raid, from 200 to 11 in the dungeon, and it still goes through compression. That’s 17 to 27 times smaller.
The server runs on a VPS in dedicated mode, with no graphics, as a service that restarts itself if it crashes. The machine accepts only key-based SSH and the game port, blocks anyone who gets the password wrong several times, updates itself overnight and backs up the accounts every day. We don’t have a domain yet, so the client points to the IP. Since it’s a test server, it can be wiped to start over from scratch.
Next step
Invite the first friends to play at the same time and see what breaks.
Changes
- perf(net): room state split into fixed info and a binary tick
Rooms used to send the whole sim as a Dictionary 20 times a second (7 to 16 KB each). Now the fixed part (names, looks, stats, room meta, who exists and in what order) goes reliable only when it changes, and every tick sends a binary block in that order: positions in 1/32 px, timers in centiseconds, auras and phases as indexes. A tick that does not match the fixed version waits for the new one. Frozen time now reaches the client too. ENet range coder compression on both ends. Measured with 4 players spamming skills: explore 250 -> 15 KB/s per player, dungeon 203 -> 11, farm 314 -> 12, before compression. The explore pause is a fixed end time in meta so it does not resend the fixed part every tick. Protocol 13.
- feat(deploy): staging VPS with a dedicated Linux server
Linux Server export preset (dedicated server, main scene overridden to server/server.tscn). deploy/staging has the provisioning script (admin user with key-only SSH, service user without shell, ufw with SSH rate limit and the game port, fail2ban, unattended security upgrades with a 04:30 reboot, sysctl hardening, journald cap), the SSH lockdown, a sandboxed systemd unit and a daily backup timer. tools/deploy_staging.sh builds, uploads over one multiplexed SSH connection, swaps the current release link, restarts and keeps the last five releases. The client menu gets Jogar online pointing at the staging IP until there is a domain. Version 0.2.1.