![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | panda |
Hello,
I’m trying to use the networking features of Godot to make a multiplayer game exported on a webpage (with the html export).
For now, I just have a scene where you can choose to be a server or a client and that tries to connect. It works locally but when I export it to html and use it on a webpage, it doesn’t work.
For example, when I try to be a server I have these warnings :
WARNING: Unable to change IPv4 address mapping over IPv6 option
At: drivers/unix/net_socket_posix.cpp:551:set_ipv6_only_enabled() - Unable to change IPv4 address mapping over IPv6 option
WARNING: Unable to change broadcast setting
At: drivers/unix/net_socket_posix.cpp:521:set_broadcasting_enabled() - Unable to change broadcast setting
And no clients can join the session.
What does that mean ? What I have to do ?
Also, I’m not sure at all what IP adress I have to set for the server (in create_client(server_ip, port))… The IP adress of my server, the IP adress of the actual computer that wants to be a server for the game ?
I hope I’m clear, I’m really not sure of what I’m doing…
Have a good day,
Panda
Did you read this?
Exporting for the Web — Godot Engine (3.1) documentation in English
You can only use HTTPClient or WebSocket client. I didn’t try it out but in my understanding you have to provide the server as an own non-html5 app. Be it another (linux/windows) godot app running on the server or in another language like PHP or server-side Javascript.
The reason is that there are technical and security limitations on web pages. So you can’t directly run a server.
One could also implement communication via php + database + http client but this would mean tons of http request which might put high load on the server. (Except there is a very low rate of requests like maybe board games.)
wombatstampede | 2019-10-11 12:43
Oooh, OK, thank you, I’ll try this.
I did read the page but it is quite dense and everything is new for me so I missed that point !
I guess I’ll run a server-game on my server-server and give the client in html… but I have a question here. Godot is always in a windowed version, right ? How can I run it on my server with ssh ?
Thank you again !
EDIT : oh and also my client has to use HTTP or WebSocket… I’ll take a look. I guess I don’t want HTTP because it’s too heavy for something “real time”
panda | 2019-10-11 20:59
Generally, godot should also be able to run from command line / init.d / ssh.
To my knowledge, this is a so-called “server” app. You’d export this for either windows or linux, depending on your server platform. (not to confuse with “headless” which refers to a command line version of godot (“compiler”) itself.)
Here’s a general example that this should work:
Godot dedicated server tutorial | Tom Langwaldt's Blog
But!
That specific example is for ENet multiplayer interface and not for WebSocket/HTTPClient Interface.
Also be aware that a server will occupy a (at least one) port on the server. If you also run a web server on your server then port 80 and 443 will not be available so you’d have to define another port on your own.
wombatstampede | 2019-10-14 08:24