Antriel

Multiplayer Platformer devlog

Recommended Posts

I started developing multiplayer online platformer to get back to things that got me to programming in the first place.

I have no idea how it will work out (if at all), but I decided to blog about my progress in a devlog/tutorial fashion.

The first entry is about my proof of concept prototype and why it wouldn't work :)

https://antriel.com/post/online-platformer-1/

Share this post


Link to post
Share on other sites

Things are starting to get exciting – moving physics to the server, implementing client-side prediction and server reconciliation.

https://antriel.com/post/online-platformer-3/

The end result, with applied 200 ms lag and 15% packet loss:
prediction-with-latency.gif.092f7cef89499a548455b911d4661f9d.gif

See the post to see a video of how bad it was before the client-side prediction :)

Share this post


Link to post
Share on other sites

I am a fan of this series :)

I am not sure if I followed it properly, but it seems to me that demo with only one player shows nothing. If you set 1000ms delay and 50% packet loss, does it still look great in such demo?

I would love to see this in action with two players. And how the second player sees the movements of the first player. So simply two windows next to each other.

Share this post


Link to post
Share on other sites

Thanks! It's always super nice to hear that :)

1 hour ago, Jorasso said:

I am not sure if I followed it properly, but it seems to me that demo with only one player shows nothing. If you set 1000ms delay and 50% packet loss, does it still look great in such demo?

Yeah, it would. The reason is that the prediction done on the client is essentially perfect. Which means the prediction will never stray away from what server simulates. The only limitation is length of the `oldInputs` buffer, which I have set up to 2 seconds for now. After which I suppose the server should simply disconnect the user, or maybe allow him to catch up – will see, have to test these things in reality.

2 hours ago, Jorasso said:

I would love to see this in action with two players. And how the second player sees the movements of the first player. So simply two windows next to each other.

That is planned for the next devlog :). Essentially, I will use entity interpolation to achieve smooth movement. That means a client renders other players with a delay. If some of the users lag too much, it will still be noticeable though. Then extrapolation can come into play, but that has its own issues too.

Share this post


Link to post
Share on other sites

Decided that my testing environment is worth a log of its own. It grew pretty big, but it's actually quite simple.

If someone wants to know about setting up a virtual machine and simulating latency and packet loss, give this a read.

Multiplayer Platformer Log #4 – Testing Environment

Share this post


Link to post
Share on other sites

This community rocks! :)

14 hours ago, zeebo said:

Yep that's what I'm doing - Note adding a tc rule on ubuntu only effects outbound packets. If you want to more accurately simulate latency you may want to add outbound latency on windows using Clumsy that way you can test 50ms to server, 50ms back rather then ~2ms to server, 100ms back.

I updated my article based on this new information. We learn something every day. Thanks zeebo!

Share this post


Link to post
Share on other sites

Another good looking approach. Although not free.

I just tested Clumsy and it worked well for me. I just set filtering to `outbound`. According to clumsy's manual it can't handle inbound loopback and actually processes loopback packets twice. Maybe that was part of your issue?

Share this post


Link to post
Share on other sites

I don't recall the exact issue. As far as I remember, I had issues with the general latency settings and how they affected Chrome.

I quickly changed to Netbalancer, and have used that ever since. As well as TC for packet drops. Got tired of dropping them manually.

Share this post


Link to post
Share on other sites

Another devlog and it's a big one!

Multiplayer Platformer Log #5 – Entity Interpolation

Explaining entity interpolation.
Implementing client-server synchronization using phase-locked loop.
Talking about server update loops.
And lot of shared code.

Finally some worthwhile gif – moving around on a real server with ~200 ms ping:

entity-interpolation.thumb.gif.954ec03d498dd47d1a9c1fb0b084496c.gif

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.