Jump to content

Handling player movment on the server instead of client?


Ralph
 Share

Recommended Posts

30 minutes ago, symof said:

http://www.gabrielgambetta.com/fast_paced_multiplayer.html

That tutorial explains in very clear terms how to build an authoritative server.

Make it right from day 1 don't postpone it and hope that you can fix it "when you release". Do it right the first time so you don't have to go back and alter it again and again.

Splitting authority between the server and client will cause you more problems in the long run than anything else.

 

TagPro launched with a 100% authoritative server and no client simulation (i.e. roundtrip client input lag). After seeing that people even enjoyed the game at all, he refactored it to introduce client-side simulation + interpolation. If he did it right from day 1 instead of developing the naive model, would he have ever finished the game enough to get inspired by people enjoying the naive version? Who knows.

I'm not going to disagree with you. You're pitching the ideal technical route. Shipping code just involves trade-offs and most people never get that far.

I personally didn't excel while putting pressure on myself to nail lag compensation on day 1, which is a tall order even when spelled out for me at a high level. I found a hybrid approach more encouraging and flexible, where server-side sanity checks are more straightforward if less robust.

Maybe implementing lag compensation came more naturally to you than it did for me.

Link to comment
Share on other sites

1 hour ago, danneu said:

 

TagPro launched with a 100% authoritative server and no client simulation (i.e. roundtrip client input lag). After seeing that people even enjoyed the game at all, he refactored it to introduce client-side simulation + interpolation. If he did it right from day 1 instead of developing the naive model, would he have ever finished the game enough to get inspired by people enjoying the naive version? Who knows.

I'm not going to disagree with you. You're pitching the ideal technical route. Shipping code just involves trade-offs and most people never get that far.

I personally didn't excel while putting pressure on myself to nail lag compensation on day 1, which is a tall order even when spelled out for me at a high level. I found a hybrid approach more encouraging and flexible, where server-side sanity checks are more straightforward if less robust.

Maybe implementing lag compensation came more naturally to you than it did for me.

Indeed, Tagpro ran 100% on the server side first. But I've stalked through some of the dev's posts too (:P) and saw that while they do at the moment use client side prediction, it is only done by half the ping! So if you press up, it would take the client prediction half the ping time to actually start the up move.

Pretty neat trick and props for them to prove it is actually working. 

I was mesmerized when they had a particular easter egg shoot 'm up event type of thing, where you could actually shoot eggs to other players. How that isn't lagging their game, I have no clue... I assume they spend lots of money on the servers. Props to the devs. 

Link to comment
Share on other sites

On 3/8/2016 at 11:07 PM, Ralph said:

Another possibility I just had could be to outsource the cpu power lol. I could every say 10 seconds randomly assign one player the duties of monitoring another players movement and making sure that it is legit and they arent going through ......

This is something I've thought about doing, or at least giving a try, and see how it performs.

Let's say you have 3 players,

All 3 players handle their own, as well as the others' collisions,

This is of course done by sending the input (back- and forward, left and right).

Now, player1 is calculating it's own physics, but ultimately, the final result is applied depending on the calculations done by player2 and player3.

Now, this could either be based on both external players' results, or the one seeming to be the most correct. I'm sure it's possible to calculate how fast it's possible to travel based on timestamps and distance, but I might be over my head. At least it's the best option I've come up with without a proper authoritative server setup.

But who knows. I'm new to this, and not yet ready to implement multiplayer into my own creation.

 

Link to comment
Share on other sites

6 hours ago, Raggar said:

This is something I've thought about doing, or at least giving a try, and see how it performs.

Let's say you have 3 players,

All 3 players handle their own, as well as the others' collisions,

This is of course done by sending the input (back- and forward, left and right).

Now, player1 is calculating it's own physics, but ultimately, the final result is applied depending on the calculations done by player2 and player3.

Now, this could either be based on both external players' results, or the one seeming to be the most correct. I'm sure it's possible to calculate how fast it's possible to travel based on timestamps and distance, but I might be over my head. At least it's the best option I've come up with without a proper authoritative server setup.

But who knows. I'm new to this, and not yet ready to implement multiplayer into my own creation.

 

This honestly seems like a really fun weekend project for me. School is starting soon so im running out of hours to pour into my project right now so Im going to stick with what I have until i find something better or this system doesnt work out for me. But ya having clients handle each other's physics is a very viable idea to me since then its as if im able to access phaser from the server side! The proper way to do it to be more secure would prob have one person handling their own physics and 2 other players monitoring the first players physics. If there is any major discrepancy (IDK if you would send the information between the clients to check or send it the server to check) of these 3 then let the server sort it out. Then every 30 seconds to a minute cycle each player with another player to watch.  With the 2 players monitoring each person idea you suggested, you could even further cut down on the possibility of being able to cheat the system via tampering with the client who is watching you because now there is 2, as well as would let me increase the cycle time to cut down on lag. 

If anyone knows of any real examples of this please share!

Link to comment
Share on other sites

On 5/8/2016 at 5:36 AM, Ralph said:

With the 2 players monitoring each person idea you suggested, you could even further cut down on the possibility of being able to cheat the system via tampering with the client who is watching you because now there is 2

Yeah, this was the whole idea with the example. To make the most annoying cheats impossible. You know, teleporting around insta-killing and whatnot.

Others have suggested having one client do the heavy lifting, by assigning this the role of being a master client, with the responsability of doing the calculations. I just don't know whether or not one machine would be able to handle, let's say 20 players, it being 2D or 3D. And I suppose you have to implement some fall-back, in case the master shuts down. Maybe 2 or 3 client that handles the physics as well, and then takes over in case of a shut down. In this example, you'll know, that if teleportation is happening, it is damn sure to originate from the master, and then you can take whatever actions against this player. If it can handle the load, I think this would be the best option, of course After a proper authoritative server <- which no one seems to really have implemented yet. Or maybe the Unity games played with the HTML5/WebGL player have.

 

Link to comment
Share on other sites

20 hours ago, Raggar said:

Yeah, this was the whole idea with the example. To make the most annoying cheats impossible. You know, teleporting around insta-killing and whatnot.

Others have suggested having one client do the heavy lifting, by assigning this the role of being a master client, with the responsability of doing the calculations. I just don't know whether or not one machine would be able to handle, let's say 20 players, it being 2D or 3D. And I suppose you have to implement some fall-back, in case the master shuts down. Maybe 2 or 3 client that handles the physics as well, and then takes over in case of a shut down. In this example, you'll know, that if teleportation is happening, it is damn sure to originate from the master, and then you can take whatever actions against this player. If it can handle the load, I think this would be the best option, of course After a proper authoritative server <- which no one seems to really have implemented yet. Or maybe the Unity games played with the HTML5/WebGL player have.

 

I mean my server already protects against all these forms of hacking, if i took the road it would just reduce some stress on the server when lots of people are on. Its not hard to make sure people arent teleporting around and instagibbing people its if the server can handle it, which for me, right now it can.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...