Exploration AI in Pokemon Red - Is there an easy way to skip battles?

Hi, I’m new here and I’ve only been using PyBoy for about two months. I’ve already done some research and created small projects, like automatic exploration using Q-learning or battling with randomly chosen buttons. Ok, now to the point. I’ve started a somewhat more complex project using Double Deep Q-learning for exploration and I’d like to make it as effective as possible. I need help with one thing: Is there an easy way to skip battles? I know there’s a special flag that indicates whether a battle is occurring, but is there a simple method to automatically run away or just skip it? In the worst case, is there some tuning I can apply to make running away 100% successful? That way I could have the AI run every time, even if that might be overly optimized.
12 Replies
thatguy
thatguy6d ago
Yes
thatguy
thatguy6d ago
GitHub
pokemonred_puffer/pokemonred_puffer/data/events.py at main · drubi...
Contribute to drubinstein/pokemonred_puffer development by creating an account on GitHub.
thatguy
thatguy6d ago
thatguy
thatguy6d ago
You can also reset the wild encounter rng between steps
Figiel Migiel
Figiel MigielOP6d ago
First of all, thanks so much for so fast response Second of all, the idea with repel is awesome. I mean, I still need to somehow use it, but still, great idea. Ok, I might not be very smart, but how is knowing whether a battle with a trainer has started supposed to help me skip it? Maybe there’s a way to automatically win. it would make more sense.
thatguy
thatguy6d ago
You set the bit before the battle started There's probably a way to hack three enemy HP to 0. But I've never tried it. Trainer battles are rarely a blocker from my experience
thatguy
thatguy6d ago
https://drubinstein.github.io/pokerl/ current report (this is ongoing work for me)
Pokémon RL
Learning Pokémon With Reinforcement Learning
Hi! Since 2020, we’ve been developing a reinforcement learning (RL) agent to beat the 1996 game Pokémon Red. As of February 2025, we are able to beat Pokémon Red with Reinforcement Learning using a <10 million parameter policy (60500x smaller than DeepSeekV3) and with minimal simplifications. The output is not a policy capable of beating Pok...
Figiel Migiel
Figiel MigielOP6d ago
wait.... so you’re saying I can just flip that bit in WRAM and it skips the battle as if nothing ever happened?
thatguy
thatguy6d ago
It should Never tried it, but I wouldn't be surprised since that's what happens in ram
Figiel Migiel
Figiel MigielOP6d ago
good point Wow, I’m really grateful. When I get to that point, I’ll let you know here. Thanks again. You’ve been a great help.
thatguy
thatguy6d ago
Feel free to join the pokerl discord
Figiel Migiel
Figiel MigielOP6d ago
another discord channel... wow. I'll join for sure.

Did you find this page helpful?