-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Pokemon Red plugin #176
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't looked into all details, but what you've done so far looks really good!
def get_int_at_address(self, address, size=2): | ||
"""Returns an integer from a given address of a specified size.""" | ||
bytes = [] | ||
for i in range(size): | ||
bytes.append(self.pyboy.get_memory_value(address + i)) | ||
return int.from_bytes(bytes, byteorder=BYTE_ORDER) | ||
|
||
def set_int_at_address(self, address, value, size=2): | ||
"""Sets an integer at a given address of a specified size.""" | ||
bytes = value.to_bytes(2, byteorder=BYTE_ORDER) | ||
i = 0 | ||
for byte in bytes: | ||
self.pyboy.set_memory_value(address + i, byte) | ||
i += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These probably belong elsewhere. Maybe on the PyBoy object itself. Are these for the user of the plugin?
def set_text(self, text, address): | ||
"""Sets text at address. | ||
|
||
Will always add a string terminator (80) at the end. | ||
""" | ||
i = 0 | ||
for character in text: | ||
try: | ||
self.pyboy.set_memory_value(address + i, get_character_index(character)) | ||
i += 1 | ||
except: | ||
pass | ||
self.pyboy.set_memory_value(address + i, constants.STRING_TERMINATOR) | ||
|
||
def set_rom_text(self, text, bank, address): | ||
i = 0 | ||
for character in text: | ||
try: | ||
self.pyboy.override_memory_value(bank, address + i, get_character_index(character)) | ||
i += 1 | ||
except: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These helper functions look like they should be hidden?
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 |
Practically anything that shows a useable example. For example a proof-of-concept of doing a battle and/or navigating the world. |
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. battle: overworld: 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! |
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, |
after a lot of testing i've found that the memory address is set to 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. |
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 |
b1ede15
to
384e644
Compare
Sorry everyone, got really busy and didn't get to finish this. Happy for people to use the data/code from this. |
Thanks for the work you did @MaciekBaron, I am using this PR to get a head start. |
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 |
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: |
@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. |
Linking this to: #233 |
I was hoping to do a WIP review as there's a lot of code, please let me know what you think - thanks!
TODO
game_area
size and logic (there is overworld mode, battles and menus)