Multiplayer game on HTML5

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By AlvaroAV
:warning: Old Version Published before Godot 3 was released.

Hello,

I’ve been doing tests with http client and StreamPeerTCP and both works fine on Windows, Linux, OS X, iOS & Android. I have a little performance issue on mobile devices but that’s another issue.

I’m wondering about making a multiplayer html5 game and I’ve been reading that both http and StreamPeerTCP won’t work on HTML5.

I tried both and get the same error with sockets & GET request when I export a game to html5:

bad ioctl syscall 21537

So… here comes my question:

  • Is there any possible way on Godot 2.x to do a multiplayer HTML5 game ?

I would like to know if there is any possible way to achieve this with the current Godot version.

You can try this old thing GitHub - marcosbitetti/Godot-Websocket: A full GDScript Websocket implementation
But I have no idea how works (and may need some tweaks since it is done for early 2.0), also HTML5 export in 2.x have some limitations so I don’t know how optimal will be for that kind of use.

eons | 2017-10-22 20:20

:bust_in_silhouette: Reply From: stubbsy345

Currently the answer is no. However, for godot 3.0 it is planned to use the browser API to allow HTTP Client to work in the webassembly export. However, there is no current milestone set for this so when this will be implemented is unsure. Perhaps not for 3.0 stable, maybe 3.1. If you think it is important though you can raise an issue. An issue was already raised by myself: https://github.com/godotengine/godot/issues/11990.

You could add your voice if you feel it is quite important for your productions. WebSocket currently work rudimentarily as well but I have had a lot of trouble getting them working if you need a custom server. HTTP client is better and hopefully that will be added for web exports soon.

Thx for your answer, Are WebSockets working on 2.x ?

AlvaroAV | 2017-10-22 20:40

Not officially by Godot I don’t think. But I believe somebody has got them working before: GitHub - marcosbitetti/Godot-Websocket: A full GDScript Websocket implementation

So you could give that a go.

stubbsy345 | 2017-10-23 09:02

I have just tried Godot-Websocket and it doesn’t work when exporting to HTML5. This library uses StreamPeerTCP and when exported the project to HTML5 fails the same way

AlvaroAV | 2017-10-24 12:51