A hundred in the square
We put a hundred players in town at the same time, each with an account, two characters and a team, wandering around and saying “hi” now and then. They stayed for the full two minutes and nobody dropped. With that, phase 1 is done.
Why
The roadmap had one condition for leaving phase 1: the town had to hold a hundred people. We’d rather find the limit this way than find it with real people complaining in chat.
How it works
Opening a hundred copies of the game on one machine isn’t feasible, so the hundred bots live in a single program, each with its own connection, account and path. To the server, they’re a hundred different people.
The first result was good on processing and bad on network. The server spent about 7 milliseconds per tick, out of a budget of 50, but each player received close to 16 KB per second. Everyone spawns in the same spot, so each one saw about thirty others, and positions went out in a generic format, full of text.
We switched to a binary packet: a short number for each player, position in whole pixels and direction in two bytes. That’s eight bytes per person seen. Bandwidth dropped to 2.6 KB per second per player, six times less, which fits comfortably on a mobile connection.
| Metric (100 players) | Before | After |
|---|---|---|
| Average server tick | ~7 ms | ~7 ms |
| Worst tick | ~40 ms | ~40 ms |
| Sent per player | ~15.8 KB/s | ~2.6 KB/s |
That was on a development machine, with the server and the bots sharing the same processor, so on a real server there should be more headroom. The worst tick of 40 ms shows up in the spikes, and it’s the one we’ll watch as the town grows.
Next step
Phase 2: the rest of the systems, starting with the real inventory and the farm.
Changes
- perf(city): 8-byte binary city snapshots; 100-bot load test passes
CityCodec packs each visible player as u16 id, u16 x, u16 y, s8 dir x/y; static info carries the short id once. Load tool runs many bots in one process with a SceneMultiplayer per bot; server prints tick and bandwidth stats with --stats. 100 of 100 bots stayed in the city for 2 minutes: ~7 ms average tick, bandwidth per player down from ~15.8 to ~2.6 KB/s. Closes fase 1; roadmap moves to fase 2. Protocol 6.