Skip to content
This repository has been archived by the owner on Nov 27, 2020. It is now read-only.

What is this Magic number? #43

Closed
Luchanso opened this issue Jun 22, 2015 · 8 comments
Closed

What is this Magic number? #43

Luchanso opened this issue Jun 22, 2015 · 8 comments

Comments

@Luchanso
Copy link

https://github.com/forairan/Ogar/blob/master/src/entity/Cell.js#L171

var move = collisionDist - dist + 5;

Why you use this 5?

@maixuanhan
Copy link
Contributor

Code is changed. Please edit your question or should we close this topic?

@Ephemerality
Copy link
Contributor

It's now on PlayerCell.js line 89. The 5 is the amount that a cell is pushed when your own cells are colliding. I suppose a config/const value could be put in somewhere for it, I'll leave that up to vram, but you start seeing some weird behaviour if it's much higher than 5 (for a lot of fun, try 100)!

@TheEpTic
Copy link

TheEpTic commented Jul 7, 2015

A lot people on our forums hate the "pushing" feature of the game. People use it as an advantage on the teams mode allowing them to cheat for the other team.

@Ephemerality
Copy link
Contributor

After playing around a little, I think part of the '5' being there was because without it, your cells squish together a little bit.
I checked out the Teams.js and I don't think the pushing in teams mode is really intended to work the way it does. The stuff starting at line 114 is there to prevent the cells from overlapping. I tried pushing a smaller cell with a single much larger one and it moved a tiny bit, only a few pixels after pushing for a while. However, when I split into many cells and moved around the other one a bunch, it moved unpredictably. So I think there's something weird going on there that needs to get looked into further.

@vram4
Copy link
Contributor

vram4 commented Jul 7, 2015

@Ephemerality Were you using the client i gave you? That one doesnt have the movement smoothing that the default client has, hence the jiggly movement.

@Ephemerality
Copy link
Contributor

Nope, vanilla.

@maixuanhan
Copy link
Contributor

@Jackster35 : my colleagues hate that also (that was the reason I make TeamX mode). They also hate moving virus, they like splitting virus (so, I'll tweak TeamX mode so that moving virus can be configurable (by code, not ini file) in that mode). Thanks God! they love 'eating teammates' of that mode. 😹

Comeback about team cell collision, I think vanilla has changed lately. Weeks ago, I played on vanilla and also crazy about 'pushing thing'. Yesterday, it changed. The new cell will move to its target position. If that position is inside a team cell, it will be pushed to outside of that cell. Direction of second moving is vector AB where A is the center of bigger cell, B is the center of smaller cell. (If A is same to B, any direction makes sense). After the second moving, if it collides with other cell, then it starts pushing. Same situation if the new cell overlaps a smaller cell, but now, the small cell will be moved. In other word, smaller cell of a overlap case will be moved outside the bigger one.

@ghost
Copy link

ghost commented Jan 1, 2016

it is nowhere now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants