OgarProject / Ogar

An open source Agar.io server implementation, written with Node.js.
Other
718 stars 821 forks source link

LOVE IT but suggestions... #281

Closed ghost closed 8 years ago

ghost commented 9 years ago

I have a suggestion for this. It is to add the ability to have more than one food size at the same time. I see this on a website called: petridish.pw. In hardcore ffa/exp, Those servers have food sizes ranging from 1-50 all on the same server. That would be a cool feature in opinion.

Luka967 commented 9 years ago

Simple to do, but almost all of us want to stick to one size.

ghost commented 9 years ago

ok then. But if it is simple can you tell me how to do that?

Luka967 commented 9 years ago

In GameServer.js, find this line:

GameServer.prototype.spawnFood = function() {

then edit the next line which goes

var f = new Entity.Food(this.getNextNodeId(), null, this.getRandomPosition(), this.config.foodMass);

into

var f = new Entity.Food(this.getNextNodeId(), null, this.getRandomPosition(), this.config.foodMass * Math.random() >> 0);

Math.random() function will generate a double from 0 to 1, and accompanied with a multiplier, ex. 50, will generate you a number from 0 to 50. >> 0 will round the number.

ghost commented 9 years ago

thank you :)