Networking: how to set MAX_PEERS without issues?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By vspin

My game will have a predetermined set of 48 players that will play in a game, including the host. From one of the networking examples, I’m doing something like this:

# Default game port
const DEFAULT_PORT = 10567

# Max number of peers
const MAX_PEERS = 47


var host =
host.create_server(DEFAULT_PORT, MAX_PEERS)

However, if someone were to make 47 connections to the game host, all the connections would be used up, and none of the predetermined players could join the game. Or, if all the players were connected but one player errored but didn’t timeout, they couldn’t reconnect until they timed out.

Once a player connects they authenticate. I could increase the MAX_PEERS to say 96, then timestamp connections, and expire/disconnect them if they don’t authenticate in time.

Any ideas on what I should do?

Ugh! It gets worse:

Ability to disconnect client via multiplayer API · Issue #16452 · godotengine/godot · GitHub

There isn’t even a way to disconnect peers on the host. Anyone could connect to my game, use up all my connections, and there’s nothing I could do about it. Which means all Godot Enet multiplayer games are vulnerable (if I’m correct)…

vspin | 2018-08-24 08:58

Have you guys heard about authentication tokens? There are used for every big multiplayer game. Jusy generate them from the auth server and send them to client and server