Git Product home page Git Product logo

showdown's Introduction

Showdown umbreon

Showdown is a Pokémon battle-bot that can play battles on Pokemon Showdown.

The bot can play games in generations 4 through 7 however some of the evaluation logic is assuming gen7 mechanics.

Python version

Developed and testing using Python 3.6.3.

Getting Started

Installing

Clone the repository with git clone https://github.com/pmariglia/showdown.git

Install the requirements with pip install -r requirements.txt.

Be sure to use a virtual environment to isolate your packages.

Tests

Run all tests with python -m unittest discover -s tests/ -t .

Configuration

Showdown uses environment variables for configuration, which are read from a file named .env in the root of the project.

The configurations available are:

SAVE_REPLAY: (bool, default False) Specifies whether or not to save replays of the battles
LOG_TO_FILE: (bool, default False) Specifies whether or not to save for each battle to a file in {PWD}/logs/
LOG_LEVEL: (string, default "DEBUG") The Python logging level 
WEBSOCKET_URI: (string, default is the official PokemonShowdown websocket address: "sim.smogon.com:8000") The address to use to connect to the Pokemon Showdown websocket 
PS_USERNAME: (string, required) Pokemon Showdown username
PS_PASSWORD: (string) Pokemon Showdown password
BOT_MODE: (string, required) The mode the the bot will operate in. Options are "CHALLENGE_USER", "SEARCH_LADDER", or "ACCEPT_CHALLENGE"
USER_TO_CHALLENGE: (string, required if BOT_MODE is "CHALLENGE_USER") The user to challenge
POKEMON_MODE: (string, required) The type of game this bot will play games in
TEAM_NAME: (string, required if POKEMON_MODE is one where a team is required): The name of the JSON file that contains the team you want to use. More on this below in the Specifying Teams section.
RUN_COUNT: (integer, required) The amount of games this bot will play before quitting

Here is a sample .env file:

SAVE_REPLAY=False
LOG_TO_FILE=False
LOG_LEVEL="DEBUG"
WEBSOCKET_URI="localhost:8000"
PS_USERNAME="MyCoolUsername"
PS_PASSWORD="MySuperSecretPassword"
BOT_MODE="CHALLENGE_USER"
USER_TO_CHALLENGE="SomeScrub"
POKEMON_MODE="gen7randombattle"
TEAM_NAME="ou_sample"
RUN_COUNT=1

Running

Running with python run.py will start the bot with the settings specified in your .env file.

Decision Logic

Showdown decides which move to make by first simulating all possible transpositions for 2 turns. An evaluation function is used to score each combination of moves and a decision is made about which the best move(s) are.

The decision logic is not deterministic. The same state could result in two different decisions if evaluated twice.

Most aspects of Pokémon are accounted for, such as:

  1. Damage Rolls

  2. Spreads

  3. Move-Sets

  4. Abilities

  5. Items

  6. Hazards

  7. Weather

Specifying Teams

The user can specify teams in JSON format to be used for non-random battles. Examples can be found in teams/team_jsons/.

The name of the .json file must used as TEAM_NAME in the configuration file.

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.