Skip to main content

A Pokemon Go Battle Simulator wrapped in Python

Project description

GoBattleSim Engine with Python API

A Pokemon Go Battle Simulator (GoBattleSim) with Python API.

Getting Started

Prerequisites

64-bit Windows/Linux

64-bit Python 3.5+

Installing

The below instructions will get you a local version of GoBattleSim engine.

First, install the package:

pip install gobattlesim

Then:

import gobattlesim.interface

If no error pops up, then you are good to go!

Some of the common errors include:

WindowsError: ... not a valid Win32 application

This could be that your Python is 32-bit. I only compiled the simulator core into a 64-bit DLL. Therefore, again, 64-bit Python is required.

Quick Start

The gobattlesim.interface module saves a lot of typing. To use the module, you need to first acquire a game master file in json format. You can find one in sources online such as this repo.

Suppose the game master file is "GAME_MASTER.json" and is placed in the same folder with your script. Then do:

import gobattlesim.interface as gbs

gbs.GameMaster("GAME_MASTER.json").apply()

Now game master file has been parsed and applied to the simulator.

Let's run some simulations on the classic Tyranitar Duo with two teams of max perfect Machamp:

result = gbs.quick_raid_battle(
    {
        "name": "machamp",
        "fmove": "counter",
        "cmove": "dynamic punch"
    },
    {
        "name": "tyranitar",
        "fmove": "bite",
        "cmove": "crunch",
        "tier": 4
    },
    player_multiplier=2
)

print("Machamp duo T4 Tyranitar:")
print(result)

The result is a dict containing some performance metrics. An example output could be:

Machamp duo T4 Tyranitar:
{'win': 1.0, 'duration': 130157.966, 'tdo_percent': 1.010376666666664, 'num_deaths': 3.506}

One may find gobattlesim.interface.quick_raid_battle (and gobattlesim.interface.quick_pvp_battle) rather limited, and may want more control on the simulations. If so, the gobattlesim.engine is best for this purpose.

More examples of using gobattlesim.engine alone to run simulations have been given in the repo.

Documentations

Coming up!

Contributing

The feature requests and known bugs are listed in the issues section. You are more than welcome to help by adding items to that list!

Note that this repo is the interface part of the simulator. The core part that contains the actual battle logic will be in another repo.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Author

  • Hank Meng - Initial work - BIOWP

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

  • Web GoBattleSim has been for over a year. A lot of improvements have been made, but the key issue persists - speed performance. So I wanted to make a faster one. I want to make it fly. And there it is, core engine written in C++, exported as DLL, and wrapped in Python.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for gobattlesim, version 0.7.2
Filename, size File type Python version Upload date Hashes
Filename, size gobattlesim-0.7.2-py3-none-any.whl (100.1 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size gobattlesim-0.7.2.tar.gz (100.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page