Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm currently working on a Multiplayer Tower Defense game, using ImpactJS & Node. I seek some clarification about how to handle projectiles from towers, let me explain.

So the server is running the master game, and the clients just follow the instruction from the server. Lets say there is about 20 towers on the stage, all needs instructions for which creeps to shoot at. Now lets say each towers fires twice in a second, that's 40 shots each second, (worst case scenario) which is 40 request per second to each client, would't this casue alot of stress to the server, saying that we have 50 games running the same time. So what i am really asking, is this method inefficient, and is there a smarter way to handle all these instructions.

Thank you.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

First optimization: you don't need to grab instructions individually.

You have twenty towers firing twice a second. Synchronize their fire, or snap it to the nearest quarter second, and now you only have four updates per second, each containing ten fire instructions. Much more tractable.

If people can place towers to modify creep pathing, that's more of an issue. A quarter second of delay might result in creeps leaking when they shouldn't have. You can adjust game mechanics to make this less likely -- towers take time to construct and are passable terrain during that time, maybe, which also helps in that you don't need to provide firing instructions for towers as soon as they're placed.

Failing that, you can follow the tactic used by most FPS games: the client assumes that nothing important will change in the world before the next update to the server and simulates everything independently. When it gets a server update, it replaces its current world state with the newly provided one. This will produce things like teleporting creep, which isn't too great, but provides a lot more flexibility in game mechanics.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.