owenashurst / agar.io-clone

Agar.io clone written with Socket.IO and HTML5 canvas
MIT License
2.9k stars 1.14k forks source link

Replace Socket.IO with a lighter-weight alternative #188

Open jniles opened 9 years ago

jniles commented 9 years ago

This has been mentioned before, but I'd like to get a public poll. Socket.IO is a bit overkill for the current project scope. My vote is for the ws. In particular, look at the comparisons between frameworks here and here.

Has anyone had experience with other frameworks more suitable to agar.io-clone? Can we decide on a new alternative to put together some migration code?

JoeMattie commented 9 years ago

It needs to be done, no question about it. This is probably the most pressing issue preventing a game like this from scaling (with implementation of quadtrees or similar partitioning of players and entities being a close second).

I found some good info on the subject here:

http://buildnewgames.com/optimizing-websockets-bandwidth/

c-hew commented 9 years ago

I agree that WS is a better option. It solves many of the laggy issues!

keon commented 9 years ago

how about sock.js? I am planning on change to sock.js on my fork

jniles commented 9 years ago

@keonkim , did you give sock.js a try? My concern is that sockjs doesn't use raw websockets and if we are going to the trouble of re-writing, we should be the lightest and best possible.

keithagroves commented 9 years ago

The Agar.io server implementation Ogar is using ws. Would that work well enough?

igorantun commented 9 years ago

I think so. ws is great.

keon commented 9 years ago

@jniles I haven't touched on it yet, I also think going for ws is better choice though.

jniles commented 9 years ago

Sweet. I propose that refactoring efforts focus on making sure we have testable components and test cases for those components, then we can swap out bits and see how it goes. It seems the consensus is for ws, so when the time comes we'll use that library.

abalabahaha commented 9 years ago

I seem to have gotten a socket.io -> einaros/ws transition on one of my branches, still needs a lot of testing though.

On a side note, every website that uses the current tagline would be wrong if we were to switch off socket.io.