🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Routing Traffic for browser io game

Started by
2 comments, last by EStock 2 years, 12 months ago

Hello. I am developing a very simple io browser game. The game runs on a node js server. For the game to work correctly, the latency must be kept as low as possible. Preferably under 100ms ping. Presently the game runs on an Amazon ec2 server. I am looking for a strategy for ensuring that players who connect to the game through the browser will connect to the server with the lowest latency.

I know that amazon offers a Route 53 product which can handle this, but I believe this is too expensive for my simple game.

Would this strategy be possible?

  1. Players connect to the http server located in one location. This site just shows graphics of the game and allows the player to enter their name before pressing a button to start playing.
  2. The players download a list of ip addresses of the current game servers in different regions. They ping each to determine the lowest latency
  3. When the player presses the start button, they join a game at the region with the lowest latency

Are there any better strategies you would suggest I investigate. Please keep in mind that my game design is very simple and likely will not use login or player profiles when I first launch it.

Advertisement

You're asking for both “simple” and “advanced” in the same question. Those requirements fight against each other!

Geolocating players and routing them to different server instances is not a “simple” operation, so you might want to re-consider whether your browser game is really “simple.”

Having each player ping each server will generate significant load on the servers, and this load will scale with number of servers times number of players. E g, every player will create load on every server, at least when they start the game.

I would suggest just spinning up servers in the few regions that are the most important, and simply allowing players to choose which server/zone to connect to. This may also help with language match-up, in case there is any kind of chat built into the game.

Once your game is successful, it might make sense to look at Route 53 again. You'd pay $50/month for the game-server domain, and then 60 cents per million queries for latency-optimizing responses. Compared to the hosting costs for a bunch of availability zones, this should not be a big cost.

enum Bool { True, False, FileNotFound };

Thanks for the advice!

This topic is closed to new replies.

Advertisement