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

Client-server RTS lockstep

3 posts in this topic

Am I right that client-server lockstep would require commands to be executed 4 turns (800ms) after they were issued?

 

Turn 1: client sends out move command

Turn 2: server receives, acknowledges, and sends out command to other clients

Turn 3: every client acknowledges it

Turn 4: server sends the all-clear to execute scheduled commands and increment turn

0

Share this post


Link to post
Share on other sites
The commands are executed X turns after they are issued, where X depends on transmission latency and size of turns.<br /><br />A client acknowledge and all-clear is not needed, btw. Client sends command for turn X to server. Once server has commands for turn X from all clients, it bundles them up and sends them to all clients. As soon as a client gets commands for turn X, it knows it can execute turn X.
2

Share this post


Link to post
Share on other sites
so, i've been thinking of this problem as well. and my solution is similar to Polyfrags.

1. recieve input from client.
2. predict when all clients should receive the command based on known pings, and mark the command for execution then.
3. distribute command to all clients(including source client, since the commands execution window is changed).
4. recieve OK from all clients.
5. send-all clear to clients.

however, are you suggesting steps 4/5 can be assumed to be received by the clients, and the server doesn't require validation from the clients.
i've been thinking it might be reasonable, since it's possible to detect if a client is out-of sync. however my mechanism suffers from the potential of a sudden lag spike. this might not be a problem over a lan, but over the internet it could be a serious issue.

also, step 5 is problematic, because what-if the all-clear doesn't reach some clients in time for the command to be executed, and then they are out of sync.(similarly stopping at step 3 gives the same potential to occur).

I suppose lag is theoretically unavoidable, but my main concern is how to mitigate recovery, if a client get's out of sync, it'd be hard to get them back in-sync, one method would be to store snapshots of the game at various intervals, and then move back to the nearest interval where a command was run. speed the game back upto realtime, and continue forward. but that seems like a nasty/bloated method for recovery. Edited by slicer4ever
0

Share this post


Link to post
Share on other sites

You are not out of sync if, when doing simulation for step number X, you have all the inputs from all the clients for step X.

 

The server cannot send out all commands for step X until it has received messages from all clients regarding step X.

 

Once a client has sent its commands for step X, it cannot change its mind -- it has to "commit."

 

The server needs to detect when data is missing from some client for step X, and not execute the commands, or forward the inputs, until that client catches up. Simple case, the game simulation (not necessarily display!) will lag a little bit. Worst case, the game has to pause while that client catches up, or is determined to have dropped. You have likely seen this happen to RTS games like Starcraft, etc. Suddenly, the game pauses, saying "waiting for player P to catch up."

 

Clients run the simulation for step X once it gets the command packet for step X. Server runs the simulation for step X and forwards commands to all clients once it has gotten all the inputs for step X. While client is waiting for the command packet for step X, it sends commands timestamped for step X+N, where N is determined based on single round-trip latency (round up.)

 

As long as you do lock-step, both the client and the server is actually very, very simple. You don't need any "go-ahead" signals or additional round-trips. All you need is to set the command send-ahead time on the client to the longest roundtrip latency that particular client is expected to see -- or, if you want a "fair" game, set the send-ahead time to the maximum round-trip-time of any player in the game.

 

Typically, when you do lock-step, you also use TCP for transport, as the in-order, re-transmitting behavior of TCP is pretty well matched to the needs of lock-step simulation. If you want UDP, then you typically want to duplicate commands for multiple, older, steps, into each packet you send, so that a single dropped packet will be "made up for" by the next packet sent. Typically, you'll make the amount of duplication match the value of N -- send all commands you have pending that haven't yet been received back by the server, properly timestamped (don't change the timestamp of commands when re-sending!)

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