Giter VIP home page Giter VIP logo

showdownbot's Introduction

Percymon: A Pokemon Showdown AI

This project was built for an old version of Pokemon Showdown and won't work with newer versions. You might have luck checking out some of the forks.

Screenshot

Percymon is a Pokemon battling AI that plays matches on Pokemon Showdown. Percymon is built using Node.js. Check out the full project write-up here.

Setting up the repository

To set up the server, you need to first install dependencies:

npm install

In order to actually play games you must create an account on Pokemon Showdown. Once the log-in information has been obtained, you need to create an account.json file containing information. The format of account.json is as follows:

{
    "username" : "sillybot",
    "password": "arbitrary password",
    "message" : "gl hf"
}

The message field indicates the message that will be sent when the bot first connects to the game.

Finally, to start the server, issue the following command:

node bot.js

By default, the server searches for unranked random battles when the option is toggled in the web console. There are several command line options that can be supplied:

--console: Only start the web console, not the game playing bot.
--host [url]: The websocket endpoint of the host to try to connect to. Default: http://sim.smogon.com:8000/showdown
--port [port]: The port on which to serve the web console. Default: 3000
--ranked: Challenge on the ranked league.
--net [action]: Neural network configurations. 'create' - generate a new network. 'update' - use and modify existing network. 'use' - use, but don't modify network. 'none' - use hardcoded weights. Default: none
--algorithm [algorithm]: Can be 'minimax', 'greedy', or 'random'. Default: minimax
--account [file]: File from which to load credentials. Default: account.json
--nosave: Don't save games to the in-memory db.
--nolog: Don't append to log files.
--startchallenging: Start out challenging, instead of requiring a manual activation first.

showdownbot's People

Contributors

harrison8989 avatar rameshvarun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

showdownbot's Issues

Can't start a battle...

This project looks great! I am building a similar project for a year long AI course. I tried running the bot and got a few problems. This issue appears to be that I can't start a battle because it can't find a room/doesn't know how to pick a format. I understand that you may not want to rework the code. But I would be super grateful if you would point me in the right direction. Below the error I got and the settings I used in the command line:

node bot.js --ranked --net create --algorithm minimax -- nosave --nolog --startchallenging
[2017-11-28 23:59:25.839] [INFO] learning - Creating neural network... [2017-11-28 23:59:25.847] [INFO] learning - Created neural network... [2017-11-28 23:59:25.848] [TRACE] learning - Created SGD Trainer [2017-11-28 23:59:25.904] [INFO] webconsole - Started web console on port 3000... [2017-11-28 23:59:26.024] [INFO] bot - Connected to server. [2017-11-28 23:59:26.025] [TRACE] bot - << |updateuser|Guest 324953|0|101 |formats|,1|US/UM Singles|[Gen 7] Random Battle,f|[Gen 7] Unrated Random Battle,b|[Gen 7] OU,e|[Gen 7] Ubers,e|[Gen 7] UU,e|[Gen 7] RU,e|[Gen 7] NU,e|[Gen 7] PU,e|[Gen 7] LC,e|[Gen 7] Monotype,e|[Gen 7] Anything Goes,e|[Gen 7] CAP,e|[Gen 7] CAP LC,c|[Gen 7] Battle Spot Singles,1e|[Gen 7] Battle Spot Special 7,1e|[Gen 7] Dragon Cup,1e|[Gen 7] Custom Game,c|,1|US/UM Doubles|[Gen 7] Random Doubles Battle,f|[Gen 7] Doubles OU,e|[Gen 7] Doubles Ubers,e|[Gen 7] Doubles UU,e|[Gen 7] VGC 2018,1e|[Gen 7] VGC 2017,1e|[Gen 7] Battle Spot Doubles,1e|[Gen 7] Doubles Custom Game,c|,2|OM of the Month|[Gen 7] Full Potential,e|[Gen 7] Dual Wielding,e|,2|Other Metagames|[Gen 7] Balanced Hackmons,e|[Gen 7] 1v1,e|[Gen 7] Mix and Mega,e|[Gen 7] Almost Any Ability,e|[Gen 7] Camomons,e|[Gen 7] STABmons,c|[Gen 7] 2v2 Doubles,c|[Gen 6] Gen-NEXT OU,c|,2|Randomized Metas|[Gen 6] Battle Factory,f|[Gen 7] BSS Factory,f|[Gen 7] Monotype Random Battle,d|[Gen 7] Challenge Cup 1v1,f|[Gen 7] Challenge Cup 2v2,d|[Gen 7] Hackmons Cup,f|[Gen 7] Doubles Hackmons Cup,d|[Gen 6] Random Battle,f|[Gen 5] Random Battle,f|[Gen 4] Random Battle,f|[Gen 3] Random Battle,f|[Gen 2] Random Battle,f|[Gen 1] Random Battle,f|[Gen 1] Challenge Cup,9|,3|RoA Spotlight|[Gen 5] PU,e|,3|OR/AS Singles|[Gen 6] OU,e|[Gen 6] Ubers,e|[Gen 6] UU,e|[Gen 6] RU,e|[Gen 6] NU,e|[Gen 6] PU,e|[Gen 6] LC,e|[Gen 6] Anything Goes,e|[Gen 6] Monotype,c|[Gen 6] CAP,c|[Gen 6] Battle Spot Singles,1e|[Gen 6] Inverse Battle,c|[Gen 6] Custom Game,c|,3|OR/AS Doubles/Triples|[Gen 6] Doubles OU,e|[Gen 6] Doubles Ubers,c|[Gen 6] Doubles UU,c|[Gen 6] VGC 2016,1e|[Gen 6] Battle Spot Doubles,1e|[Gen 6] Doubles Custom Game,c|[Gen 6] Battle Spot Triples,1e|[Gen 6] Triples Custom Game,c|,4|B2/W2 Singles|[Gen 5] OU,e|[Gen 5] Ubers,e|[Gen 5] UU,e|[Gen 5] RU,e|[Gen 5] NU,e|[Gen 5] LC,e|[Gen 5] GBU Singles,1c|[Gen 5] Custom Game,c|,4|B2/W2 Doubles|[Gen 5] Doubles OU,e|[Gen 5] GBU Doubles,1c|[Gen 5] Doubles Custom Game,c|,4|Past Generations|[Gen 4] OU,e|[Gen 4] Ubers,e|[Gen 4] UU,e|[Gen 4] NU,c|[Gen 4] LC,e|[Gen 4] Custom Game,c|[Gen 4] Doubles Custom Game,c|[Gen 3] OU,e|[Gen 3] Ubers,e|[Gen 3] Custom Game,c|[Gen 3] Doubles Custom Game,c|[Gen 2] OU,e|[Gen 2] Ubers,c|[Gen 2] Custom Game,c|[Gen 1] OU,e|[Gen 1] Ubers,c|[Gen 1] OU (tradeback),c|[Gen 1] Stadium,c|[Gen 1] Custom Game,c [2017-11-28 23:59:26.026] [TRACE] bot - << |formats|,1|US/UM Singles|[Gen 7] Random Battle,f|[Gen 7] Unrated Random Battle,b|[Gen 7] OU,e|[Gen 7] Ubers,e|[Gen 7] UU,e|[Gen 7] RU,e|[Gen 7] NU,e|[Gen 7] PU,e|[Gen 7] LC,e|[Gen 7] Monotype,e|[Gen 7] Anything Goes,e|[Gen 7] CAP,e|[Gen 7] CAP LC,c|[Gen 7] Battle Spot Singles,1e|[Gen 7] Battle Spot Special 7,1e|[Gen 7] Dragon Cup,1e|[Gen 7] Custom Game,c|,1|US/UM Doubles|[Gen 7] Random Doubles Battle,f|[Gen 7] Doubles OU,e|[Gen 7] Doubles Ubers,e|[Gen 7] Doubles UU,e|[Gen 7] VGC 2018,1e|[Gen 7] VGC 2017,1e|[Gen 7] Battle Spot Doubles,1e|[Gen 7] Doubles Custom Game,c|,2|OM of the Month|[Gen 7] Full Potential,e|[Gen 7] Dual Wielding,e|,2|Other Metagames|[Gen 7] Balanced Hackmons,e|[Gen 7] 1v1,e|[Gen 7] Mix and Mega,e|[Gen 7] Almost Any Ability,e|[Gen 7] Camomons,e|[Gen 7] STABmons,c|[Gen 7] 2v2 Doubles,c|[Gen 6] Gen-NEXT OU,c|,2|Randomized Metas|[Gen 6] Battle Factory,f|[Gen 7] BSS Factory,f|[Gen 7] Monotype Random Battle,d|[Gen 7] Challenge Cup 1v1,f|[Gen 7] Challenge Cup 2v2,d|[Gen 7] Hackmons Cup,f|[Gen 7] Doubles Hackmons Cup,d|[Gen 6] Random Battle,f|[Gen 5] Random Battle,f|[Gen 4] Random Battle,f|[Gen 3] Random Battle,f|[Gen 2] Random Battle,f|[Gen 1] Random Battle,f|[Gen 1] Challenge Cup,9|,3|RoA Spotlight|[Gen 5] PU,e|,3|OR/AS Singles|[Gen 6] OU,e|[Gen 6] Ubers,e|[Gen 6] UU,e|[Gen 6] RU,e|[Gen 6] NU,e|[Gen 6] PU,e|[Gen 6] LC,e|[Gen 6] Anything Goes,e|[Gen 6] Monotype,c|[Gen 6] CAP,c|[Gen 6] Battle Spot Singles,1e|[Gen 6] Inverse Battle,c|[Gen 6] Custom Game,c|,3|OR/AS Doubles/Triples|[Gen 6] Doubles OU,e|[Gen 6] Doubles Ubers,c|[Gen 6] Doubles UU,c|[Gen 6] VGC 2016,1e|[Gen 6] Battle Spot Doubles,1e|[Gen 6] Doubles Custom Game,c|[Gen 6] Battle Spot Triples,1e|[Gen 6] Triples Custom Game,c|,4|B2/W2 Singles|[Gen 5] OU,e|[Gen 5] Ubers,e|[Gen 5] UU,e|[Gen 5] RU,e|[Gen 5] NU,e|[Gen 5] LC,e|[Gen 5] GBU Singles,1c|[Gen 5] Custom Game,c|,4|B2/W2 Doubles|[Gen 5] Doubles OU,e|[Gen 5] GBU Doubles,1c|[Gen 5] Doubles Custom Game,c|,4|Past Generations|[Gen 4] OU,e|[Gen 4] Ubers,e|[Gen 4] UU,e|[Gen 4] NU,c|[Gen 4] LC,e|[Gen 4] Custom Game,c|[Gen 4] Doubles Custom Game,c|[Gen 3] OU,e|[Gen 3] Ubers,e|[Gen 3] Custom Game,c|[Gen 3] Doubles Custom Game,c|[Gen 2] OU,e|[Gen 2] Ubers,c|[Gen 2] Custom Game,c|[Gen 1] OU,e|[Gen 1] Ubers,c|[Gen 1] OU (tradeback),c|[Gen 1] Stadium,c|[Gen 1] Custom Game,c [2017-11-28 23:59:26.027] [WARN] bot - Did not recognize command of type: formats [2017-11-28 23:59:26.027] [TRACE] bot - << |queryresponse|rooms|null [2017-11-28 23:59:26.028] [WARN] bot - Did not recognize command of type: queryresponse [2017-11-28 23:59:26.028] [TRACE] bot - << |challstr|4|6882b223468a13b122770037ded1f97f2a0f09be32b1d7c2a151a8c7ea7471b6cb3b66e70f05128f4f00b94b904908c0362f24a04bb99ec8ca37dd8503103dea69e2de1adf0810414735efa1acdb7062a894e4425f350d27b59b4cc676a585fec601889d962fdde3eb2179f6e156da2993a9c366f9d1d1e8e08d882a015145eb [2017-11-28 23:59:26.028] [INFO] bot - Recieved challenge string... undefined:1 invalid action ^ SyntaxError: Unexpected token i at Object.parse (native) at Object.module.exports.safeJSON (/mnt/c/Users/USER/Desktop/poke/showdownbot-master/util.js:5:14) at Request._callback (/mnt/c/Users/USER/Desktop/poke/showdownbot-master/bot.js:115:19) at Request.self.callback (/usr/lib/nodejs/request/index.js:148:22) at emitTwo (events.js:87:13) at Request.emit (events.js:172:7) at Request. (/usr/lib/nodejs/request/index.js:896:14) at emitOne (events.js:82:20) at Request.emit (events.js:169:7) at IncomingMessage. (/usr/lib/nodejs/request/index.js:847:12)

[FATAL] bot - Error logging in

Hi, I've created a bot but it can't log in. It comes up with warnings about not recognising commands of type 'formats' and 'queryresponse', and I don't know what to do. Please help!

What's wrong...

[2017-08-01 14:23:08.199] [WARN] bot - Did not recognize command of type: formats
[2017-08-01 14:23:08.199] [TRACE] bot - << |queryresponse|rooms|null
[2017-08-01 14:23:08.199] [WARN] bot - Did not recognize command of type: queryresponse
[2017-08-01 14:23:08.199] [TRACE] bot - << |challstr|4|3e0a36696ad6099fdb4850f3f36de77f07a07a08302bf82db704bbf96313bd42f82f1beeb5afaed8501240379aa52cbac2cfc72f1ad88dd60f30ec08e302f68325c406d061f5cb2674cc002dab37e6edf18e30e8954751fbd137df81ef31ac7157fd7781e71954fe69784a3be67d41a285a04af5d5701b056a2933ae54b795fe
[2017-08-01 14:23:08.200] [INFO] bot - Recieved challenge string...
/home/tjh/work/fun/showdownbot-master/util.js:3
if (data.length < 1) return;
^

TypeError: Cannot read property 'length' of undefined
at Object.module.exports.safeJSON (/home/tjh/work/fun/showdownbot-master/util.js:3:10)
at Request._callback (/home/tjh/work/fun/showdownbot-master/bot.js:115:19)
at self.callback (/home/tjh/work/fun/showdownbot-master/node_modules/request/request.js:188:22)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at Request.init (/home/tjh/work/fun/showdownbot-master/node_modules/request/request.js:460:17)
at new Request (/home/tjh/work/fun/showdownbot-master/node_modules/request/request.js:130:8)
at request (/home/tjh/work/fun/showdownbot-master/node_modules/request/index.js:54:10)
at Function.post (/home/tjh/work/fun/showdownbot-master/node_modules/request/index.js:62:12)
at rename (/home/tjh/work/fun/showdownbot-master/bot.js:104:10)

Crash after starting battle

I get this error everytime i start a battle.

SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at constructor.recieve (showdownbot-master 2/battleroom.js:498:45) at recieve (showdownbot-master 2/bot.js:203:18) at EventEmitter.<anonymous> (showdownbot-master 2/bot.js:279:3) at EventEmitter.emit (events.js:198:13) at WebSocketTransport.<anonymous> (showdownbot-master 2/node_modules/sockjs-client-ws/lib/sockjs-client.js:112:20) at WebSocketTransport.emit (events.js:198:13) at WebSocketTransport._dispatchMessage (showdownbot-master 2/node_modules/sockjs-client-ws/lib/WebSocketTransport.js:89:17) at WebSocketTransport.onData (showdownbot-master 2/node_modules/sockjs-client-ws/lib/WebSocketTransport.js:56:16) at WebSocket.<anonymous> (showdownbot-master 2/node_modules/sockjs-client-ws/lib/WebSocketTransport.js:3:59)

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.