1

Topic: Teeworlds Web: serverless unofficial version WebAssembly + WebRTC

https://teeworlds.leaningtech.com/

Dear Teeworlds Community,

we are very happy to share with you a modified version of Teeworlds which can run directly in a browser. We plan to release a detailed technical blog post on how we did this, in the mean time these are the main points:

-) The C++ code for both the server and the client of Teeworlds is compiled to WebAssembly
-) Networking is implemented using WebRTC, a peer-2-peer communication protocol in the browser
-) Anybody can create a "server", it's just another browser tab. You can play in a different tab while the server runs in the background.

This is compiled using Cheerp: a C++ compiler for the Web made by Leaning Technologies (the company I work for). This build of Teeworlds is intended as a demo of our product and we have no intention of monetizing it in any way.

We welcome feedback from the community, thank you.

2 (edited by Slayer *gV* 2019-06-26 18:36:27)

Re: Teeworlds Web: serverless unofficial version WebAssembly + WebRTC

Hey alessandro,

thanks for sharing your company's project, it looks very interesting! Looking forward to read your upcoming detailed technical blog post!

Some things I noticed while trying it out
(running via Firefox 67.0.4 (64-bit) on Linux Mint 19.1 Cinnamon Edition, powered by NVIDIA GTX 1050 Ti and Intel I5 2500k):

  • The font is a bit blurry.

  • The background mountain has a glitch. It shouldn't be stretched this way. See screenshot below, where my brown shotgun-cursor is pointing at.

  • The FPS seem to be pretty low. (But that was eventually not a project's goal.)

https://i.imgur.com/QS3pYN5.png

3

Re: Teeworlds Web: serverless unofficial version WebAssembly + WebRTC

Thank you for your feedback,

We will investigate the background glitch and the blurry font (do you happen do have an HiDPI display?)

About graphical performance, unfortunately Teeworlds uses some legacy OpenGL 1 techniques which are not natively supported by WebGL (which is equivalent to OpenGLES) and are inefficient to emulate.

The main problems are:

*) Using glVertexPointer/glTexCoordPointer/glColorPointer with memory buffers instead of GL-side buffers populated using glBindBuffer+glBufferData
*) The use of GL_QUADS
*) The use of 3D textures to implement tile rendering

Fixing these problem would require modifying the core of Teeworlds, and we preferred to avoid doing that.

4 (edited by 2019-06-27 12:42:26)

Re: Teeworlds Web: serverless unofficial version WebAssembly + WebRTC

That's an interesting project, I'll make sure to check it out. Good luck with your enterprise project!
Teeworlds is a bit of a dinosaur with its graphical engine. Still it's really cool that you can host a server just in a browser tab.

Not Luck, Just Magic.

5

Re: Teeworlds Web: serverless unofficial version WebAssembly + WebRTC

alessandro_leaningtech wrote:

We will investigate the background glitch and the blurry font (do you happen do have an HiDPI display?)

FullHD IPS 60 Hz in landscape orientation.

6

Re: Teeworlds Web: serverless unofficial version WebAssembly + WebRTC

My experience with it was pretty smooth, no FPS lag. The text looks a bit weird and the mountain quads are stretched, but that's about it. Cool :)

PS: the back button is all over the place in the settings menu for some reason :D

Not Luck, Just Magic.

7

Re: Teeworlds Web: serverless unofficial version WebAssembly + WebRTC

Cool project

Looking forward to the blog post. Do you automatically replace the usage of UDP with WebRTC or is there some manual fiddling involved?

8

Re: Teeworlds Web: serverless unofficial version WebAssembly + WebRTC

After starting up the WebRTC connection, which is somewhat complicated, all communication is exactly the same at the binary level as the UDP version. WebRTC is also configured to be UDP-like (unordered and non-reliable). Plenty of details will be in the blog post

9

Re: Teeworlds Web: serverless unofficial version WebAssembly + WebRTC

Reminds me of Teewebs.net but for Vanilla.

https://www.teeworlds.com/forum/viewtopic.php?id=11347

https://forum.ddnet.tw/viewtopic.php?t=1351

10

Re: Teeworlds Web: serverless unofficial version WebAssembly + WebRTC

We have released a blog post with all the info about the network architecture for Teeworlds Web. https://medium.com/leaningtech/porting- … fbbc62c5ca

11

Re: Teeworlds Web: serverless unofficial version WebAssembly + WebRTC

alessandro_leaningtech wrote:

We have released a blog post with all the info about the network architecture for Teeworlds Web. https://medium.com/leaningtech/porting- … fbbc62c5ca

That's an excellent writeup! Learned a bunch :)

Not Luck, Just Magic.

12

Re: Teeworlds Web: serverless unofficial version WebAssembly + WebRTC

Interesting tongue