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

Client/Server communication: How verbose are you?

2 posts in this topic

I'm working on an RTS-style game, using a client/server network model. Clients are only told what they need to know (what affects or is seen by that particular player).

Basic activities have so far been pretty simple. A Unit moves, send a MoveUnit command to the client. Building gets destroyed, send a DestroyBuilding command to the client.

But now I'm starting to get into more complex activities. For example, let's say you have an action you perform at a building, which gathers multiple idle units of different types, sets them to move to the selected building, and then once they all arrive, merge them to create a new super unit. From the player's perspective, they just performed a single command. But on the server, multiple things are happening. Moving units, changing each unit's home building, creating a list of required units and waiting for each one to arrive, then destroying all of them and creating the new super unit.

My first thought was to send each little action as a separate command to the client, as I was doing before with the simple activities. Essentially, treating the client as a puppet and telling it exactly what to do at every step. However, I'm thinking that this will be overkill in terms of network traffic. And, in some cases, I wonder if the client should know more about the bigger picture, in order to better communicate that to the player.

The alternative would be to send a single command regarding the creation of the super unit, communicate the list of units to be used and what building to use, and then let the client figure out the details of navigating units and such. That fixes the bandwidth concerns and lets the client know more about what is going on. But it also makes me wonder if I would be risking the client and server going out of sync if I leave details up to the client. Just "assuming" the client is doing things right.

I know that if the server and client are running the same code for performing this command, then there shouldn't be any issues (in theory) with them making different decisions on how to perform the command. But, because the client isn't really simulating the game, only being told what is going on after the fact, I wonder if there might be issues with it not knowing enough about the game environment to simulate it properly. The client starts moving a unit to the building, but the unit passes over a part of the map that the client hasn't seen. The server knows there is an enemy building in the way, but the client doesn't yet. As soon as the unit gets close, the server tells the client about the building. But now it is up to the client to change the unit path to navigate around it properly. Is it going to make the same decision as the server, with the server knowing everything? What if the client is still navigating those units to the building when the server decides they should have already arrived, and the server starts sending commands to move the super unit, which the client hasn't created yet?

Am I being overly paranoid? Is it best in this sort of situation to treat the client as a puppet and feed it every little step, at the expense of network bandwidth, or are there ways of safely generalizing commands for the client to perform on its own?
0

Share this post


Link to post
Share on other sites
for RTS you might want to look into lockstep simulation instead, that way you only have to send inputs (Which keeps traffic low even with thousands of units), the drawback ofcourse is that the client has to know everything (Which makes for example maphacks possible) and that you have to add some delay after each action (most RTS play a short "ackknowledged" animation/sound for this reason) but the alternative (sending updates for each unit) isn't really feasible unless you keep the unitcount low (Which you probably don't want to do with an RTS) Edited by SimonForsman
0

Share this post


Link to post
Share on other sites
In my experience, you're best off picking one model and sticking to it consistently.

If your server is authoritative for things like units moving, then it needs to be authoritative more or less uniformly. Allowing clients to do their own thing based on high-level commands is indeed begging for desyncs [i]unless[/i] you have taken extreme care to keep everything in lockstep from day one. You might be unpleasantly surprised about how much drift you can get between client and server based on trivial things that you'd never think about, especially if you do any floating-point arithmetic.

Determinism is certainly possible with enough effort, but if you haven't aimed for it from day one (or if you aren't willing to do a huge amount of re-engineering) then it's a pipe dream.

I would suggest compiling some actual numbers for your bandwidth usage. If your list of commands to accomplish the super-unit construction is only 200 bytes, then who cares? If your single Move command is 200 bytes, then you need to do some more fundamental optimization to begin with.

Some context on how much you're actually sending across the wire would be very useful.
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