Comment by golergka
5 years ago
The Wild Eight, you can get it on Steam. It's only a 8-person multiplayer game though. I was brought in after the original team decided to sell the project to the publisher, and turns out that their idea of peer-to-peer multiplayer (which is the central feature of the game) was to just send all the events generated by each player to all others, without local game logic built on single-player Unity primitives and local time — without any lock-step or anything like it. Unsurprisingly, it got into a complete desync state after a couple of hours, with different players seeing a completely different picture of the world on their screens. And the game, without any mechanism in place to detect it, happily carried on.
There were a few theoretical solutions for it. One would be to have authoritative client-server architecture. But all the game logic was very tightly coupled with Unity primitives in the most naive way, so to simulate a part of the game world, you had to have this part of the game world loaded on your computer, with textures, sounds and everything. After spending a little time on that idea, I concluded that we would need to rewrite all game logic to decouple it, and it was simply unfeasible. There were a lot of custom quests.
Another was to use dedicated servers. But we only sold the game, didn't take any subscription or micro-transactions, so even if servers were cheap (they were not), it wasn't a viable strategy long-term.
And finally - the true peer-to-peer. Since the game world was already split into shards for loading and unloading, I decided that every shard was to have a different "master" player who would play a role of authoritative server — this way he had to load roughly the area that he saw on the screen anyway. We implemented the API which repeated the Unity Multiplayer API, but instead of sending calls and returning RPCs to and from one central server, we routed it to the local "master" player. Of course, this architecture was very susceptible to cheating, but since our game was a coop for friends, and not something even remotely competitive, we decided it was okay.
And even with this much smaller scope, the amount of pain, stress and screwed deadlines we endured was just too much. These kinds of systems are very hard to get right, and even harder to debug — you end up running between different PCs comparing hashes, writing gigabytes of logs and doubting if you even chose the right career after you rewrote your packet-packing code the 6th time. Still, a lot of fun and new lessons learned.
No comments yet
Contribute on Hacker News ↗