• 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
Angus Hollands

How to use timestamps for packets instead of ticks

10 posts in this topic

Hi everyone!
I've been working on an authoritative server design for a few months, and I've hit a snag.
After working initially with a tick-based approach, simulations break down (prediction and extrapolation) when the client tick rate differs to that of the server.
The server will always have a constant frame-rate, typically 60 fps. However, this may change for the clients, so how can I account for that?

I've read about using time instead of ticks, however here are my following concerns:[list]
[*]Time is not an integer - unless you perform multiplication and rounding.
[*]Time does not progress at a constant rate with a tick based logic loop, thus states won't be derived at exactly the same time, even if the simulations run at the same tick rate and are started at exactly the same time.
[/list]
Because of these issues, whilst I can think of how to modify my system to use time, I cannot think how one could access the gamestate that was determined for that time. This is my current idea for a solution:[list]
[*]As the server runs at 60 ticks per second, use a division function to determine the current "tick" of the server using a tick rate and time (e.g tick = time / tick_rate(per second)). I'd have to round to the nearest integer, so i'd use the floor of the result.
[*]This tick can be used to determine a constant tick rate.
[*]When comparing predictions against server states, use interpolation between client predictions (if the client tick rate is 15hz, ever 4 server ticks)
[/list]
Some final notes:[list]
[*]I'm using a game engine that runs all game elements (render, animation, logic) sequentially in the game loop. Thus all are affected by a varying frame rate
[*]The physics system is constrained to the tick rate, so i'd have to simply modify the velocity values by hand using the tick system as a scalar against the velocity vector.
[/list]
Does this sound like a viable solution? I'd assume that the tick rate of the client is capped at a maximum of 60. Edited by Angus Hollands
0

Share this post


Link to post
Share on other sites
Actually, the real solution is to step zero, one, or more physics steps per display step, depending on frame rate.

The canonical game loop looks something like [url=http://www.mindcontrol.org/~hplus/graphics/game_loop.html]this[/url].
1

Share this post


Link to post
Share on other sites
I'd like to, however I can't. I cannot modify the physics tick rate, without modifying the logic tick rate, as they are sequentially performed, with no user control. Therefore, will my solution work?
0

Share this post


Link to post
Share on other sites
Again: You should always run a fixed-length (in time) physics/simulation tick, and if more time has elapsed since the last time, you should run more than one tick. There is no other way.
0

Share this post


Link to post
Share on other sites
[quote]In other words, I am stuck?[/quote]

If your client code locks the physics simulation time step size to the frame draw duration, then it would seem like it.
If you can run simulation separate from display, perhaps even in another thread, then you don't need to be stuck.
0

Share this post


Link to post
Share on other sites
you should always get most actual data to compute the frame. If there is more data in the stack (info for 3 frames has arrived while client was computing its previous frame, then you should pick the latest, while it can couse problems, you may need to process all of those that arrived, but this will couse you dilema you are solving). I would say that you should pick the latest and if player did not see 3 frames that got interacted on him, it is his penalty. In this way your aplication can allways decide on client's side. Imagine everyone is positioned on their places most up to date, so that if you aim someone, the other one is informed of it, even that he didn't spot you for a lag.
-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