Part 4: Supporting Multiple players

In this tutorial you’ll learn how spawn an entity every time a client connects. This tutorial build on the learnings of the pervious tutorial: Part 3

Note: we start with making sure that you have the Networking feature flag enabled, you can do that in the Tools→Feature Flags Menu.



Let’s add support for multiple Clients to join the same world.

Instead of referencing a static Entity in the scene, we now want to spawn a new xbot entity every time a client connects to the server: we can do that simply by converting the Scene Entity node into a Spawn Entity node.


The other problem we need to solve to effectively support multiple players is the fact that earlier the Camera entity was itself available in the scene: know the camera entity is part of the dynamic entity that we’ll spawn once a client connects, and so the Set Camera node has to be executed inside the graph of the xbot entity asset itself, once the Acquired Entity Control event is triggered.


And now our server fully supports multiple players to join: every time a Client connects to it, it will spawn a new xbot entity, set the control and remap the input of it: once the client is notified that it acquired the control of that entity, it will set the camera and remap the input as well.