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
195 stars 124 forks source link

An application that creates a window and injects the botcode #302

Closed K00sKlust closed 8 years ago

K00sKlust commented 8 years ago

An application that creates a window and injects the botcode. It uses Electron.

CLAassistant commented 8 years ago

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

:white_check_mark: K00sKlust
:x: web-flow

tjorim commented 8 years ago

:+1: is my first thought, some future improvements could be an option to specify a bot-script...

But, wow @K00sKlust , this is really nice! Just spend a moment with it and looks good. I think this would make it a lot easier to test bots and this might not have the problem of poor performance when the window is not focussed (meaning tabs in Chrome).

Edit: when starting a bot, don't minimize the window or it stops.

Approved with PullApprove

clemens-tolboom commented 8 years ago

Some remarks.

Just ran it. Very nice! 👍

I see lot's of files added. Most seems to be bootstrap related so it's hard to find the 'real' code.

Why should we add this to our project and not just link to a separate repo?

I vote against adding but love to see a new repo containing only the botmanager parts (using bootstrap CDN)

clemens-tolboom commented 8 years ago

Running for an hour or so

electron main.js

(node:5974) Warning: Possible EventEmitter memory leak detected. 11 replyStats listeners added. Use emitter.setMaxListeners() to increase limit

and one of the games has a window freeze. Is it possible to run it with more debug info?

clemens-tolboom commented 8 years ago

Adding new variables should check on empty values

clemens-tolboom commented 8 years ago

Is uses http://electron.atom.io/

It looks awesome but can be in its own repo for sure. I'm happy to help and learn electron on the side :)

tjorim commented 8 years ago

I agree we could use a CDN for the bootstrap css and js. But I think it's best to just put this in the main repo, it's not that big (not even 1 MB). If we use the Bootstrap CDN, maybe jQuery CDN and Font Awesome CDN instead of the glyphicon files, there is not much added. (just 7 files I think)

K00sKlust commented 8 years ago

I changed the application to use a CDN instead of storing the files in the folder

K00sKlust commented 8 years ago

I vote against adding but love to see a new repo containing only the botmanager parts

I also think it is better to add this in a seperate repo, especially because of this:

having a separate repo makes issue tracking + contributing easier

.

Not sure what Update stats should do but nothing changes when clicked

That's pretty strange.. Works for me on windows 8. It should take the variables of the bots and add it to the table.. Can you tell me what os you're running it on?

(node:5974) Warning: Possible EventEmitter memory leak detected. 11 replyStats listeners added. Use emitter.setMaxListeners() to increase limit

I noticed that. It happens if you create many windows and update the stats. I will fix that soon.

tjorim commented 8 years ago

For me the 'Update stats'-button does update it. If we are gonna have multiple repo's, the maybe we should reconsider using a GitHub Organization.

PS: maybe, just for safety's sake, update the CDN links to support the SRI (integrity) hash.

CSS: <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> jQuery: <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script> JS: <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>

PPS: why not using jQuery 3.0? <script src="https://code.jquery.com/jquery-3.0.0.min.js" integrity="sha256-JmvOoLtYsmqlsWxa7mDSLMwa6dZ9rrIdtrrVYRnDRH0=" crossorigin="anonymous"></script>

clemens-tolboom commented 8 years ago

I am on Mac OS X.

The electron app of @K00sKlust is not specific to our bot. It exchanges some variables and injects a user script into a website. I think it would be great as completely separated app / repo. Hope I may participate :-)

ermiyaeskandary commented 8 years ago

I agree with @clemens-tolboom - this can totally be a new repository.

If we are gonna have multiple repo's, the maybe we should reconsider using a GitHub Organization.

Hmmm....

clemens-tolboom commented 8 years ago

@K00sKlust I cloned your repo and moved stuff into main directory

If you do not care for history I can recreate mine with just one commit or you can do it yourself :-)

The moment you create a new repo with you content I delete this repo on my behalf.

K00sKlust commented 8 years ago

Thanks. Done.