POC networking in web builds

For the past few months have kept myself busy working with the Urho’s web port. One thing that bothered me alot was the lack of networking in the web builds. With that being said today I’m proud to present to you my proof-of-concept for the networking in the web builds.

I’ve tried to implement https://github.com/HumbleNet/humblenet/ library in the way that it was supposed to be implemented. Sadly it didn’t quite work that well and the networking was usable on half of the computers that we tested (thanks to other members in the community!). So I had to get rid of WebRTC support and do a plain server-client implementation using websockets.

HumbleNet already has built in support for websockets, but not in the way that is needed for true server-client mode. So I did quite few hacks here and there, bunch of workarounds, bad code practices etc.

So with that all being said here’s the actual demo of if:
https://playground-sample.frameskippers.com/

Everything that you see in the game is controlled by the server, you will see the replicated state of it.

Just open the link, press “New Game” and click on the “Flatland” image to start the sample. Sample is based on this project: https://github.com/ArnisLielturks/Urho3D-Project-Template

If you notice any problems or crashes (or typos), please provide the stack trace from the dev console so I could keep improving it and hopefully make a PR to make it a part of the engine.

The codebase with the HumbleNet implementation will be shared a bit later, have to make it MIT friendly first since the new networking library depends on a lot of other stuff.

10 Likes

Also if the server crashes for some weird reason it should restart in few seconds so you could keep checking it out!

In the example, the camera is not mounted on the ball.

Got it. There’s only 1 attempt to mount the camera, might need to improve it since it could happen when the initial scene state loads a bit slower from the server.

Wow, very cool! Good job :+1:

Edit: If you need more people for testing or such, count me in.

I’m not sure if the graphic options have been enable yet.
e.g. SSAO option shown a black screen.

Works pretty well.

Everything is snappy and fluid. No hiccups.
Tried it on my mac both Chrome and Safari. Only strange thing I saw is on Safari, you cannot look around 360°; when mouse pointer hits the left/right screen border, look around stops, limiting the view.
Really good job. Networking on web always been a sore point in Urho.

I haven’t got to that yet, but some options are not really ment for the web and other platforms. Will disable them in the future to avoid confusion.

That’s a know bug in my latest emscripten shell implementation, plan to fix that in the upcomming weeks.

Nice work. The only things I noticed were the following: -
System: i7920, GTX 750ti, 6Gb RAM, Ubuntu 20.04, Firefox

  1. F2 did not activate a console
  2. SSAO mode in graphics options opens a grey screen
  3. The mouse does not fully rotate the camera about the ball
  4. When the mouse is captured there is no cursor on screen even when a UI is displayed
  5. When moving back to the menu from a game after switching to fullscreen, I needed to press escape which escaped fullscreen too there after the GUI even when reentering fullscreen was partially off screen.
  6. While I ‘think’ there was some shadowing in objects there was none on the ground making it difficult to assess whether any options were working.

Hope this helps, good luck.

Thanks for the feedback!

  1. Have a typo there, console opens with F1
  2. SSAO doesn’t work in web and probably never will
  3. Mouse pointer issues might be fixed in the latest release, just did a patch and submitted a PR with fixes

Regarding the lighthing I just remembered that all the scenes use ambient light. You can tweak the values in console by typing
ambient_light 0 0 0

The showing of the mouse pointer does appear to be correct now however it still does not capture the mouse in windowed mode and when the menu is called fullscreen is still exited thereafter even upon returning to fullscreen the mouse will not fully rotate the ball.

Regards.