Register
handmade.network»Forums»How should a game like Among Us do networking?
41 posts
How should a game like Among Us do networking?
3 months, 3 weeks ago Edited by BernFeth on Dec. 23, 2020, 9:30 a.m. Reason: Initial post
Hey everyone,
I have been playing around with sockets lately and it has been quite a bit of fun.
Been following Beej's guide and Glenn Fiedler website which has been honesty a blast, so much neat ideas to try out!

So I will do just that, but in the meantime I thought I would go ahead and ask something here that has been on my mind in the past days as I've been learning a bit about this whole socket programming stuff.

I'm sure some of you are familiar with the game Among Us which has rose in popularity recently. For those who don't know, it is a game that you play with _some_ of your friends. I believe the max player count is 10 _per_game_ but don't quote me on that. I haven't played the game myself, just saw it on Twitch. The thing is though that many games can run at the same time, each one with around 10 players.

Now I'm wondering how would be a good way to program a game such as this. Would a centralized server still be the way to go? How would matchmaking ideally work? Anyhow, I guess I'm wondering if you guys know of more resources to learn from. I'm not looking for code necessarily, but some ideas/explanations. Thanks a lot and I wish you all the best!
Mārtiņš Možeiko
2205 posts / 1 project
How should a game like Among Us do networking?
3 months, 3 weeks ago
Yes centralized server is fine way to do this. In case you need to scale up you can just distribute load between multiple servers that do the same thing.

In general this kind of matchmaking is done with high level commands. Client sends "my name is X, and I want to join" game to server and waits for response. Server puts all incoming commands into queue, and just runs some code to create lobby/match with needed properties & amount of players. Once it is decided, server sends back command to each client - "you can join game with id X". Then clients continue with your game protocol to join game X and send further commands/actions.