Peer 2 peer for multiplayer game

Godot Version

4.4

Question

I have recently started with godot and want to make some 2 player card game. So first of all i wanted to try some simple networking where I just count up a shared counter by pressing a button, since I tought if this works I can also make a shared game state work.

My problem now is that I’m not sure how I can get this to run properly. I did the basic implementation with localhost address, which works just fine. I used the ENet functions for that.
When I try to use my public ip for the client address, it stops working. My guess is that its because I would need to forward the port in the router settings or smth. I also tried upnp, just gave me an error in the get_gateway().

Now my question is, are there any ways for a connection like this to work, without needing to change router settings?

Unlikely. When you want to play outside your network you need something to connect to.

If you are part of steamworks you can use their connection system

I have not worked with steamworks yet. Would there be any cost to this other that the 100$ for publishing on steam (i guess i have to do this)?
Is it possible to use their matchmaking and lobby server with just the steamworks account?
And have you ever worked with this in godot?

you only have to pay for the 100€ fee. Yes you can use their lobby system with the steamworks account. i have played around with it a bit. This will obviously only work with steam accounts

Ok thank you. I guess I might use steam for this then.

I case you got any hints or helpful stuff for turn based multiplayer games made in godot, I would appreciate any :smiley:

well i coded some turnbased stuff myself, but i dont have any specific hints right now, since its pretty straightforward. If you stumble upon some problems feel free to ask for help

1 Like

You’re probably looking for NAT traversal/hole punching. I’m sure there are libraries you can use for these features but they might not be specific to Godot. I think it’s also totally fine to port forward for testing and only implement NAT traversal when you finish the game.

Yea, but those didnt work for some reason with the router I use and without changing its settings. I dont have access to the router, so it seems like steam is the only good option there.

UPNP is not very good. If UPNP is the only thing you tried I wouldn’t give up. I don’t remember the technical name but there are (much better) ways to do NAT traversal than UPNP.

1 Like

Using steam now, wanted to publish a game anyways at some point and theres “only” the one time $100 for it. (Later realized that you have a testing appid aswell)

1 Like