pmariglia / showdown

A Pokemon Showdown Battle Bot written in Python
GNU General Public License v3.0
239 stars 174 forks source link

Separate out the engine into an installable library #186

Open SirSkaro opened 4 months ago

SirSkaro commented 4 months ago

There are a lack of battle simulators that are capable of performing search. Your agent is the only one I'm aware of that has a decent battle engine to perform search. I'm create my own agent that uses search but using poke-env to communicate with Pokemon Showdown.

I think it would be beneficial to separate out your engine into a stand-alone, installable library. I've actually proved this out already on my fork, and am using it in my agent. Your showdown application would then use this installable library.

I did as much "lift-and-shift" as I could, changing as little as possible and keeping tests passing but removing everything pertaining to running as a stand-alone application. To me it would also makes sense to have separate projects for the data and team modules so that they can be loosely coupled and versioned independently. I realize there would have to be bigger refactors than what I did. Would love to hear your thoughts.

pmariglia commented 4 months ago

Love it. This is something I've wanted to do but just never had the time or motivation. I've kept everything in the engine (well, maybe besides constants.py) separate for this reason. Very glad to see that you were able to make it work.

When I get a chance I'll take a look at your fork and see if I could add my own setup.py in the engine folder, and perhaps publish it to pypi - a couple of other people have privately mentioned to me that they would be interested in this as well.

SirSkaro commented 4 months ago

Depending on how hard you want to go with creating a battle engine, you may want to take a look at the engine from the pkmn project.. I haven't looked too much into it, but it looks like a framework for building performant simulators. Perhaps this could help eek out a level or two in the search tree. Looks like someone has already made a Python library using this as a base, though I haven't looked too much into it either.

If I haven't disclaimed enough already, I know little to nothing about the pkmn project. I just found it interesting from a glance.

I learned about it from https://pkmn.ai/projects/#0ERROR

scheibo commented 4 months ago

Hi @SirSkaro - thanks for your interest in the pkmn engine. Its not actually a framework, its an alternative engine in the same way pmariglia's engine is, designed for a similar reason (performance, particularly for AI use cases) though making different tradeoffs. The pkmn engine is unfinished and only has support for Generation I at this time (and some advanced features the engine will eventually offer aren't fully supported yet in Generation I either, though it is at least at parity feature-wise with respect to Pokémon Showdown and considerably faster).

I would certainly endorse this repository's engine an excellent choice for Python AI projects targeting modern generations. EPOké and the pkmn engine aim to ultimately subsume much of the functionality provided here, though there is no clear timeline on how long that will take and it makes 100% more sense to use the proven code from this project. If you are targeting Generation I (and soon Generation II hopefully) and are OK to live on the bleeding edge in pursuit of performance the pkmn engine might be an option.

I hope to provide a more throughout comparison of the functionality offered (or planned to be offered) by Pokémon Showdown, the pkmn engine, this engine, and PokeSim on https://pkmn.ai/concepts/engines to help people who are making decisions about AI engine choice in the future. I also discussed this with pmariglia on https://pkmn.ai/chat (discussion starts here)

@pmariglia feel free to nuke this comment if you feel it inappropriate for this repository

SirSkaro commented 4 months ago

Hi @scheibo - thank you very much for chipping in and for the correct. Your description and explanation was incredibly helpful - I had not looked into your project enough to realize it currently only targets gen 1. I also take it that you're a maintainer of https://pkmn.ai. Thank you for putting that together, it's already been helpful for my current research project.

I'm excited to see how the pkmn engine developer. But it sounds like it's probably not the direction this engine wants to take.