godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.88k stars 21.03k forks source link

MultiplayerSpawner isn't working #65253

Open bkeys opened 2 years ago

bkeys commented 2 years ago

Godot version

4.0 dev

System information

AMD on Fedora

Issue description

Hello, I used a networking tutorial to try to implement networking for my game. And the synchronizer works just fine but I cannot get the multiplayer spawner to do anything at all. Would you be willing to take a look at what I am doing wrong in my game? No one on IRC seems particularly knowledgeable about the MultiplayerSpawner since I get crickets when I ask about how it works. If you could also type up an explanation of how it works programatically that would be enlightening; but I am grateful for any help you can spare. Here is the link to my project: https://code.bkeys.org/Game_Projects/zombie-shooter The tutorial and example project seem to work just fine and I have modeled the networking exactly as it does in the example and tutorial. It seems the Spawner doesn't work outside of 2D worlds.

Steps to reproduce

Clone my repo, run a server using --headless --server and a client, it should auto connect. The player never spawns and I have code that prints out the tree to show this.

Minimal reproduction project

https://code.bkeys.org/Game_Projects/zombie-shooter

jgillich commented 2 years ago

You forgot to set spawn_path on MultiplayerSpawner, once I set it to the players node, it works.

Also, calling spawn does nothing because you don't implement _spawn_custom, see https://docs.godotengine.org/en/latest/classes/class_multiplayerspawner.html#class-multiplayerspawner-method-spawn

bkeys commented 2 years ago

@jgillich Okay that is helpful, and you are right that fixed my issue. I pushed an update to my repo that shows the multiplayer_authority of my player and both the server and client agree about who the authority is, but the value doesn't get synced? Can I please get an explanation for that? I know this is an issue tracker and not a questions place, but it seems the community at large isn't too knowledgeable yet on the new multiplayer API and I really want to learn it