   Networking Design For RPG/Action Game
  Hey!I'm about to make a game. It's supposed to be similar to DotA, the Warcraft 3 custom map. For those of you who don't know what DotA is: You have one character, your hero, as opposed to an army of units like in regular Warcraft 3, and you go around killing stuff. It's 5on5, multiplayer only. There are some NPCs on the map too, like maybe 50 or 100.I've been thinking about what kind of design I should use for the networking part, and I was hoping you could give me some advice.So, I want to be able to play with at least 10 players simultaneously, maybe up to 20, I mean why not? In addition (and I'm not sure about this feature of the game design yet) I want there to be neutral monsters, up to about 50 total (not depending on the number of players).The central part of the game is the player vs player combat. If you have played DotA, I kind of want it a little bit more like a fighting game, i.e. a little bit quicker moves, maybe even hitboxes, etc. But there is still going to be like side effects, buffs and stuff. If you haven't played DotA, think of my game as a mix between an RPG (like World of Warcraft) and a fighting game.DotA obviously uses the same control scheme and network design that Warcraft 3 uses, but I was thinking that maybe I want to, for example, move my the hero with the keyboard instead of the mouse. But I think that that will make delay in the movement more noticeable. In an RTS where you use the mouse to move units, 200 ms delay isn't that bad. But when you control your character with the keyboard, like in an FPS, I think 200 ms delay in your own movement would feel terrible.At first I thought of kind of a lock-step design, where the client sends his commands to the server, the server broadcasts them (and arbitrates important descisions) and, when the client gets his own commands back, it would not see any difference between his own or other's commands, and just change his model of the game accordingly. I would use TCP in this case, I think.But, moving towards a fighting game, especially controlling the character with the keyboard, I think this will feel laggy. Maybe there needs to be instant response to your own input, like in an FPS.The reason I didn't wanna use the FPS style (which I guess is just sending a lot of updates with UDP all the time) is that with the 50 monsters, this might be a little much. Also, because of some side effects of spells/moves, certain pieces of information is very important (so UDP might cause problems).So what about a middle ground, using TCP but allowing your character to move instantly in your own model of the game world. I thought about this a bit, but it seems that it can cause some problems. For example, I run forward in my own model, but in reality, the servers model, I might get blocked by another player, that in my model is not at the same position due to the delay between me and the server. But if the server is supposed to be the arbiter in important decisions, the server might suddenly tell me that "Hey, you can't go there!" and I must warp/snap back.One may think that it isn't so important that I warp back, and that the server is more forgiving. But that would mean that if there is a big delay between me and the server, other players might not be able to block me because of my lag, and that sounds wrong.Well, that's about everything that I've thought about so far. It is not based on any experience but only on what I've read and understood so far, and I realize that I may be wrong. It feels a little bit overwhelming right now, partly because I'm not really sure about exactly what kind of gameplay experience I want. However, if you want to give me advice or comments I would highly appreciate it.[Edited by - tufflax on June 18, 2009 3:46:03 AM]
  there are several ways to do this sort of thing. 1) The Warcraft 3 way. Use a deterministic engine, and a lock-step mechanism. http://www.gamasutra.com/features/20010322/terrano_01.htm2) FPS system. update entire game state via unreliable updates, client side prediction and lag compensation for accuracy. 3) WoW / Guild Wars. maybe TCP/IP event-based and messages, using waypoint updates for NPC navigation, maybe UDP updates for player movement and fast response. 1) works with RTS mechanics, very little bandwidth required, determinism being the key. Problems with latency, which you can hide behind some client-side smoke screens. Client-side prediction for stuff like direct input movement is hard. Join in progress problematic, replays easy and small in size. Creating, maintaining and debugging deterministic engine a lot of work (out-of-sync will diverge very quickly, and there is no way back). Also suffers from cross-platform problems (floating point implementations at the CPU level, all platform must agree to the same floating point standard).2) Scales bad with the number of units to update, big bandwidth, quite complex to implement. Usually works through delta-compression mechanisms. Good precision and instant response, lots of literature, doesn't need perfect determinism (although it helps for client-side prediction). You can also tune updates for each entities, depending on their visibility from a player, to reduce bandwidth. 3) Middle of the road, I suppose. More complex, poor accuracy (entities usually 'lock' on targets and waypoints).I'm not sure what Diablo III uses, but my guess is, you want something similar. I would think they use an hybrid system.[Edited by - oliii on June 18, 2009 2:21:48 PM];  Thank you!Yes, Diablo must do something similar... hmm.   ;  Just a note, I'm pretty sure WoW only uses a single tcp socket however in that style of RPG the delays don't really matter. W3 uses UDP i'm pretty sure.Good luck,Gnoll   