ermiyaeskandary / Slither.io-bot

Just for fun and AI. Written in Javascript, this is a project which the aim is to make a computer play against humans inside a human-driven game, which is in this case Slither.io. The goal is simple - try and make the snake live and get as long as possible.
Mozilla Public License 2.0
193 stars 124 forks source link

improving the standard settings (rapid growth of snake) #290

Closed Seple closed 8 years ago

Seple commented 8 years ago

Please if this option is possible to add settings standard ?

foodAccelSize ---> They should be scaled to the size of the snake

Example: radiusMult 12, + foodAccelSize: 20, + foodRoundSize : 1, ---> to 5,000 points radiusMult 12, + foodAccelSize: 40, + foodRoundSize : 1, ---> to 10,000 points radiusMult 12, + foodAccelSize: 60, + foodRoundSize: 10, ---> to more 10,000 points

Please test settings

https://files.gitter.im/ErmiyaEskandary/Slither.io-bot/K8Ri/2h.jpg <--- after 2 hours

https://files.gitter.im/ErmiyaEskandary/Slither.io-bot/TQth/3.5h.jpg <--- after 3,5 hours

My Bot has better results :+1:

Have a nice day!

ermiyaeskandary commented 8 years ago

@Seple Please test the current develop bot head to head with another develop bot with your changes for at least 30 games and then post back results - also in the wiki how to test

clemens-tolboom commented 8 years ago

@Seple what do you mean higher score? Each run I did was so different from expectations :(

I tried to read your table.

radiusMult 12, + foodAccelSize: 20, + foodRoundSize : 1, ---> to 5,000 points radiusMult 12, + foodAccelSize: 40, + foodRoundSize : 1, ---> to 10,000 points radiusMult 12, + foodAccelSize: 60, + foodRoundSize: 10, ---> to more 10,000 points

But there is no size of snake with that. How did you test these?

Seple commented 8 years ago

The lowest scores go up (rapid growth of snake) = average results to the top when setting

radiusMult 12, + foodAccelSize: 20, + foodRoundSize : 1, ---> to 10,000 points

above (more) 10,000 points returns (switch) standard setings

radiusMult 12, + foodAccelSize: 60, + foodRoundSize: 10, ---> to more 10,000 points

foodAccelSize + foodRoundSize ---> They should be scaled to the size of the snake (setting grow along with the growth of snake)

Very please create a code for testing

clemens-tolboom commented 8 years ago

The length seems to be

Math.floor(15 * (fpsls[snake.sct] + snake.fam / fmlts[snake.sct] - 1) - 5) / 1

of which none is documented.

I came up with code below added to #275 / #292 ... I left out radiusMult as that is a constant so you need to set that through the UI yourself.

                    getPriority: function() {
                        // Lower limit of snakeLength criteria used below
                        var lengthGroup;
                        var snakeLength = 0;

                        snakeLength = Math.floor(15 * (fpsls[snake.sct] + snake.fam / fmlts[snake.sct] - 1) - 5) / 1;
                        if (snakeLength == 0) {
                            return 0;
                        }
                        var opt = bot.opt;

                        if (snakeLength < 5000) {
                            lengthGroup = 0;

                            opt.foodAccelSize = 20;
                            opt.foodRoundSize = 1;
                        } else if ( snakeLength < 10000) {
                            lengthGroup = 5000;

                            opt.foodAccelSize = 40;
                            opt.foodRoundSize = 5;
                        } else {
                            lengthGroup = 10000;

                            opt.foodAccelSize = 60;
                            opt.foodRoundSize = 10;
                        }
                        if (lengthGroup != this.lastLengthGroup) {
                            lengthGroup != this.lastLengthGroup;
                            // No need to update UI yet.
                            // userInterface.onPrefChange();
                        }

                        return 0;
                    },

@seple you can test though branch mentioned in #275

clemens-tolboom commented 8 years ago

Make sure to enable the task SnakeParamsBySize

Seple commented 8 years ago

Perfect repaired fast growth of a snake!

Thank You very much! :heart:

clemens-tolboom commented 8 years ago

I'm waiting for your test report :p

Seple commented 8 years ago

Tempting opportunity (possiblity) to merge option: "HuntForPrey"

With the condition: Only fast pursuit in distance red circle near the head when it is not crowded by other snakes around.

Seple commented 8 years ago

My test after 5 hours, unfortunately I do not have possibilities more time to test :/

http://s33.postimg.org/s24e0j0un/test.jpg

My test after 8 hours (another computer - laptop). http://s33.postimg.org/ozbwg7qfj/test2.jpg

Comparing the results above is visible improvement

code:

var customBotOptions = {
targetFps: 40,
radiusMult: 12,
... };

Code f3e060086b6f3e1b1d21e40a4fc4eacfcb8db4fa Please change:

0 - 5,000 points opt.foodAccelSize = 20 opt.foodRoundSize = 1;

5,000 - 10,000 points opt.foodAccelSize = 40; opt.foodRoundSize = 1;

10,000 - more points opt.foodAccelSize = 60; opt.foodRoundSize = 5;

Better :)

clemens-tolboom commented 8 years ago

@Seple please report back in #275 or PR #292 with your preferred settings. And then no code dumps aka find the differences :-(

I annotated your code in https://github.com/ErmiyaEskandary/Slither.io-bot/issues/290#issuecomment-225414038 with ```javascript so it color renders

clemens-tolboom commented 8 years ago

Much better ... committed

clemens-tolboom commented 8 years ago

Shall we close this as PR #292 hazz da code

Seple commented 8 years ago

Possible merge the option: "HuntForPrey" ?

When time the function will be added in the standard code : develop or master?

clemens-tolboom commented 8 years ago

Possible merge the option: "HuntForPrey" ?

What do you mean by merge the option?

When time the function will be added in the standard code : develop or master?

First step PR must be voted for. Then it ends in develop and next release into master. Unfortunately the performance metrics do not help.

Seple commented 8 years ago

What do you mean by merge the option?

Option to merge into one HuntForPrey + SnakeParamsBySize = Rapid growth hose

HuntForPrey ---> 1,000 points. With the condition:

First step PR must be voted for. Then it ends in develop and next release into master. Unfortunately the performance metrics do not help.

@ErmiyaEskandary This idea ( Better Settings and Defaults) can be added separately?

clemens-tolboom commented 8 years ago

I've updated HuntForPrey in #275 + #292.

I stop following this issue as my PR is my only interest now. (Kinda sorry)

@Seple we showed your idea is easily implemented by #275

Seple commented 8 years ago

Again thank you very much and sorry for the problem ;)

clemens-tolboom commented 8 years ago

:)

Seple commented 8 years ago

Fixed Please close the topic