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

Figuring out the cause of jitter

2 posts in this topic

Hi there! I'm having some trouble dealing with jitter in my networked game. I've created a simplified example that should explain the problem:

 

Client A updates its position, P, each frame. For simplicity, say that P is incremented by one each frame. The game updates 60 frames per second, and every 3 frames (20 updates / second) the client sends this position to Client B.

 

B receives the position and uses this value. However, since we expect less than 60 updates per second from A, B will try to predict the increment to P by adding one to it each frame. This works just fine - most of the time.

 

What I'm seeing is some jittery movement on B's end, caused by packets arriving at an uneven pace. For example, here's a printout of P at the end of each frame:

 

P: 4

P: 5

P: 6 <- Got update from A, value = 6. All is well since we expect one update every three frames.

P: 7

P: 8

P: 9 <- Got update from A, value = 9.

P: 10

P: 11

P: 12 <- Missed an update!

P: 12 <- Got update from A, value = 12. Since it was one frame late, P stands still and we get jitter.

P: 13

...

 

I guess I can't expect packets to arrive exactly on time, even though I'm running the test on a single computer and with all clients at 60 FPS. However, what to do about it? The obvious answer is smoothing, but I'd need a lot of it to cover up the jitter - the difference is often more than a frame or two. Are these results to be expected or would you suspect that something is wrong here?

0

Share this post


Link to post
Share on other sites

I think I'm making some progress with queueing up the updates in case they are early, and applying them at their designated time. It definitely removed the worst of the jitter. However, there's some inherent problems with this:

* Queuing up = introducing latency. Not much to do about this.

* How large queue should one allow? I've set an arbitrary number right now (3!) but I think it needs some more thought...

* What happens to packets that are too late? I think I'll try extrapolating the position in case this happens.

0

Share this post


Link to post
Share on other sites
Yes, queuing is the right solution for de-jittering.

Another problem you may end up seeing is that the player sends "position X, direction Y" at time T, and then turns around at time T+1, and the packet that sends the next direction won't go out until time T+3, meaning there will be a "snap" on the receiving end if it does forward extrapolation.

The smoothest option is to wait until you have data for all your time before you display the entity. I e, if you send data for times (T-2, T-1, T) at time T, and it's received on the other end at time T+2, then the other end would display the location at time T-2 at time T+3, aiming to display the location at time T a timt T+5, so the next packet arrives in time to display T+1 at T+6.

If you don't want to always display "known" data (which introduces this latency) then you have to extrapolate, and you will get jitter. The Entity Position Interpolation Code (EPIC) library is one way of smoothing out the extrapolation, but it will never be perfect, because you are, at the core, guessing, and you will guess wrong at times.
1

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