Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | qazwsx | |
Old Version | Published before Godot 3 was released. |
Is there any good pattern to handle multiple scenes in multiplayer networking game? I have written the networking game client-server. I have working game but everything is in one scene. I want to divide the game into multiple sub-scenes as per below (simplified):
- Menu (start server/ join the game)
- Room (players join the game - connects to server)
- Game (players play through the network)
The transition from Menu to Room will probably work with no issues. But how should be solved the switch from Room to Game? I think the scene switch will remove all the children of Room scene so all connections will be lost. I need to have these connections in Game scene. Any static objects or something like that?
I want to add that I am aware of Singletons. I am asking about good practice or good pattern to handle such case.
Way I do it is just using a state machine and send a small 1 byte packet to the server to sync game states. This way, since Godot has no error handling, the possibilities for crashing is greatly reduced (i use a global gg.GAMESTATE
) object
wombatTurkey | 2016-08-17 16:55