News for hackers. Stuff that matters.
Re:Building multiplayer games with Socket.io and HTML5 Canvas by Entangled on Saturday September 23, 2017 @08:26AM (#15319437)
Any not so expensive hosting options for sockets-based apps? Heroku? Digital ocean? AWS?

Also, what are the limitations by the hosting provider regarding concurrent connections, data transfer, etc.

I am currently working on a poker app using free Heroku dynos but would like to have a budget in mind for when going live.

Re:Building multiplayer games with Socket.io and HTML5 Canvas by reednj on Saturday September 23, 2017 @07:59PM (#15322457)
I host https://babbl.xyz on DO with a single $10 server for the socket and the web, and a $10 server for mysql. This can support around 500 active players.

I also did a more action asteroids clone (http://triangle-wars.com), and this would only support I guess 50 players on a $10 server.

The limiting factor seems to be the number of packets / sec that need to be broadcast to all players. If each player is changing state 2/sec, and you have 50 players, then the sever needs to relay 100 packets/sec...

Unlike some other comments in this thread, I didn't find JSON parsing to have any effect on performance.

Re:Building multiplayer games with Socket.io and HTML5 Canvas by synthmeat on Saturday September 23, 2017 @08:45AM (#15319504)
On DigitalOcean, I'm planning a following setup to launch:

1. $20 staging at all times, already live [1]

2. $20 static nginx

3. 3x$5 for socket servers on North America / Europe / Asia

4. $5 master server with WS connections to full mesh of socket servers / orchestration / future.

All Debian.

Have no clue what's Heroku like for that, but last time I've checked, it wasn't as good choice as DO was and is for me.

[1] WARNING: might break at any time, by choice or not http://staging.munchies.io

Re:Building multiplayer games with Socket.io and HTML5 Canvas by Entangled on Saturday September 23, 2017 @09:22AM (#15319605)
Thanks for the info. Good thing about turn-based games is that you send small packets to few players every few seconds, so they're not that intensive in memory/transfer. I hope having a thousand players in a room won't break my piggy bank. Later on I'll venture with chess, checkers and backgammon, all turn-based games.
Re:Building multiplayer games with Socket.io and HTML5 Canvas by synthmeat on Saturday September 23, 2017 @09:41AM (#15319678)
In this oldie of mine [1][2][3], I used protobuf (with no dictionary), and basically only used real-time information to show other player make moves, in otherwise turn-based/async profile game. It's currently solely on single $20 DO droplet, so I hope no HN effect kicks-in. :)

[1] https://bit.ly/ShowdownFacebook (FB+Flash)

[2] https://bit.ly/ShowdownApple (iOS)

[3] https://bit.ly/ShowdownGoogle (Android)

Re:Building multiplayer games with Socket.io and HTML5 Canvas by XCSme on Saturday September 23, 2017 @04:12PM (#15321476)
I tried playing that game but it's almost unplayable on my machine. The input lag seems to be around 200-250ms (so there seems to be no client prediction). Is this how was it supposed to be? Also it's not nice that you didn't mention the demo contains a crypto miner...
Re:Building multiplayer games with Socket.io and HTML5 Canvas by synthmeat on Saturday September 23, 2017 @05:54PM (#15321975)
I work on it most of this afternoon, including now. Maybe you hit it at wrong time. I use it a lot for load testing, that's mostly why it's live. It did came with a WARNING. :/ Works like a butter for me on EU <-> US path.

> Also it's not nice that you didn't mention the demo contains a crypto miner...

Hopefully it turned on only for Desktop + Chrome and didn't drain your battery? I simply didn't think it'd come as surprise, considering context of the discussion.

Re:Building multiplayer games with Socket.io and HTML5 Canvas by explodingcamera on Saturday September 23, 2017 @09:47AM (#15319697)
For that money you might as well get a beefy dedicated server that's multiple times as powerful and not have to worry about all these small servers.
Re:Building multiplayer games with Socket.io and HTML5 Canvas by dkersten on Monday September 25, 2017 @05:42AM (#15329057)
The bottleneck likely isn't the server here, but geolocation. He has 3 Digital Ocean socket servers in three regions. A single dedicated server will only be in one region. For latency-sensitive applications like realtime games, having servers close to your users is a must.
Re:Building multiplayer games with Socket.io and HTML5 Canvas by synthmeat on Saturday September 23, 2017 @09:57AM (#15319736)
But can I get 3 dedis in 3 data centers? I'd like to have that lest user experience suffers. I effectively get that with my setup.

Maybe one day when I need it, and certainly evaluating at any point.

Re:Building multiplayer games with Socket.io and HTML5 Canvas by zurn on Sunday September 24, 2017 @03:28AM (#15323728)
If you want to trade off simplicity for lower costs or lower latency, you can also use WebRTC data channels that do p2p communication between the players.