CreggHancock / HolePuncher

UDP Holepunch plugin for Godot
MIT License
142 stars 34 forks source link

added example project, moved addon folder to it, changed readme #5

Closed wapordev closed 2 years ago

wapordev commented 3 years ago

I've added an example project, moved the addons folder to it, and changed the readme to reflect these changes + add setup for example project.

The example project could definitely be better, like support for more than 2 players, timeouts and feedback on server connections, etc. But I don't have the time for that rn. Despite that, this should hopefully serve as a starting point, and save people a few hours messing around like I did lol.

Also 2 more things:

  1. I found that the name you send to the server when hosting or joining has to be unique, which I've solved for now by generating "client" + random integer. I'm assuming the reason for this feature would be so you can see the custom names of clients who join your lobby, but it doesn't give you that info on connection, and since they have to be unique across all instances, two people named george couldn't connect at the same time.
  2. I've added a reference to the server hosting site Linode in the readme, because you can get a server capable of running this very easily for $5, and that's what I used, there's no legal issues or anything, right?
RabidTunes commented 3 years ago

I've tried your branch and I found an issue using Godot 3.3.2. After successfully punching the hole and both players connect, the Game.gd script fails at line get_tree().root.find_node("Lobby").queue_free()

I fixed it by changing that to

var lobby = get_node("/root/Lobby")
lobby.queue_free()

It's a bit weird for me because I think they are equivalent... idk

wapordev commented 3 years ago

I've tried your branch and I found an issue using Godot 3.3.2. After successfully punching the hole and both players connect, the Game.gd script fails at line get_tree().root.find_node("Lobby").queue_free()

I fixed it by changing that to

var lobby = get_node("/root/Lobby")
lobby.queue_free()

It's a bit weird for me because I think they are equivalent... idk

oh that is weird, what was the error?

RabidTunes commented 3 years ago

I tested this some time ago so I don't quite remember, but it complained that it could not find the node, basically calling queue_free() on a null node I think.

wapordev commented 2 years ago

This is old. I'm looking at this project again, and it seems to have stopped working for me, even my old saves. Maybe a new godot version? I'm going through the code to try an figure out why, and changing bits as I go. Might pull request again if I get anywhere.