• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
maunovaha

Is it possible to apply local lag to CS architecture?

7 posts in this topic

Hi,

 

I have been recently researching about local lag technique which to my understanding means that by delaying execution of input events (locally) using timestamps (set to the future by the amount of local lag) is possible to achieve better fairness and consistency in the multiplayer games. The reason being that local lag gives each site enough time to retrieve input events, align timestamps and execute them at correct order/times.

 

However, while this all sounds tempting, I am having trouble of getting my head around the fact that this technique requires that each site has enough logic to model the execution of events. Therefore, I think that while this is not a problem with P2P, with CS it is because it is the main decision point, including the relevant logic to make the decisions?

 

So the question is: How would I apply local lag to CS architecture and is it done before? I recall seeing something about local lag being used between two servers so it makes me wonder, also I have a feeling that this could/should be possible - it could be effective if local lag can be used to buy more time for returning correct results from the server and mitigate the inconsistencies tongue.png

 

Thnx!

0

Share this post


Link to post
Share on other sites
There are many good open source tools out there to simulate lag and packet loss. Right now clumsy is one of the better tools for windows.

In larger QA groups they will route everything through a PC that serves as a network hub. It takes a bit of configuration, but you can make it so the PC serving as a hub can simulate various conditions. You can introduce high packet loss, data corruption, assorted real-world bandwidths, and more. Flip a switch and one of the machines now communicates as though it were on 56K dialup, with either a clean or dirty line. Press another button and suddenly someone gets 40% packet loss for 10 seconds, maybe to simulate a wifi network and a user shouting "Turn off the microwave, it ruins the wifi signal!".


As for trying to compensate for lag by setting your time stamp in the future, I don't see how that gains anything. The lag still exists.
1

Share this post


Link to post
Share on other sites


As for trying to compensate for lag by setting your time stamp in the future, I don't see how that gains anything. The lag still exists.

As I understand it, it's not designed to compensate for lag - it's designed to apply a minimum lag to all players, even those who would otherwise not have lag.

 

Same idea as Blizzard limiting the original StarCraft to 640x480 for everyone, to prevent unfair advantage from players with higher resolutions seeing more of the map.

0

Share this post


Link to post
Share on other sites

 


As for trying to compensate for lag by setting your time stamp in the future, I don't see how that gains anything. The lag still exists.

As I understand it, it's not designed to compensate for lag - it's designed to apply a minimum lag to all players, even those who would otherwise not have lag.

 

Same idea as Blizzard limiting the original StarCraft to 640x480 for everyone, to prevent unfair advantage from players with higher resolutions seeing more of the map.

 

 

Thnx for the replies.

 

Yes. I actually needed to double check reply from frob because it answered to different question which I tried to get answer for. wacko.png

 

I am not sure whether I was clear enough, but local lag which I am referring to is programmed to your game code to delay processing times of your events to future so that e.g. player with 50ms and 100ms could have same view of the world at the same time. So flow is something like this: "Press input -> Delay processing locally by the amount of local lag (50ms) -> Sent/Receive packets from the network -> Align timestamps and execute all actions at the same time."

 

Value of local lag could be RTT of most lagged player or some fixed or adaptable value based how much local lag certain game tolerates. This is the stuff which I wonder can it be transferred from P2P world to CS, and if so - do I need to apply local lag at clients and at the server + caveats? Hopefully, I was now clear enough smile.png

0

Share this post


Link to post
Share on other sites
Sorry about the first reply, I did mis-read it.

It looks like the algorithm tries to estimate the worst case round trip for all clients, then delays the display for all clients based on that worst case. It eliminates the advantage of a fast connection, dropping everyone down to the worst case connection.

In that case, since you are moving to a client/server model which is usually a star topology, the server could directly compute round trip time to each other machine.

So the server would say:

A: 32ms round trip
B: 20ms round trip
C: 92ms round trip

Giving an approximate one direction delay of 16, 10, and 46 milliseconds.

From there, it can do some subtraction from the 46 milliseconds to know how long to delay the work:

A: 46-16=30ms extra delay
B: 46-10=36ms extra delay
C: 46-46=0ms extra delay.

For the choice between client or server, the only sane option is to put the extra delay on the server side. f the server delays sending the data it should all arrive at approximately the same time, removing the exploit possibilities.

I can easily imagine a griefers turning it into a "race to the bottom".

If the delay is continuously adjusted during the game, such a player could do nasty things. Join the game at a natural rate, then turn on a tool like clumsy on their own machine for outbound communication, and suddenly the responsive game becomes very unresponsive for all players. With a bit of care that kind of subtle annoying attack could look like regular Internet noise, a claim "someone else turned on Netflix" could cause problems.

Even worse, if the delay were done on the client rather than the server and also inflated his ping time, the attacker could have the updates for much longer than the other clients, giving an even larger advantage of earlier updates while also impairing the opponents with unresponsive, artificial delays.
2

Share this post


Link to post
Share on other sites
Valves Source engine / Counter Strike, which is about the most popular client-server PC FPS game, implements this. There's a full description of their algorithm on their wiki somewhere (sorry I don't have the link handy).
IIRC, every client is running about 100ms in the past, even if their ping is <100ms. The server constantly rewinds and fast-forwards the game-state to insert client triggered events at the right points in time.

I think Battlefield implements it too, but they've not publicly described their algorithm.
0

Share this post


Link to post
Share on other sites

frob,

 

Now we are talking smile.png and by giving those facts out, I think it makes somewhat sense to delay at the server. However, if precise consistency is required I believe that delay at the clients based on timestamp is also necessary when packet is received because the second part of the rtt is still unknown. (so every client sees everything in sync). Ofc. clients already has the data so it could be possible to "hack it visible". But those are just tradeoffs which needs to be made.

 

 

If the delay is continuously adjusted during the game, such a player could do nasty things. Join the game at a natural rate, then turn on a tool like clumsy on their own machine for outbound communication, and suddenly the responsive game becomes very unresponsive for all players. With a bit of care that kind of subtle annoying attack could look like regular Internet noise, a claim "someone else turned on Netflix" could cause problems.

 

 

And yes, you are right. this is quite possible unsure.png  - thats why specifying fixed local lag value not based on estimate on players ping could be more wiser. And that local lag value needs to be measured based on the aspects of individual games. (how much it can tolerate).

 

I will try to draw it out in sequence diagram and see how it could work.

 

But, even then at least when using CS architecture - I assume that local lag alone as a compensatory technique is not enough and some prediction or hints for players are also needed... e.g. playing animation at the client/sounds when replies are still hanging at the server. etc. 

 

 

Valves Source engine / Counter Strike, which is about the most popular client-server PC FPS game, implements this. There's a full description of their algorithm on their wiki somewhere (sorry I don't have the link handy).
IIRC, every client is running about 100ms in the past, even if their ping is <100ms. The server constantly rewinds and fast-forwards the game-state to insert client triggered events at the right points in time.

I think Battlefield implements it too, but they've not publicly described their algorithm.

 

Hodgman, thnx for the tip.. But I have read their wiki and I cant find anything like that... are you sure you are not mixing that for interpolation? :) they has interp value of 100ms and the server uses lag compensation to "replay" events at the server as they were happening -100ms ago - so bullets can be placed to targets and so on.. Local lag is different because it increases the latency of your key presses to give messages enough time to reach the other participants. smile.png

0

Share this post


Link to post
Share on other sites

player could do nasty things. Join the game at a natural rate, then turn on a tool like clumsy on their own machine for outbound communication, and suddenly the responsive game becomes very unresponsive for all players
Though I think that a simple modification like delay = min(worst_onedir, 50) - your_onedir would fly quite well for that. Go ahead and introduce a 80 or 100 ms delay on your line, but everybody else will only see 50. You could have the maximum ease in/out, too, to give the individual player even less of a leverage.

Maybe similar to how TCP does it, raising linearly and cutting down by one half, or simply by having the delay shrink and grow linearly but at different rates. As in, the max delay may grow by at most 5ms per "tick" (and up to an absolute maximum) but shrinks by 10ms.

0

Share this post


Link to post
Share on other sites

Okey,

 

I had time to play around with that idea. Below is the diagram which I came up with - at paper it seems to work. Left hand side of the image is the stuff without local lag, and right hand side is the one which I crafted.. Although, it is somewhat unrealistic because lack of game loop rate & server update rate etc., but I dont know if those makes any difference - ofc. they adds more delay. While local lag is done at the server (50ms as a target maximum) the time t could be used to buffer inputs at client side to maintain consistency and display them at the same time at all sides. But as being said, can be hacked.. dunno if its a big deal to gain benefit of few ms. Depends on the game I guess. And I included dashed arrow to represent that packet might get lost and wont arrive on time - in those cases state needs still to be repaired.

 

local_lag_example.jpg

0

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
Sign in to follow this  
Followers 0