I had an idea for an architecture, and I was wondering if anyone has implemented something like this or has used AWS or some other service to help?

I thought about using NodeJS + SocketIO to handle a server side for this cooperative shmup (think Raiden or Galaga) we are just starting to work on. We started to think about latency issues.

The solution I came up with was to spin-up/down servers at the mid-point of the 2 users playing with some epsilon value (say 300miles or something). Perhaps the server would allow up to 50 users to play simultaneously and after that it would deny requests, which would then spring up another server. This should cause latency to be about equal for the 2 users playing. Furthermore, if we are matching making users then we always pair the 2 closest users together.

I suppose there are other factors to consider like user skill level, but I think right now we are most concerned about latency since it directly affects gameplay. Actually our game does require fairly precise timing. Also we want users to be able to see each other shoot since cool animations happen when they are in sync with each other.

I suppose this is similar to how a fighting game might operate in terms of timing/precision.

Ideas? Thoughts? How have others approached this problem? Where can I start looking for examples?


Latency is not only about distance but about the player's connection speed, and the quality of their ISP's infrastructure, and that of the host of the server, and the traffic on the network. So, you could theoretically balance things out by locating a server at the midpoint, but I expect the benefit from that would be dwarved by other factors. You're usually better off just providing a selection of servers at various geographical locations and allowing players to find out for themselves which ones work best for them. eg. In the UK I may get a better ping going across the Atlantic to the USA than over to mainland Europe if it's 9am GMT and 4am EST, so you may as well let me make that choice.

Another factor would be that AWS and similar cloud services are optimised for throughput and reliability through redundancy, not for minimising latency. This makes them great for web sites or streaming data but often very poor for real-time games. Your experience may vary but generally speaking if you want predictable server performance you're usually going to want a dedicated or colocated server at best, though you might be ok with a virtual server if the hardware is powerful enough and you get good guarantees on the resource allocation available to you.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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