Live data from Hacker News

Agar.io

agar.io

71–80 of 238 posts

Re: Agar.io

#72
post #69

While looking at the js source code and modifying it a bit I was able to program keys W A S D to move my cell around. But it doesn't work after a bit. The protocol is send the position of the mouse (which corresponds to the cell) to the server and then it calculates change over time to get a velocity. So if I move too much it starts going forever in one direction. Although this is using a quad tree implementation for…

Only sending input? That's great networking design!

Re: Agar.io

#73
post #69

While looking at the js source code and modifying it a bit I was able to program keys W A S D to move my cell around. But it doesn't work after a bit. The protocol is send the position of the mouse (which corresponds to the cell) to the server and then it calculates change over time to get a velocity. So if I move too much it starts going forever in one direction. Although this is using a quad tree implementation for…

Only sending input? That's great networking design!

Yeah I know right. No wonder this game crashes. When you press the space bar it sends a message, when you move your mouse it sends a message. The message is in function U() (its the Y position, X position and some other value I've confirmed its not magnitude don't really know what it does). As soon as the connection is established it starts sending, although if you don't move the mouse it doesn't send a message. Then there is a message to update the players view of the game.

Re: Agar.io

#74

Earlier quoted context omitted.

Not sure I agree with your characterisation of women as grave and prudish. Surely human beings of all creeds can see the funny side of being absorbed by a giant circle labeled "COCK". Or maybe it's just me.

I think it's fucking hilarious and that people should not try their hardest to be offended at every chance.

I'm not offended but I'd like to show it to my child.

Re: Agar.io

#76

While having a quick look at the sources, I learned about the quadtree: http://de.wikipedia.org/wiki/Quadtree . agar.io is using this implementation: https://github.com/silflow/quadtree-javascript to optimize collision detection performance.

Quad trees are popular because they're fairly easy to understand and implement, but they don't actually perform that well in practice for broadphase. (Its really more for LOD)

If you want a tree that does perform well and is similarly easy to understand, a dynamic AABB tree is much better.

Re: Agar.io

#77
post #73

Earlier quoted context omitted.

Only sending input? That's great networking design!

Yeah I know right. No wonder this game crashes. When you press the space bar it sends a message, when you move your mouse it sends a message. The message is in function U() (its the Y position, X position and some other value I've confirmed its not magnitude don't really know what it does). As soon as the connection is established it starts sending, although if you don't move the mouse it doesn't send a message. Then…

I wasn't sarcastic! It's actually very good practice...

Re: Agar.io

#78
post #73

Earlier quoted context omitted.

Yeah I know right. No wonder this game crashes. When you press the space bar it sends a message, when you move your mouse it sends a message. The message is in function U() (its the Y position, X position and some other value I've confirmed its not magnitude don't really know what it does). As soon as the connection is established it starts sending, although if you don't move the mouse it doesn't send a message. Then…

I wasn't sarcastic! It's actually very good practice...

But wouldn't it be more efficient to calculate the velocity on the client side then only send changes to the vector?

Re: Agar.io

#79
post #20

What is the tech stack of this game?

Dev here. Client side is javascript, no frameworks or anything. Server side is C++ with libuv for abstracting networking (I test it on windows but the actual servers are linux).

Re: Agar.io

#80
post #78

Earlier quoted context omitted.

I wasn't sarcastic! It's actually very good practice...

But wouldn't it be more efficient to calculate the velocity on the client side then only send changes to the vector?

It may be more efficient. But sometimes you should not trust the client ;)
Post reply on HN