How should lag _feel_? how does it feel in games today?


skeezix

Internal Development
Joined
Mar 11, 2003
Messages
8,063
Website
www.codejedi.com
I'm working on an action game; I tend not to play too many real time multiplayer games (such as Counterstrike, Battlefgield 3, SC2, Team Fortress 2, etc) due to limited time.. single player is mostly what I can manage, in bits and pieces. Anyway, so I'm not on top of what these big guys do when it comes to pingtime and lag, though I've done some reading.


(And what Valve does is freaking amazing, and no way I can pull that off in the time I have.. you have no idea how much effort they put into making it feel right ;) They actually allow each client to be 'out of sync', have their own world view, so as to avoid jitter at all points; if you die in this spot in your world view, and in a slightly different spot in another world view, its all good, as long as you die; so if you line up 3 peoples monitors at once, you might actually see slightly differenty games, but the same end results. Very weird, crazy, awesome.)


Anyway..


Consider -- say your pingtime is the appalling 500ms (.5 second) from the server. You start pressing forward, so your guy is supposed to move.


What would you expect to happen, in a modern current game?


i) Your guy starts to move immediately, and sending the instructions upstream to the server (who received it .5 seconds later.) The server, knowing its behind, starts interpolating your motion so it can send improvised updates to other clients. The trick then is while you have started at time-0, the server finds out at time-0.5 and starts interpolating; anything you do, the server is always .5 seconds late on, and any clients are that much later (their own pingtime as well.) This can result in 'overstep' .. you stop moving, but server doesn't know, so you move a tiny bit more than you would, and the server might've already sent this information to others.


^-- I currently do this, but the overstep is synchronized to the client, so when you stop moving, a moment later you guy teleports forward a tiny bit, as it corrects to the servers world view. If you're running in a circle using 8-way controller (like a d-pad), each direction change along the path causes overstep and 'jitter'.


ii) You press forward, but nothing happens for .5 secs. (note that at best, the server receives the event .5sec later, and sends ackowledge back .5 sec later still, so technically your move would be 1sec delayed.. but the client can start interpolating .5sec after you press the key, since it knows the pingtime, and thus can be pretty close to what the server would see.)


--> this would be pretty simple to implement.. ie: whatever your pingtime is, that woudl be the amount of lag you would see in your own movement. Is this acceptible/desirable, or totally fubar?


iii) should it all 'just work', and you never notice? I think the big guys ahve got it all sorted out where you never notice, regardless of your pingtime? (though the implications are far reaching.. you shoudl feel smooth yourself, but other guys may do los of corrections.. guy is running straight, you shoot.. then he suddenly appears slightly over there instead, due to correction?) I think in Valve's code though, that if it interpolates a guy moving one way and you shoot, and then he actrually does something else in his world view.. it'd kill him in different spots.. he'd die in your world view where he interpolated to, and die in his world view where he actually was.. the server would just make sure he died, but exactly where, not so sure.


^-- this is pretty darned complicated .. every client would have its own world view, and the serve would be keeping multiple world-view snapshots over time.. so if you do somethign at time-X, and the server gets it .5 sec later, it would rewind to each clients world view .5 sec earlier, and work out what would happen, and then make the effect happen in whatever world view the current moment clients have? something like that.. wow! I'm not going to bother :)


iv) something else?


As a player, what do you observe going on in laggy situations? Or if you're a coder whose on top of multiplayer theory, let me know your thoughts :) I'm about 5 or 10 years out of date on this sort of thing ;)


..


What I do now is.. (grossly simplified of course here)


server has a Ticker


client is sending motion changes to server as fast as it can


server sends world-state updates to all clients on its ticker


client starts doing its own motion immediately, so it feels good, but server is interpolating based on what it knows


client receives world styate update from server, and synchronizes to it (causing jitter)


I could keep track of where player was for each tick over the last few seconds, and then when world state shows up from server (a dozen times a second, say, but delayed by pingtime amount), compare server info to where player was at the time the server info was made; if it was right then, no worries, keep going. If it was wrong, teleport player to that spot, as a way to get back on what server thinks.


Also, perhaps I should start moving after pingtime-amount, rather than immediately, so at least the interpolationmon server is in the right ballpark to player.


*hmm*


I don't get enough sleep to think about this right :)


jeff
 
i just wish many games wouldnt react at all if its a ridiculous ping, say 700(should be adjustable). that you cant do any damage to others, and others cant do damage to you if your ping is out of whack, because lets face it, it will happen from time to time, and its rather annoying when stuff goes wrong because you connection crapped out
 
Thats an interesting idea; on the surface, trivial to implement .. server should have 'on-damage-receive' type function, and it could just have 'if receiver.pingtime > THRESHOLD: ignore" type logic. Course, that could end up with someone deliberately lagging, then running into a room of baddies to soak up damage, while everyone else loots :)


(I've found a lot of good ideas I've had for this game, get shot when you think about how people will naturally abuse them :)


jeff
 
On kills put some sort of dramatic slow down vid from a different angle ( you seen the newest American made Shurlock Holmes , Game Of Shadows - like that ) and have that play while the information is being sent . On just walking make the maps into reverse ovals ( with finite boundaries with impassible landscape stuff obscuring the shape ) . What I mean by reverse oval is - well


() < see that ? reverse those in on themselves adding a new onion lawer still following the same shape til they ( the halves ) meet in the center .


. .


. .


. .


. . < just imagine that's a layered inverse oval . See what that shall do ( im hoping never even made a spreadsheet in my life ) is it will create the illusion that even in single player it ( the moving forward of the player's avatar ) goes just one pixel further than what the animation appears to show .


I really , really , really ( I'm being sincere ) hope I did not confuse you .
 
I'm actually not talking about kills specifically, just as an interesting point; the trick is the lag skews everything.


I might try the option to invert the trust of sorts.. let the clients move right away as needed, with them sending updates to the server; the client needn't worry about the server's perspective, since they use the same logic. However, the server will validate the location info from the client to watch for cheating, and to send back 'no, actually, somethign happened, now you're here instead' sort of information. So that shoudl make it nice and smooth for the actual player motion themselves, but the other players will still lookjerky to the active player, but what can you do.. if 10 other people are at least ,5sec away from you, you're going to have jerky motion for them.. what else can possibly occur? (you can interpolate where tey may end up, but in reality, if they veer away from that guess your client can do, they'll jerk over a bit.)


jeff
 
Reminds me of some old computer system from decades past, when multi-user was young; I forget which, but it has a 'crash' command.. since it was not too hard to bring down the whole machine, peopel woudl try to.. so they added a command to just bring it down hard, taking the sport out of it.. and success, no one bothered anymore.


Add a big button that says 'cheat' on it, and call it a day ;)


jeff


The devil is in the details.. a lot of these documents discuss these things, but we've all been there; the little tiny things are what seem to be showing when I try various approaches, but thats okay.. I'll make the local client smooth, since that always feel better, and see how it goes. I think I need to calculate pingtime and use it as a delay/timer in various ways, to make things feel synced though, at least.
 
Back
Top