• 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
Firnael

Apply Lag Compensation on non-instant events

12 posts in this topic

Hi,

 

I was reading this nice article for the 3rd time (after I read this blog entries 4 times). I got pretty much all of my questions answered but I miss something to get the global idea.

 

When you use Lag Compensation on instant events (like a gun shot in Counter Strike, bullet instantly teleport this its final location AKA a player or terrain if you missed), it's easy for the server to get the time when the event was fired, and rollback the entities positions in the past to perform the collision test.

Now when you deal with slower but yet precise collision detection over the network, like a skillshot in a MOBA (ex. a fireball with no particular target, go straight forward until it vanishes or hit some enemy), how do you handle proper lag compensation ?

 

Since the projectile has to travel and not teleport, you test collisions every game update, and if you do want to apply lag compensation, you have to rollback all entities (at least the near ones) every update.

 

Is that relevent ? I've always wondered how games like LoL ou DotA could feel this smooth.

I'm asking you this because I'm pretty sure dead reckoning and entity interpolation is near to unusable on situation like this kind of fast-paced games, you can't predict what the players will do next.

 

Thanks

Edited by Firnael
0

Share this post


Link to post
Share on other sites

I'm pretty sure dead reckoning and entity interpolation is near to unusable on situation like this kind of fast-paced games, you can't predict what the players will do next.

Well, dead reckoning and entity interpolation are for really fast action games like CC or CoD, Dota etc. are much slower. The trick in Dota etc., which are more RTS then fast paced FPS games, is, that you have more time to predict its outcome. When you shoot a bullet, you need to consider the effect instantly, whereas when you fire a fireball you have several (milli-)seconds time to tell the client and server, that a fireball is flying along a predictable curve.

 

The problem is, that you need to get the server and client in syncronisation for each event. If you have a slower game, where you press the button, the character starts to chant a magic spell, the fireball forms up and starts to fly along a path, you have virtually all the time you need to syncronize the client with the servers by telling them, that in t+500ms a fireball will start to travel from point A to point B. With a good connection you don't even need client prediction, this would be unthinkable in a fast paced shooter.

 

Edit: Addtionally, if the game uses  RTS netcode, most likely each command will have a execution delay as lag compensation and a lock-step approach. This could lead to slowing the game down to keep it syncronised, leading to a really smooth game experiences (though sometimes a slow one too).

Edited by Ashaman73
1

Share this post


Link to post
Share on other sites

The act of firing it is an instant event, so the server can rewind to apply it to the right point in time. Though yes, to fast forward it to the current time with accurate collisions, it would have to test it for collisions in all the frames between the server's current time, and the spawning time.

 

However, if we take the original DOTA as the archetype for these games, it wasn't built on a typical FPS networking model like the Valve documents describe. It was built on War3, which used a typical RTS networking model, as described here: http://www.gamasutra.com/view/feature/3094/1500_archers_on_a_288_network_.php

 

I'm not sure what LoL or DOTA2 use for networking, but there's many more options than the Counter Strike solution.

0

Share this post


Link to post
Share on other sites

I have to admit, the question was more about "Do I have to implement client prediction on every network game ?".

I'll check thoses RTS networking models and get back asap ^^

 

The goal here is to find out if lag compensation is relevent in a coop A-RPG for exemple.

0

Share this post


Link to post
Share on other sites

"Do I have to implement client prediction on every network game ?"

There are two issues.

 

The first one is, that the client reprensentation of the game world is different to ones of the server and other clients. This is problematic if the player performs a critical action based on the representation of his client. E.g. an aimed headshot in a shooter. In this situation you need prediction and lag compensation to fight the different representations, else the player would most likely hit the wall and not a moving enemy. If you don't need this kind of accuracy, e.g. in a MMORPG or RTS where you click on a target, then perform an action, then you don't really need this kind of counter measures.

 

The second one is feedback. When you perform an action, you want to see feedback as soon as possible. E.g. your character starts to chant the spell, starts a certain animation as soon as the player press the action button. In the meantime the client sends the command to the server and the server propagates the effects to all clients. This is not really prediction, it is more of lag masking, some cheap tricks to buy you some transfer time.

0

Share this post


Link to post
Share on other sites

I have to admit, the question was more about "Do I have to implement client prediction on every network game ?".

The short answer is: no, certainly not.

The less short answer is: usually a small amount. It's usually wise to implement ways of making sure the client feels that his own character is responsive. This might involve instantly responding to input with animations and audio, or starting movement of the character before a confirmation returns from the server.

But generally, the whole attitude of sending everybody to the Valve site any time they want to know about networking has become a problem. People assume they need to implement complex interpolation, extrapolation, rollback, state replay, etc., when in fact most of this is only there specifically for high speed, low-latency, spatially-sensitive action games of aiming. Besides, not every shooter handles it the way Valve do anyway! So when deciding how to implement your networked game, you must always keep in mind the needs of your specific game, and not assume that copying Valve is always the right thing to do.
2

Share this post


Link to post
Share on other sites

Thanks for the advices.

 

I can easy imagine how to hide possible lag client-side with client-side prediction (at least with graphical and audio feedback of player actions).

 

Now, I was wondering what could be best for let's say a Zelda-like but with coop (not only LAN, so you need to think about sync through the internet).

This is definetely not a really fast-paced shooter which would require the best precision for ex. headshots on running ennemies, while 360 unscope, but it's not a pure RTS/Target-based mmo (AKA click on target => click on spell => spell affect target) either.

I want it to be based on action and therefor need a minimum of precision (WTF BROKEN HITBOX I HIT YOU I SWEAR GOD F*CK THIS LAG).

 

The way it's explained on the Gamasutra article you linked before seems good for a pure RTS, but is it the case for a more action-oriented gameplay ?

If I understood well, all client got the exact same simulation in the same time, but they all live at least 100ms in the past.

I'll read it again (english not my native language, I didn't get all tongue.png).

Edited by Firnael
0

Share this post


Link to post
Share on other sites

I want it to be based on action and therefor need a minimum of precision

 

You don't much precision for a game like this. You certainly don't need to be rolling back hitboxes or any of that. Do you even need hitboxes? Just have clients act locally, and send the results to the server. The server checks that they look legit, and passes them on to everybody else.

0

Share this post


Link to post
Share on other sites

Well I'm pretty sure I need hitboxes, without them I won't be able to detect collisions Oo

I'll go simple, at least at start and do what you say, do some client-side prediction to give a smooth feeling for local player, with server-reconciliation so I don't get useless rollbacks, and see if it's satisfying enough.

What I was affraid of is the time needed by the server to broadcast the new game state to other players, but let's admit it, if you got 200ms latence, any action-based game feels unplayable.

I need to start testing stuff.

 

Thanks a lot smile.png

 

P.S. : I almost forgot, server timestep seems to be the best solution to avoid strange situation when for example you kill a unit, client-prediction shows you its dying animation, but at the time you did this prediction, the unit used a potion and healed. When the server corrects you, you'll see the unit revive and act like "I aint even mad".

I think I should definetely dig on that direction.

Edited by Firnael
0

Share this post


Link to post
Share on other sites

Well I'm pretty sure I need hitboxes, without them I won't be able to detect collisions Oo

You don't need some server-managed idea of where the hitbox is like shooters do. RTS and RPGs don't usually work that way. It's more a case of comparing distances, and if the target is within range (maybe including a little extra distance to account for lag) then allow the attack.

0

Share this post


Link to post
Share on other sites

Yes it may work for melee attacks, even with projectiles like spells or arrows if you don't wont precise collisions, but you may need them for terrain collisions.

0

Share this post


Link to post
Share on other sites

I'm dealing with a similar issue for a MOBA game (client / authoritative server).

 

 

My current approach is not "correct", and it is cheesy, but it is quick to implement and appears more or less workable so far.

 

I just move the entities about 1/20 the distance between their current position and server position, per frame  (fps = 30).   Network updates are around 10fps.   It seems to smooth things pretty well, and hit-spots seem accurate as well.

 

For a high precision FPS this would not work, and I may find issues with it down the road, but it was quick and apparently effective so far.

0

Share this post


Link to post
Share on other sites

Yes it may work for melee attacks, even with projectiles like spells or arrows if you don't wont precise collisions, but you may need them for terrain collisions.

That's completely separate from the networking though. Of course you need ways to check collision, which may or may not be a hitbox, but you don't need a complex hitbox that can be tracked through time like the Valve ones do.

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