Real-Time Multiplayer Games over UDP

Ahh, okay. I guess I probably should have figured that but we can all dream I suppose. Thanks!

Hey,

I’ve just published it!
If you like, please test it and give me a feedback :blush:

You’ll find the game example and the library on github :star_struck:

Any thoughts on this?

Has someone tested the library or the example game?

Hey @yannick I tested it yesterday, the example is working smoothly (also tested the chat). I have not used the library directly on any project yet.

I had a problem though, I tried to use a turn server and I got an error, not sure if my turn server is misconfigured or if it is a problem with the library.

Hi @Marceloll

Thanks so much for testing :smiley:

Have you tested the turn server with https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/?

And have you set the iceServers array correctly?

iceServers: [
    {
      urls: "turn:turnserver.example.org",
      username: "webrtc",
      credential: "turnpassword"
    }
  ]

What error did you get?

I have now made a even simpler chat app example which uses the minified bundle on the client. Have a look at GitHub - geckosio/simple-chat-app-example: 💬 A simple chat app example.

@yannick I managed to setup my turnserver and test it properly with trickle ice, but still got an odd error: cannot read property 'id' of undefined

So I posted on a github issue what I was trying to do.

And btw, could you give a brief explanation of how geckosio works?

Did you get this error on the client or server?

I have actually never tested a turnserver. I assumed everyone would be find with stun since turn adds some latency. Guess I was wrong. I have just added support for iceTransportPolicy. See the github issue. It would be nice if it works, else I will probably set up a turn server and make some test.

It simply wraps the WebRTC API on the client and node-wrtc on the server.

1 Like

Omg Yannick, thank you so much for this! I have been trying to use webrtc for ages but I could never find a good example of using node-webrtc, and I didn’t want to go deep into the c++ woods.

My initial tests are very positive, just testing some interaction and movement, and it feels much better than websockets ever did for me, and I’ve tested a lot of different websocket setups. I used to do a thing where I would tween a sprite to the new position sent by the server (which had issues like if the player was moving but then fired a projectile the projectile would appear behind or in front of the sprite), but with this webrtc stuff it seems like i can just set x and y positions directly when the messages come in.

I was initially put off by your example game, because the input has some warping of the player. I realized though that the sprites that bounce up and down don’t seem to lag so it was probably the way you are writing the input code. I’m not sure exactly but maybe you have it set to only move the player when messages come in? I have tested it with stuff like “if player pushes key, set movement flag on, if player releases key, turn movement flag off, if movement flag on, move player” and it seems much smoother with no jitter.

What I’m really curious to see is how well my game will perform with 100+ players connected. With websocket, I could connect about 100 players, all sending position updates, and the game would still be smooth. Once I started going over that, the game would slow down.

Anyway, thanks again, and I’ll let you know if I finish the project I am converting to webrtc and your package.

Glad you like it.

Hope it will work with 100+ player. It would be nice if you could share your test results later.

You’re right the player looks a bit warped. I do not know why. But maybe if you add a player animation, you will not see it anymore :slight_smile:

Hi, This looks very promising. Is it possible to use this as a (Cordova) app on mobile?

I guess this should work. But I have not tested it yet.

@yannick I signed up and made an account just to tell you how freaking cool this is. I’m going to be trying it out for a project. Just wanted to say that your work is appreciated sir!

1 Like

I just made a one to one comparison between geckos.io and socket.io. Hope it helps :smiley:

1 Like