Slither.io-bot: Performance tweaks

Created on 30 May 2016  Â·  84Comments  Â·  Source: ErmiyaEskandary/Slither.io-bot

Maybe I'm wrong, but I think these tweaks make the bot run a bit better. A/S value should be set to around 20. Average score is around 3-4000, but that's because it often dies very early. When it gets above 3-4000, it often gets above 10000 as well. My record is 25489.

(removed wrong diff)

full file: http://users.notam02.no/~kjetism/bot.user.js

important in-progress bug

Most helpful comment

Good. But compared to master 1.2.1 I am pretty sure this version improves performance significantly on some computers, at least it stabilizes the performance. For instance, both @j-c-m and my tests have shown large differences in performance in 1.2.1 (and by "1.2.1" I also include the j-c-m branch which was tested here, which should behave the same).

I think it has something to do with the timers since I changed how that is done. It seemed like collision avoidance was not checked regularly on the master branch.

I hope this has been fixed in master now, and I'm looking forward to test it.

All 84 comments

Sorry, that was a diff against a preliminary version. Here:

--- bot.user.js 2016-05-30 16:20:37.738144318 +0200
+++ ../bot.user.js  2016-05-30 14:58:20.486463824 +0200
@@ -318,13 +318,13 @@
         currentFood: {},
         opt: {
             // target fps
-            targetFps: 30,
+            targetFps: 25,
             // size of arc for collisionAngles
             arcSize: Math.PI / 8,
             // radius multiple for circle intersects
-            radiusMult: 10,
+            radiusMult: 20,
             // food cluster size to trigger acceleration
-            foodAccelSz: 60,
+            foodAccelSz: 20,
             // maximum angle of food to trigger acceleration
             foodAccelDa:  Math.PI / 3,
             // how many frames per food check
@@ -348,6 +348,17 @@
         MID_Y: 0,
         MAP_R: 0,

+        scale: function(x,x1,x2,y1,y2){
+            return y1 + ( ((x-x1)*(y2-y1))
+                          /
+                          (x2-x1)
+                        );
+        },
+
+        getSnakeLength: function() {
+            return (Math.floor(150 * (window.fpsls[window.snake.sct] + window.snake.fam / window.fmlts[window.snake.sct] - 1) - 50) / 10);
+        },
+
         getSnakeWidth: function (sc) {
             if (sc === undefined) sc = window.snake.sc;
             return Math.round(sc * 29.0);
@@ -622,7 +633,7 @@
         checkCollision: function () {
             var headCircle = canvas.circle(
                 window.snake.xx, window.snake.yy,
-                bot.speedMult * bot.opt.radiusMult / 2 * bot.snakeRadius
+                bot.speedMult * bot.opt.radiusMult / 3 * bot.snakeRadius
             );

             var fullHeadCircle = canvas.circle(
@@ -660,7 +671,6 @@
                         bot.collisionPoints[i].radius
                     );

-
                     if (canvas.circleIntersect(fullHeadCircle, eHeadCircle)) {
                         if (window.snakes[bot.collisionPoints[i].snake].sp > 10) {
                             window.setAcceleration(1);
@@ -686,8 +696,11 @@
         // Round angle difference up to nearest foodRoundA degrees.
         // Round food up to nearest foodRoundsz, square for distance^2
         scoreFood: function (f) {
+            f.score = (160 * f.sz) / Math.sqrt(Math.sqrt(Math.sqrt(f.distance)));
+/*
             f.score = Math.pow(Math.ceil(f.sz / bot.opt.foodRoundSz) * bot.opt.foodRoundSz, 2) /
-                f.distance / (Math.ceil(f.da / bot.opt.foodRoundA) * bot.opt.foodRoundA);
+               (Math.ceil(f.da / bot.opt.foodRoundA) * bot.opt.foodRoundA);
+*/
         },

         computeFoodGoal: function () {
@@ -696,21 +709,23 @@
             var fi = 0;
             var sw = bot.snakeWidth;

-            for (var i = 0; i < window.foods.length && window.foods[i] !== null; i++) {
+            for (var i = 0; i < window.foods.length; i++) {
                 var a;
                 var da;
                 var distance;
                 var sang = window.snake.ehang;
                 var f = window.foods[i];

-                if (!f.eaten &&
+                if (f !== null && !f.eaten &&
                     !(
                         canvas.circleIntersect(
                             canvas.circle(f.xx, f.yy, 2),
                             bot.sidecircle_l) ||
                         canvas.circleIntersect(
                             canvas.circle(f.xx, f.yy, 2),
-                           bot.sidecircle_r))) {
+                                bot.sidecircle_r)
+                    )
+                   ) {

                     var cx = Math.round(Math.round(f.xx / sw) * sw);
                     var cy = Math.round(Math.round(f.yy / sw) * sw);
@@ -736,18 +751,25 @@
             foodClusters.forEach(bot.scoreFood);
             foodClusters.sort(bot.sortScore);

+            if (foodClusters.length > 0) {
+                bot.currentFood = foodClusters[0];
+                return;
+            }
+/*
             for (i = 0; i < foodClusters.length; i++) {
                 var aIndex = bot.getAngleIndex(foodClusters[i].a);
                 if (bot.collisionAngles[aIndex] === undefined ||
-                    (Math.sqrt(bot.collisionAngles[aIndex].distance) -
-                        bot.snakeRadius * bot.opt.radiusMult / 2 >
-                        Math.sqrt(foodClusters[i].distance) &&
-                        foodClusters[i].sz > bot.opt.foodSmallSz)
+                    foodClusters[i].score > 0 //|| 
+//                    (Math.sqrt(bot.collisionAngles[aIndex].distance) -
+  //                      bot.snakeRadius * bot.opt.radiusMult / 2 >
+    //                    Math.sqrt(foodClusters[i].distance) &&
+      //                  foodClusters[i].sz > bot.opt.foodSmallSz)
                 ) {
                     bot.currentFood = foodClusters[i];
                     return;
                 }
             }
+*/
             bot.currentFood = { x: bot.MID_X, y: bot.MID_Y };
         },

@@ -760,7 +782,8 @@
                 if (
                     bot.collisionAngles[aIndex] && bot.collisionAngles[aIndex].distance >
                     bot.currentFood.distance + bot.snakeWidth * bot.opt.radiusMult
-                    && bot.currentFood.da < bot.opt.foodAccelDa) {
+                    &&
+                        bot.currentFood.da < bot.opt.foodAccelDa) {
                     return 1;
                 }

@@ -788,7 +811,7 @@
             bot.sin = Math.sin(window.snake.ang);

             bot.speedMult = window.snake.sp / 5.78;
-            bot.snakeRadius = bot.getSnakeWidth() / 2;
+            bot.snakeRadius = bot.scale(bot.getSnakeLength(), 0, 16000,  400, 800) / 20;
             bot.snakeWidth = bot.getSnakeWidth();

             bot.sidecircle_r = canvas.circle(
@@ -818,17 +841,28 @@

             if (bot.checkCollision()) {
                 bot.lookForFood = false;
+                /*
                 if (bot.foodTimeout) {
                     window.clearTimeout(bot.foodTimeout);
                     bot.foodTimeout = window.setTimeout(
                         bot.foodTimer, 1000 / bot.opt.targetFps * bot.opt.foodFrames);
                 }
+                */
             } else {
                 bot.lookForFood = true;
+                if (window.playing && bot.lookForFood &&
+                    window.snake !== null && window.snake.alive_amt === 1) {
+                    bot.computeFoodGoal();
+                    window.goalCoordinates = bot.currentFood;
+                    canvas.setMouseCoordinates(canvas.mapToMouse(window.goalCoordinates));
+                }
+
+                /*
                 if (bot.foodTimeout === undefined) {
                     bot.foodTimeout = window.setTimeout(
                         bot.foodTimer, 1000 / bot.opt.targetFps * bot.opt.foodFrames);
                 }
+                */
                 window.setAcceleration(bot.foodAccel());
             }
         },

Can you please submit this as a PR, or post the full file? It makes it easier to test it out, thanks.

If you want add this to the bot, make a pull request from your forked project, and the collaborators here will test it out.

_I'm one of the testers, so once you get the PR from your forked project, I will test it out soon._

Can you please submit this as a PR, or post the full file? It makes it easier to test it out, thanks.

Hi, just paste the contents into a new file called diff.diff and execute
patch < diff.diff
in your tree.

If you want add this to the bot, make a pull request from your forked project, and the collaborators here will test it out.

No, it's not meant to be a pull request. I would have made a pull request if I wanted to make a pull request. It's just (ugly) tweaks, some may make sense, some may not. It's for people to look at and discuss and try, if you want.

@kmatheussen Apologies for my ignorance with GitHub, but how do you execute 'patch' on GitHub.com? Is there a special URL to visit?

Hi,

"patch" is a pogram you execute in the terminal:
https://en.wikipedia.org/wiki/Patch_%28Unix%29

On Mon, May 30, 2016 at 9:13 PM, Matt Duffin [email protected]
wrote:

@kmatheussen https://github.com/kmatheussen Apologies for my ignorance
with GitHub, but how do you execute 'patch' on GitHub.com? Is there a
special URL to visit?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ErmiyaEskandary/Slither.io-bot/issues/260#issuecomment-222542853,
or mute the thread
https://github.com/notifications/unsubscribe/ABF9pyeV01p3Uy1MZxlyXPA91ksA0PhTks5qGzbigaJpZM4Ip1aN
.

@kmatheussen Thanks, I'll look for a Windows equivalent.

Sorry for making it so inconvenient. Here is the full file:
http://users.notam02.no/~kjetism/bot.user.js

@kmatheussen I'm sure it's not inconvenient, I'm just not used to this workflow, but enjoying learning as I go! :+1:

@MattDuffin @kmatheussen Yeah - a file is better. You don't just dump diff logs into a issue - just saying :+1:

This is hard to read so an abstract

The first set (issue summary) contains 2 formatting changes (ignored). This is what I extracted

Change foodAccelSize from 40 to 20

Change food score calculation

   f.score = Math.pow(Math.ceil(f.sz / bot.opt.foodRoundSz) * bot.opt.foodRoundSz, 2) /
    (Math.ceil(f.da / bot.opt.foodRoundA) * bot.opt.foodRoundA);

into

  f.score = (160 * f.sz) / Math.sqrt(Math.sqrt(Math.sqrt(f.distance)));

Fix distance calculations

From

distance = 1;//Math.round(
  //canvas.getDistance2(cx, cy, window.snake.xx, window.snake.yy));

into

distance = Math.round(
  canvas.getDistance2(cx, cy, window.snake.xx, window.snake.yy));

Remove long food selection calculation

for (i = 0; i < foodClusters.length; i++) {
  var aIndex = bot.getAngleIndex(foodClusters[i].a);
  if (bot.collisionAngles[aIndex] === undefined ||
... some fuzzy changes
  ) {
    bot.currentFood = foodClusters[i];
    return;
  }
}

into

if (foodClusters.length > 0) {
  bot.currentFood = foodClusters[0];
  return;
}

I will proceed with https://github.com/ErmiyaEskandary/Slither.io-bot/issues/260#issuecomment-222503031 later on.

@kmatheussen

This is hard to read

This is hard to read

Seriously? You compain that diffs are hard to read? Sorry, but I don't want to spend time on this. I thought it was better to post this than not. Do what you want with it. Feel free to ask specific questions.

@kmatheussen We are able to work with this - it isn't impossible but it isn't the most ideal way.
What I would have done was make a fork, change it and then put a link to the diff between master and your fork - visually appealing and easier to work with...

I thought it was better to post this than not

Of course it is better but help us in the run up :+1:

You think diffs are hard to read?

You can work with them - but yes - I believe diffs are hard to read :-1: and I think they do as well :

post the full file? It makes it easier to test it out, thanks.

If you want add this to the bot, make a pull request from your forked project, and the collaborators here will test it out.

This is hard to read so an abstract

You don't just dump diff logs into a issue - just saying :+1:

@kmatheussen It's usually easier when Github.com is able to compare differences via two files that are the same instead of trying to find them yourself.

Which is the reason why I asked to make a PR from your forked project. Differences are much easier to see this way, than trying to find what has changed manually.

@kmatheussen Could you please explain how a targetFps of 25 is beneficial? In my own experiments, I've set targetFps to 50 on a pretty beefy machine, which results in quicker decisions being made. (Anything above 65-70ish tends to cause jerkiness.) I can't see how 25 would be better than 30, so please explain...

@MattDuffin Just a mistake. I tried setting fps 60 but found out it didn't help, and set it back to the original value. Or at least I thought I set it back. :-)

@kmatheussen Ah ok, thanks. I found the same when setting a high FPS value - anything above 65-70ish tends to cause jerkiness; I assume this is because you're then sending updates faster than the slither.io API can accept, and you then get sent corrections from the server that contradict the client state (not that I've tested this).

50 tends to be a good compromise, I've found.

I originally tried to remove all the timing stuff, but gave up for some reason. Why is there a timer? Is it to avoid using too much CPU when looking for food? In case that is the reason, it might be better to randomly select food to look for until we have spent more than approx 10ms or so. The important thing is to find clusters as soon as possible, and those will be found if we just look randomly for food.

A better algorithm might be something like this:

for(int startpos = 0 ; startpos < 5 ; startpos++){
  for(pos = startpos ; pos < foods.length ; food+= 5){
   var food = foods[pos];
    ...
  }
  if (spent_too_much_time)
    break;
}

I'm enjoying this discussion. @kmatheussen, I'm sorry if I made you feel uncomfortable with my ignorance of diffs, that wasn't my intention.

:-1:

@j-c-m Why? What's your reason?

No problem, I didn't perceive you as ignorant, you just wanted to try the file. I should have posted a link to the file in the first post, which was a bit arrogant since it doesn't take much time to do that.

These changes resulted in -1800 average score.

@j-c-m Can you share more number? Maximum and average score for these changes, and master? And how many times have you played?

~10 hours worth of games ~70 games each, -1800 average score.

Do you understand what logic you removed?

What where the top 5 scores for the sessions?

Do you understand what logic you removed?

I removed code that caused the snake not to hunt clusters if it was behind it,
and I adjusted the radius multiplier to be based on the snake length instead of the snake width
since I observed that you manually had to increase the radius multiplier the longer
the snake became.

FYI we're discussing standardizing how we test the effectiveness of the bot over here: #265

Just run 6 tests of each.

Master: (avg: 2040)
1. 7715
2. 2849
3. 959
4. 435
5. 156
6. 124

This version: (avg. 5018)
1. 17445
2. 6411
3. 3931
4. 1219
5. 771
6. 331

These are not that many tests, but the numbers are consistent with what I have seen earlier. Master have trouble getting above 5000, but when this version gets above 5000, it often reach 15000 as well.

@j-c-m Was the screen visible when you ran those tests (i.e you weren't running slither in the background)? It seems like the snake dies quite early unless the game is visible on the screen.

Also, did you use the default A/S values? And what where the average results?

Other things that can explain the differences are 1. Time of day the tests where run. In the evening, more people play than in the morning. (I don't know this, I just speculate). 2. Computer speed. It seems like my very warm laptop gets higher score when it's cooler (and faster).

Is it possible your laptop is very slow and cant keep up?

No, because the CPU usage between master and this version should be insignificant. Why don't you provide more data about your tests?

I provided all the data I have. I deleted the screenshots I had kept maybe mistakenly now, but the difference was so obvious it was not even worth further evaluation.

You don't even remember average scores? Have you tested master any other time? Do you have average score for master from another test?

In fact I probably have 1000s of test games, as when I was tweaking the code I would let 3-4 bots run for 10+ hours generating about 100 games a piece.

But still you don't know any average score?

I'm running some tests my desktop now, which is a lot faster. The increased performance is very obvious on my laptop, so this is indeed strange, although I'm not sure what to make of your claims when you have almost no data to provide.

Since you are so persistent in wanting to continue to argue I am not going to just make up numbers I don't have. I'll run the tests again for 10 hours and not delete the screenshots. I am telling you there is something very wrong with your configuration if the main bot is averaging 2000.

The last bit of recorded data is from https://github.com/j-c-m/Slither.io-bot/blob/master/bot.user.js , @ raidus 10, and this should be the same as the main bot code. The average score was 8912 over 65 games w/ a highscore of 37492.

This is not an argue! The data and observations I have shown are real, and I believe your data is real as well. Obviously, something is not working as it should in master. I think it could be the getWidth() function that returns different values on different computers since I don't use getWidth() in this version.

I've just ran 7 tests of master on my desktop, and here are the numbers:

1. 978
2. 476
3. 736
4. 420
5. 221
6. 120
7. 79
Average: 491.

I'm testing this version now, and so far the numbers are in 5-15000 range. In other words, the performance of master differs enormously between computers, while this version is consistent.

My laptop (average score 2000):
Intel GFX, Linux, Chrome 50.0.2661.94 (64-bit) (not sure about gfx driver version)

My desktop (average score 491):
Nnidia GFX driver 361.26, Linux, Chrome 51 (64-bit).

Something is wrong, I am 3 games in on master version with 7900 average.

@kmatheussen what is your radius set to?

@chadski
Kmatheussen's radius is 20, j-c-m's 10.

I was assuming he was running the main bot @ 10 (the default)

4 hours into the test:
@j-c-m bot: 7002 avg
@kmatheussen bot: 5175
@ErmiyaEskandary bot: 3730
@j-c-m bot 1.5x big circle: 7172

My apologies @kmatheussen I was comparing @j-c-m bot vs your changes, because it was only a few days ago that it replaced the main bot. I am shocked at how badly the main bot has been degraded.

Degraded in what way? What commits ?

There has been no major change in the bot logic, and of course, _main bot should get the lowest and @j-c-m 's bot the highest...._

Following @j-c-m's gitter comment on #249, @clemens-tolboom are these two statements definitely logically equivalent under all valid input values?

if (circle1.x + bothRadii > circle2.x &&
                circle1.y + bothRadii > circle2.y &&
                circle1.x < circle2.x + bothRadii &&
                circle1.y < circle2.y + bothRadii)

if ((circle1.x - circle2.x) + bothRadii > 0 &&
                (circle1.y - circle2.y) + bothRadii > 0 &&
                (circle1.x - circle2.x) - bothRadii < 0 &&
                (circle1.y - circle2.y) - bothRadii < 0)

(Substituting in dx and dy variable definitions.) It's been a long time since I've done Boolean algebra, and I'd prefer if someone could confirm their parity so I don't have to dig out my textbooks! :stuck_out_tongue_closed_eyes:

Here are three issues I've seen with master:

  1. You have to increase radius manually as the snake gets longer (at least I think so)
  2. The snake movement freezes now and then, causing it to crash into things (again, I might be imagine it, but if not I guess this is the thing, maybe it's something to do with the timers). This version does not use it's own food timer, just the 'go' timer which runs both collision avoidance and food hunting.
  3. When there are clusters behind the snake, the snake seems to ignore them.

@kmatheussen Thanks :+1:
1 -> I don't increase the radius that much so I can't say that it's true
2 -> That doesn't happen for me. Does it happen for other people ? But then it may be related to specs, internet speed, server and ...
3 -> We do currently prioritize collision avoidance but can we do it in a way ? How does your code change that? Is the collision avoidance worsened? Results?

Can you also confirm @j-c-m 's results above ?
Is it in overall the same as his ?

@MattDuffin It must be correct - there's no difference evident and it looks alright, which is why I approved it. Have you seen any changes ? Its just substituting and shouldn't cause any problems; just refactoring.

@ErmiyaEskandary I'm satisfied if you're happy they're logically the same.

I went through @j-c-m's current bot and ours line by line, and I can't see any differences that would cause such a significant performance drop.

The only thing I would say is if you have custom options in localStorage to clear them out before testing.

options

@kmatheussen -
2 -> Happens for me on my MacBook but not on my desktop PC. But then again, it happens on my MacBook when the bot isn't running, so...

@MattDuffin

I went through @j-c-m's current bot and ours line by line, and I can't see any differences that would cause such a significant performance drop.

Precisely. What could be causing it ?

There's also the possibility that the type of servers slither.io sends us to is calculated in a way that causes the results to differ seemingly non-randomly. In other words that the bots are very similar, and that the differences in numbers we see are mainly caused by differences in the servers we are connected to.

The freezes we sometimes see are not unlikely to be caused by the server not replying fast enough. These bad servers might be what is causing the results to differ so much.

Bad servers can not affect scores that much. Can they?

Don't know. We might just be like people doing medicine 200 years ago, something appear to work, other things don't. In reality, nothing works. :-)

Currently testing the bot before fbf8763 - it might have caused a "bot score drop".
If others can test the current bot in master with a version of the bot before fbf8763 and feedback results for 10 games played by each, it would help alot.
git checkout fbf8763 - bot before the commit

Ok so I've tested the logic of #249 with the following:

var oldAlgo = function(circle1, circle2, bothRadii) { if (circle1.x + bothRadii > circle2.x && circle1.y + bothRadii > circle2.y && circle1.x < circle2.x + bothRadii && circle1.y < circle2.y + bothRadii) { return true; } else { return false; } }; var newAlgo = function(circle1, circle2, bothRadii) { if ((circle1.x - circle2.x) + bothRadii > 0 && (circle1.y - circle2.y) + bothRadii > 0 && (circle1.x - circle2.x) - bothRadii < 0 && (circle1.y - circle2.y) - bothRadii < 0) { return true; } else { return false; } }; var runs = 0; while (runs < 1000000) { ++runs; var circle1 = {x: Math.floor(Math.random() * 320000), y: Math.floor(Math.random() * 320000)}; var circle2 = {x: Math.floor(Math.random() * 320000), y: Math.floor(Math.random() * 320000)}; var bothRadii = Math.floor(Math.random() * 320000); if (oldAlgo(circle1, circle2, bothRadii) !== newAlgo(circle1, circle2, bothRadii)) { console.error('Bad result on: ' + JSON.stringify(circle1) + ', ' + JSON.stringify(circle2) + ', ' + bothRadii); break; } }; console.log(runs + ' trials run');

Sample output:

Params: {"x":85464,"y":266016}, {"x":83959,"y":148883}, 220878, results: true, true
VM3124:1 Params: {"x":275784,"y":39520}, {"x":277337,"y":214693}, 52872, results: false, false
VM3124:1 Params: {"x":187903,"y":47027}, {"x":290296,"y":249531}, 147127, results: false, false
VM3124:1 Params: {"x":70280,"y":86450}, {"x":25156,"y":122920}, 41979, results: false, false
VM3124:1 Params: {"x":314754,"y":39094}, {"x":53993,"y":289803}, 84303, results: false, false
VM3124:1 Params: {"x":118378,"y":38864}, {"x":130877,"y":86839}, 273993, results: true, true
VM3124:1 Params: {"x":8611,"y":73428}, {"x":131595,"y":271581}, 234818, results: true, true
VM3124:1 Params: {"x":64632,"y":232623}, {"x":270681,"y":258911}, 286625, results: true, true
VM3124:1 Params: {"x":186549,"y":247697}, {"x":150970,"y":610}, 151474, results: false, false
VM3124:1 Params: {"x":61105,"y":1107}, {"x":222385,"y":51683}, 118184, results: false, false
VM3124:1 10 trials run

One million trials of each algorithm and they both agreed each time...

So there isn't any difference in the function...

Can anyone confirm @j-c-m 's results ? Is there a average score drop between the main bot in this repo and @j-c-m 's bot? Something wrong here - might be just what @kmatheussen said, which is the main reason for setting up a consistent "playground" for testing the bot.

Signing off.

Here are some numbers from some test runs. I've tried to switch bot as often as possible to avoid one of them getting into a good steam, if such exists.

Sessions:

1.
--
j-c-m:       10435
master:      832
master, old: 80, 10743, 50

2.
--
j-c-m:      5243, 623, 219, 167
master:     3822
mster, old: 330, 159, 20445, 1096, 89, 445

3.
--
master:      2289, 1076, 275
j-c-m:       4591, 612
master, old: 769, 12006

4.
--
master:      9843,
j-c-m:       2557,
master, old: 14060, 560, 87

5.
--
j-c-m:       24473, 1606, 1289, 349
master:      11049, 12488, 197, 10437

----------------------------

Average:

j-c-m:      4347.0
master:     5230.8
master-old: 4351.0

----------------------------

Max:
j-c-m:      24473
master:     12488
master-old: 20445

@kmatheussen Thanks for doing these tests, but I don't think we can read too much into them since the j-c-m, master and master-old bots have only played 12, 10 and 14 games respectively.

I'm just contributing. The tests would have been more relevant if I had monitored it and filtered out the results that was caused by someone circling you. That's just bad luck I guess. Also, outliers such as numbers below 300 should be removed, and numbers above 15000 could probably be rounded down to 15000, since this happens so seldom that we don't know that well what causes death above 150000.

I wasn't moaning, just sounding a note of caution. Personally I'm tempted to accept it due to our bot's highest average score, but that wouldn't be very scientific of me :tongue: ...

I personally said 10 tests, just to have as a backup @MattDuffin - :+1:

for 10 games played by each

@kmatheussen Thanks alot - it confirms my results. I also got a better average with the current bot but a higher max score on the old and @j-c-m .
IMO a higher average score is better than a higher max score as it evens out throughout time and the highest scores and normally anomalies in the data.
Thanks again :)

Updated test numbers, they will continue to run. 3,5-10 games is not enough.

l->r : main bot, j-c-m, @kmatheussen, j-c-m with 1.5x big enemy head circle (similar to bigger circle in @kmatheussen)

image

Results of long test:

main / j-c-m / km

image

The statistics should contain

  • position reached
  • #players
  • preferably the score of all other players but we probably only could add top 10.
  • server IP
    as in "It's harder to reach a highscore in a crowdy slow server with big snakes"

This morning I entered (as human) an arena with ~300 players with #1 having ~900 (nine hundred) point. It took me not long to become #1.

@kmatheussen @j-c-m

  1. The snake movement freezes now and then, causing it to crash into things

Would it help to provide both the average of three ping results from SpeedTest.net and respective average jitter results from PingTest.net ?

Ive created PR #286 in preparation of https://github.com/ErmiyaEskandary/Slither.io-bot/issues/260#issuecomment-223197790

Performance now has improved and has been confirmed by the tests we have been doing.

@kmatheussen @Salvationdk is currently testing different radiuses...

Me and others have tested your changes and they cause a degrade in the bot's efficiency. :(

Good. But compared to master 1.2.1 I am pretty sure this version improves performance significantly on some computers, at least it stabilizes the performance. For instance, both @j-c-m and my tests have shown large differences in performance in 1.2.1 (and by "1.2.1" I also include the j-c-m branch which was tested here, which should behave the same).

I think it has something to do with the timers since I changed how that is done. It seemed like collision avoidance was not checked regularly on the master branch.

I hope this has been fixed in master now, and I'm looking forward to test it.

@kmatheussen the newest commits have fixed the performance issue. Be sure to test and post results if you can! :+1:

I wonder if your changes rebased onto master perform any better? Two performance fixes are better than one!

@ChadSki From my tests, and @j-c-m 's these tests don't improve it. But I tested before the new master. Maybe @kmatheussen or someone else can share results - master vs @kmatheussen 's changes ?

AFAIK, nobody rebased kmatheussen's changes on top of our current master, so you didn't test what I mean.

Yeah @ChadSki

But I tested before the new master.

I think we can close this bug as performance problems have been resolved, but I'm still interested in @kmatheussen 's changes if they'll help improve the bot further.

In #286 I've added game duration to the scores.

I still think more data could be useful but then we should be able to post all our test results into ie a Google sheet.

I've tested master against this version for a while now, and there's little doubt that master performs much worse. I guess it's because master takes more chances, and my computer performs badly (for some reason) and doesn't update as often as it should and therefore the snake is killed much sooner in master.

Here's an idea: How about measuring how long time it is since last time we got data from the server, and then increase/decrease the radius based on this measurement?

Which commits are you testing?

master (b969a83) and what's your commit?

I can run tests of my own, and I also want to look at your diff.

Oh, that's not master, that's develop. @ErmiyaEskandary made develop the default branch you see when visiting the git repo.

That's fine though; I'll run a test versus your changes and see what's up.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jellybabies picture jellybabies  Â·  7Comments

bernardojedi picture bernardojedi  Â·  4Comments

Drflash55 picture Drflash55  Â·  4Comments

K00sKlust picture K00sKlust  Â·  10Comments

Tomboman picture Tomboman  Â·  5Comments