I want to make a game similar to the fall guys game. Which will require some physics when players collider together.
I just want to ask what is the best way to synchronize the physics in the game? Do I need a Unity headless running on the server?
Sorry for the spam but no one in this forum has experience with this game?
Hi, there are two ways I see this can be done, depending on more details about your use case which would then inform which backend will serve as an authority for the match state:
- If your game requires relatively light-weight physics you could implement the game state with simulation as a Nakama authoritative match. This could be a simple bounded box type with collisions and simple tracing. In this case you wouldn’t need the headless Unity but you would have to make sure the state computation is super-efficient so it can be delivered to the Unity clients at high rate. Unity clients would then essentially only render the 3D scene.
- If your game requires heavy-weight physics like complex collision detection, ray-tracing, etc…you’ll need a headless physics server that will generate the authoritative 3D state (you can use for example GameLift). Nakama in this case would not be implementing the actual match loop but could still handle matchmaking and orchestration and social features - it could look like this: clients do Nakama matchmake normally and in your Nakama plugin code you spawn gameLift Unity instance for each newly created match (and register callback to be able to terminate match). When the new Unity headless server is spawned your server-side code that is handling the match-making receives the IP which it can distribute back to clients that are joining the match. Clients then open a separate connection to the headless Unity instance and participate in the match until it ends.
Hope this is useful