Giter Club home page Giter Club logo

Comments (9)

pllsner avatar pllsner commented on August 11, 2024 5

starting at line 2555 of [http://slither.io/s/game9c8ns.js] there are 10 references to lighter. i opened up developer tools in chrome. hit the {} to pretty the code, and starting from 2555 to 3244 is all the b.globalCompositeOperation = "lighter";.
some functions are to color the snakes, and others are to color the prey and food. Thanks for the link i shall check it out.
Glad i could help out. :)
Also..........this is the food drawing function in the game script.
line 1835 'for (j = 2.8; 18.8 >= j; j += 1) {
var cc = document.createElement("canvas")
, sz = Math.ceil(2.5 * j + 28);
cc.width = cc.height = sz; <---- controls how big the food is on the screen
ctx = cc.getContext("2d");
ctx.fillStyle = o.cs;
ctx.arc(sz / 2, sz / 2, .65 * j, 0, pi2);
ctx.shadowBlur = 12; <---------increases the blur diameter 3 or 4 times larger than the food dot..
ctx.shadowOffsetY = 0;
ctx.shadowColor = "#" + rs + gs + bs;
ctx.globalAlpha = .8; <------- reduces the intensity of the color
ctx.fill();
ctx.globalAlpha = 1;'
i removed the ctx.shadowBlur =12; and replace the globalAlpha = .8; to a '1' just for fun i replaced the ctx.arc function and drew stars. i replaced the prey dot with a pacman
untitled 1215
. :)
prey drawing function.
line 1896 'for (j = 3; 24 >= j; j += 1)
cc = document.createElement("canvas"),
sz = Math.ceil(2 * j + 38),
cc.width = cc.height = sz,
ctx = cc.getContext("2d"),
ctx.fillStyle = o.cs,
ctx.arc(sz / 2, sz / 2, j / 2, 0, pi2),
ctx.shadowBlur = 22,
ctx.shadowOffsetY = 0,
ctx.shadowColor = "#" + rs + gs + bs,
ctx.fill(),
ctx.fill(),
o.pr_imgs.push(cc),
o.pr_fws.push(sz),
o.pr_fhs.push(sz),
o.pr_fw2s.push(sz / 2),
o.pr_fh2s.push(sz / 2) '

from slither.io-bot.

ermiyaeskandary avatar ermiyaeskandary commented on August 11, 2024

@pllsner Great find! Is this in the slither.io-code ? If so, can you comment where ?

from slither.io-bot.

ermiyaeskandary avatar ermiyaeskandary commented on August 11, 2024

Linked to #236

from slither.io-bot.

tjorim avatar tjorim commented on August 11, 2024

Wow, great finding @pllsner !
Check this branch: https://github.com/ErmiyaEskandary/Slither.io-bot/tree/custom_oef

from slither.io-bot.

pllsner avatar pllsner commented on August 11, 2024

star and pacman i put into the script instead of ctx.arc function...
'// 5 pointed star
ctx.beginPath();
var starx= sz/2;
var stary= sz/2;
var starsize = j * 1.5;
var M_PI = Math.PI;
ctx.lineTo(starx, stary - starsize, starx + starsize * Math.sin(M_PI/5), stary + starsize * Math.cos(M_PI/5));
ctx.lineTo(starx + starsize * Math.sin(M_PI/5), stary + starsize * Math.cos(M_PI/5),starx - starsize * Math.cos(M_PI/10), stary - starsize * Math.sin(M_PI/10));
ctx.lineTo(starx - starsize * Math.cos(M_PI/10), stary - starsize * Math.sin(M_PI/10),starx + starsize * Math.cos(M_PI/10), stary - starsize * Math.sin(M_PI/10));
ctx.lineTo(starx + starsize * Math.cos(M_PI/10), stary - starsize * Math.sin(M_PI/10),starx - starsize * Math.sin(M_PI/5), stary + starsize * Math.cos(M_PI/5));
ctx.lineTo(starx - starsize * Math.sin(M_PI/5), stary + starsize * Math.cos(M_PI/5),starx, stary - starsize);
ctx.closePath();
// end of 5 ponted star

// pacman
ctx.beginPath();
ctx.arc(sz / 2, sz / 2, j / 3,Math.PI/7,-Math.PI/7,false);
ctx.lineTo(sz / 2-(j / 3)+2, sz / 2);
ctx.fill();
// end of pacman

// pacman ghost
var srx = (sz /2)-7;
var sry = (sz/2)+7;
ctx.beginPath();
ctx.moveTo(srx,sry);
ctx.lineTo(srx,sry-6);
ctx.bezierCurveTo(srx,sry-11,srx+2.5,sry-14,srx+7,sry-14);
ctx.bezierCurveTo(srx+11,sry-14,srx+14,sry-11,srx+14,sry-7);
ctx.lineTo(srx+14,sry);
ctx.lineTo(srx+11.5,sry-2.5);
ctx.lineTo(srx+9,sry);
ctx.lineTo(srx+7,sry-2.5);
ctx.lineTo(srx+4.5,sry);
ctx.lineTo(srx+2,sry-2.5);
ctx.lineTo(srx,sry);
ctx.fill();
// draw the eyes
ctx.fillStyle = "white";
ctx.beginPath();
ctx.moveTo(srx+4,sry-10);
ctx.bezierCurveTo(srx+2.5,sry-10,srx+2,sry-8.5,srx+2,sry-7.5);
ctx.bezierCurveTo(srx+2,sry-6.5,srx+2.5,sry-5,srx+4,sry-5);
ctx.bezierCurveTo(srx+4.5,sry-5,srx+6,sry-6.5,srx+6,sry-7.5);
ctx.bezierCurveTo(srx+6,sry-8.5,srx+6.5,sry-10,srx+4,sry-10);
ctx.moveTo(srx+10,sry-10);
ctx.bezierCurveTo(srx+8.5,sry-10,srx+8,sry-8.5,srx+8,sry-7.5);
ctx.bezierCurveTo(srx+8,sry-6.5,srx+8.2,sry-5,srx+10,sry-5);
ctx.bezierCurveTo(srx+11.5,sry-5,srx+12,sry-6.5,srx+12,sry-7.5);
ctx.bezierCurveTo(srx+12,sry-8.5,srx+11.5,sry-10,srx+10,sry-10);
ctx.fill();
// draw the pupils
ctx.fillStyle = "black";
ctx.beginPath();
ctx.arc(srx+9,sry-7,2,0,Math.PI_2,true);
ctx.fill();
ctx.beginPath();
ctx.arc(srx+3,sry-7,2,0,Math.PI_2,true);
ctx.fill();
// end of pacman ghost '

from slither.io-bot.

pllsner avatar pllsner commented on August 11, 2024

@tjorim thanks for implementing this so quickly. but i think you have the search and replace backwards.
typo correction
new_redraw_string = new_redraw_string.replace(/b.globalCompositeOperation="hard-light"/gi,
'b.globalCompositeOperation="lighter"');
should read...
new_redraw_string = new_redraw_string.replace(/b.globalCompositeOperation="lighter"/gi,
'b.globalCompositeOperation="hard-light"');

then the bot script will reduce the intensity of all the overlapping dots being turned into white glow. if you replace all the ctx.shadowBlur = ?? (whatever number) with a 0, or just remove shadowBlur, game will not have any blurring globally.

from slither.io-bot.

tjorim avatar tjorim commented on August 11, 2024

@pllsner Thanks for the heads-up! I appreciate your help 👍

from slither.io-bot.

pllsner avatar pllsner commented on August 11, 2024

you are very welcome @tjorim. Thank you

from slither.io-bot.

ChadSki avatar ChadSki commented on August 11, 2024

Fixed in #311.

from slither.io-bot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.