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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for gobattlesim-0.7.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aec7b11113ebf777b153eaf252d4595d4d58c638ea1bf54c5689699a3ba04108 |
|
MD5 | 2951e604dc07db9d4533a77f575fb873 |
|
BLAKE2b-256 | f88023c51ffc674ba352302c8b3300999da130f522eef4360e84f833091c48d4 |