Prework on the sandbox client

Today I spent some time thinking about how I would be able to dovetail my learnings with the sample client into the sandbox client (written in Godot).

My initial conclusion is that perhaps the best path is to abandon the existing scaffold I had for the sandbox, which was based on the Godot Getaway tutorial, in lieu of the simpler (and working) webrtc multiplayer godot example. There are two key reasons for this – one is that the webrtc multiplayer implementation / class is different to that used in Godot Getaway, so a lot of the logic that I originally wrote will be completely irrelevant (and, indeed, only work on a single computer with multiple controllers). The second is one of lack of attachment – I haven’t touched the sandbox client much for close to six months now, so I’m not really terribly vested in it at present, which presents an opportunity to break new ground.

Therefore, I’ve decided to work with the new project, and scavenge whatever I find useful from the old in order to get a simple proof of concept level working.

The proof of concept I want to get working is this: based on an initial screen, I want the client to be able to specify whether to start a new game or to join one.

If the client starts a new game, it should register that with the signalling server with a randomly generated lobby name (this will change later, but this is good enough for now). It should then be dropped into a very simple level and handed control of a car avatar, which it can drive around.

If a client wants to join an existing game, it should be presented with a list of currently running lobbies from the book-keeper. It should then be able to select one of these by clicking on it. Once it has selected one of these, it should then be able to click confirm, and be dropped into the same level as the host, and handed control of a different car avatar, which it can drive around.

Further requirements are that all cars “within a lobby” should be synchronised with each other, and it should be possible to have multiple lobbies with different instances of car levels with different peers, all synchronised with each other. A lot of the enabling logic here I should be able to scavenge or adapt from the existing sandbox scaffold.

A key problem that I need to solve is how to persist the webrtc multiplayer object between scenes in Godot. I suspect that I might need to make it a global object (if that is possible), but we will see.

Tags: ,

Leave a comment