PyBoy icon indicating copy to clipboard operation
PyBoy copied to clipboard

WIP: Pokemon Red plugin

Open MaciekBaron opened this issue 4 years ago • 17 comments

I was hoping to do a WIP review as there's a lot of code, please let me know what you think - thanks!

TODO

  • [ ] Add player position/location functions (currently we only get current map)
  • [ ] Determine game_area size and logic (there is overworld mode, battles and menus)
  • [ ] Determine (if needed) fitness scoring

MaciekBaron avatar Jun 27 '20 18:06 MaciekBaron

This looks very good, but it hasn't been updated in a while. Do you think it would be a good idea to merge the WIP state so more people can view it and update it? If not, that's okay, I'll just clone it into my local codebase.

hexiro avatar Sep 07 '22 12:09 hexiro

This looks very good, but it hasn't been updated in a while. Do you think it would be a good idea to merge the WIP state so more people can view it and update it? If not, that's okay, I'll just clone it into my local codebase.

AFAIK, it's not in a complete working state, so I think it would give the wrong impression to people if we merged it. But you are more than welcome to clone it and work on it. I'll gladly merge it, if we can get it to a workable state.

Baekalfen avatar Sep 07 '22 12:09 Baekalfen

This looks very good, but it hasn't been updated in a while. Do you think it would be a good idea to merge the WIP state so more people can view it and update it? If not, that's okay, I'll just clone it into my local codebase.

AFAIK, it's not in a complete working state, so I think it would give the wrong impression to people if we merged it. But you are more than welcome to clone it and work on it. I'll gladly merge it, if we can get it to a workable state.

I can attempt to expand it based on existing information. How much more needs to be done for it to be worthy of a merge?

hexiro avatar Sep 07 '22 13:09 hexiro

How much more needs to be done for it to be worthy of a merge?

Practically anything that shows a useable example. For example a proof-of-concept of doing a battle and/or navigating the world.

Baekalfen avatar Sep 08 '22 12:09 Baekalfen

Hey guys, sorry for abandoning this. There's a proof of concept showing this working in my interactive Twitch app: https://github.com/MaciekBaron/poke-rb-interactive

Can help with progressing this further.

MaciekBaron avatar Sep 08 '22 12:09 MaciekBaron

Hey guys, sorry for abandoning this. There's a proof of concept showing this working in my interactive Twitch app: https://github.com/MaciekBaron/poke-rb-interactive

Can help with progressing this further.

This is very cool!

As for suggestion I have, I think it would be cool to have more commands to handle interactive aspects of the game. some examples of possibilities:

battle: active_moves() -> tuple of 1-4 moves of current mon attack_with_move(MOVE) -> finds what move slot that move is in or errors? attack_with_move_slot(1) run() bag_items() use_item(ITEM) is_attacking() -> enemies' mon's healthbar is being drained after attacking is_being_attacked() -> users' mon's healthbar is being drained after being attacked

overworld: is_facing_obstacle() is_in_dialogue / is_in_cutscene()

These are some things that I think would make the overall experience of using the wrapper easier for the user, although all of these might not be worth the effort. If you would like, i could attempt to implement the ones that don't require reading or setting memory namely, run, use_item, attack_with_move.

let me know what you think about these suggestions!

hexiro avatar Sep 08 '22 13:09 hexiro

I think those sound good!

We can also nick the constants I prepared for the other project: https://github.com/MaciekBaron/poke-rb-interactive/blob/master/pkmn/constants.py

MaciekBaron avatar Sep 08 '22 13:09 MaciekBaron

I think those sound good!

We can also nick the constants I prepared for the other project: https://github.com/MaciekBaron/poke-rb-interactive/blob/master/pkmn/constants.py

Quite and extensive list you've got there. Very nice! Although might I suggest making, Moves, Status, etc enums.

hexiro avatar Sep 08 '22 21:09 hexiro

after a lot of testing i've found that the memory address FFB0 - Value copied to WY at VBlank (description from https://datacrystal.romhacking.net/wiki/Pokémon_Red/Blue:RAM_map#Graphics_scroll_values)

is set to 144 when playing normally, or it's set to 0 if things in the overworld are not moving (my best guess at what's happening).

I'm not sure the technical reason, but It appears as though one could check if the user is in some kind of dialogue with an NPC or object (like a sign) around the world if they're not in battle (can be checked more precisely) and they're not in the start menu, (again, has exact memory locations for checking this specifically)

Hopefully this information can be useful, and let me know if you know a more consistent method of checking this.

hexiro avatar Sep 09 '22 00:09 hexiro

Is there any interesting in continued work on this particular pull request? Intending to do some RL on Pokemon Red and some of the features added in here would be interesting to have access to, but it's been a hot second since anyone touched this branch and I'm unsure whether I should be respecting this branch or just roll my own code in a different fork.

SnarkAttack avatar Nov 03 '23 18:11 SnarkAttack

Is there any interesting in continued work on this particular pull request? Intending to do some RL on Pokemon Red and some of the features added in here would be interesting to have access to, but it's been a hot second since anyone touched this branch and I'm unsure whether I should be respecting this branch or just roll my own code in a different fork.

If you want to restart the efforts in a new fork/PR, then that's very welcome. I don't think the original author will come back and finish this.

Once you submit a PR, we can consider if it replaces all the features in this PR. But we'll keep it here as reference until then

Baekalfen avatar Nov 06 '23 07:11 Baekalfen

Sorry everyone, got really busy and didn't get to finish this. Happy for people to use the data/code from this.

MaciekBaron avatar Nov 06 '23 10:11 MaciekBaron

Thanks for the work you did @MaciekBaron, I am using this PR to get a head start.

SnarkAttack avatar Nov 06 '23 14:11 SnarkAttack

Is there any interesting in continued work on this particular pull request? Intending to do some RL on Pokemon Red and some of the features added in here would be interesting to have access to, but it's been a hot second since anyone touched this branch and I'm unsure whether I should be respecting this branch or just roll my own code in a different fork.

I have started a pokered plugin as well: https://github.com/Pokeglitch/PyBoyPokered

I have it separate from the "built in" game_wrapper_pokemongen1 for now, since I am using the "dynamic plugins" branch for ease of development, but incorporating it in the future should only require a few tweaks.

But I'll be happy to make this part of a group effort

Pokeglitch avatar Nov 07 '23 12:11 Pokeglitch

I have it separate from the "built in" game_wrapper_pokemongen1 for now, since I am using the "dynamic plugins" branch for ease of development, but incorporating it in the future should only require a few tweaks.

I'm glad that somebody found it. If you join on Discord and provide examples and feedback on how you use it, I might be able to merge it in soon.

EDIT: "it" being the dynamic plugins

Baekalfen avatar Nov 07 '23 12:11 Baekalfen

@Pokeglitch I'm fine if you want your branch to be the main dev branch and we cherry pick things out of mine here that we want to keep. Having the dynamic plugins working as well as the breakpoints seem like really nice core features, most of what I've done at this point is just Python classes for encapsulating data access calls and is probably easier to drag and drop to another repo.

SnarkAttack avatar Nov 28 '23 13:11 SnarkAttack

Linking this to: #233

Baekalfen avatar Nov 29 '23 13:11 Baekalfen