• The moderator of this forum is jetou.
  • Welcome to Smogon! Take a moment to read the Introduction to Smogon for a run-down on everything Smogon, and make sure you take some time to read the global rules.

Need help gathering and parsing battle logs

Hi everyone,

I'm working on building a bot to play Pokémon Gen 9 OU battles. To train the model, I'll need a large dataset of Gen 9 OU battle logs. I'm unsure about the best way to obtain these logs. I've come across some existing parsing projects that extract battle data, but I'm not sure if they're robust or suitable for my needs. Would it be better to create my own parser from scratch, or should I leverage existing tools?

This is my first major project, and I'm excited to learn new skills along the way. If anyone has advice on sourcing battle logs, evaluating parsing tools, or tips for a beginner tackling a project like this, I’d be incredibly grateful for your help :)!
 
I suppose there's a good chance you've figured this out already, but just in case you haven't (or for anyone else reading), I'll give some head start advice

https://replay.pokemonshowdown.com/?format=gen9ou returns a pretty big selection of replays filtered by the tier you want to access logs from. The slug to these replays is stored in the HTML document and you should be able to programmatically gather these by iterating across the page numbers. Just bear in mind that you will be gathering only public replays this way.

Once you have your links, any replay URI can be appended with '.json' to receive an API response object, e.g. https://replay.pokemonshowdown.com/gen9ou-somegame12345.json

The 'log' field then contains the battle log which is just a giant string of everything that happens turn by turn. Pretty much up to you to figure out what to do from there, but hopefully this gets the API stuff out of the way so that you can focus on the machine learning aspect.

Good luck with your project!
 
Back
Top