0

I am currently working on a multiplayer game that is meant to handle 20-50 player connections to a single game instance.

My current client connection model:

  • Client requests connection from server rest endpoint
  • Server creates 2 new sockets bound to random ports (1 tcp and 1 udp)
  • Client gets response and connects

I don't see anything glaringly wrong with this, but I am now questioning whether this is the general way that game server connections are done.

To explain further, I am in the process of learning how to use Kubernetes and Agones to deploy and manage app/game instances by wrapping them in Kubernetes pods. I am mostly working off of information found in the official guides (https://agones.dev/site/docs/getting-started/create-gameserver/) and associated github examples (https://github.com/googleforgames/agones/blob/release-1.15.0/examples).

For Agones, my understanding is that client connections are made via the port specified in "hostPort" in the "GameServer" yaml. I have previously deployed some instances with plain Kubernetes, using the "hostNetwork=true" option, which enables my above network model to work by allowing the game instance to bind directly to host ports and be exposed to the outside network. With Agones though, it seems that using this option is, at the very least, not encouraged (https://github.com/googleforgames/agones/issues/1389).

I'm certainly not an expert on networking, so please forgive my ignorance, but how are the client connections meant to be handled here if I'm only exposing one port? Is all the traffic multiplexed, or can I directly pass off connections somehow to other sockets/ports and have them automatically be exposed to the outside network?

dan b
  • 33
  • 2
  • 5
  • Are the 20-50 players meant to share the instance collaboratively (e.g. be playing together) or are you trying to put the players into their own world but reusing the same server instance for efficiency? – Robert Bailey Jul 07 '21 at 05:21
  • Also, feel free to join the Agones slack (by clicking on the "join us" link on http://agones.dev) to ask this sort of question. – Robert Bailey Jul 07 '21 at 05:26

1 Answers1

0

Is all the traffic multiplexed, or can I directly pass off connections somehow to other sockets/ports and have them automatically be exposed to the outside network?

I would multiplex the traffic. It sounds like right now you are using the incoming port to determine "who is who". But you could also include that information in the packet flow to a shared port instead.

Robert Bailey
  • 17,866
  • 3
  • 50
  • 58