0 votes

Hi there! I'm making the online game on HTML5 platform. I need to make client-server architecture connection because my game is competitive game and peer-to-peer isn't suitable (quite easy make cheats).

I already did client-server using by high-level API and it works fine. But when I export my project to HTML5 to test it I was surprised that high-level API doesn't work there. Later I found out that for HTML5 platform I must use WebRTC and WebSockets directly on your own. Ok, it's confused me but ok I went to documentation about these things. And here I absolutely did understand nothing.

I need to use UDP protocol and client-server but for WebRTC as I understood I need to use WebSockets but WebSockets works only with TCP. And as I understood WebRTC in godot implemented only for peer-to-peer.

I thought maybe I can to make one server WebRTC peer and connect other peers to it. But even unclear how to make remote connection using by WebRTC because on the documentation wrote nothing about remote connection.

All in all, it's difficult and below I wrote main questions.

  1. Maybe does exist a way to use High-Level API on HTML5? (If does, the questions below aren't matter)
  2. Does exist any good explanation how to use WebRTC in Godot?
  3. How to implement client-server using by WebRTC? (With using TCP/UDP)

By the way, I know that exist demo project with WebRTC. But there using peer-to-peer connection with WebSocket as signaling server. I don't need it.

Thanks in advance!

Godot version v3.5.1.stable.official [6fed1ffa3]
in Engine by (12 points)

Did you manage to read through the documentation - https://docs.godotengine.org/en/stable/tutorials/networking/webrtc.html? I did not see anywhere that Web Sockets are being used as the Transport when working with WebRTC. In fact:

WebSockets, though, still use a TCP connection, which is good for reliability but not for latency, so not good for real-time applications like VoIP and fast-paced games.

For this reason, since 2010, Google started working on a new technology called WebRTC

WebRTC is a much more complex set of specifications, and relies on many other technologies behind the scenes (ICE, DTLS, SDP) to provide fast, real-time, and secure communication between two peers.

I believe that the high-level API you are looking for is this: WebRTCMultiplayer

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.