I’m working on an online multiplayer game. For now, it’s peer to peer, but I’ll likely make a dedicated server in the future. This is my first online game so my networking knowledge is beginner to low-end intermediate at best.
As of now, the player and level nodes are synchronized with MultiplayerSynchronizer nodes, and the game is playable on multiple devices
However, I haven’t quite figured out how to synchronize spawning a random powerup. My level scene uses an _on_timer_timeout function to randomly select between a few powerups and spawn one of them. The MultiplayerSynchronizer node doesn’t seem to allow you to select _on_timer_timeout for synchronization since it’s a signal and not a property
Since both the host and the peer are running the level scene at the same time
they end up spawning their own random powerup which of course isn’t always the same on host and peer.
I tried resolving by putting the following at the top of the _on_timer_timeout func but of course then the peer doesn’t have a powerup spawn at all for them:
if not multiplayer.is_server():
return
There must be a way to achieve this that I’m overlooking, whether that’s by using a workaround with the func, something with a MultiplayerSynchronizer node, or by adding random powerups another way.
Please let me know if you have a solution for this. Thanks!