-
Notifications
You must be signed in to change notification settings - Fork 490
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
Added Some Values To Pokemon Game Wrapper #374
base: master
Are you sure you want to change the base?
Conversation
The purpose of these values is to allow the machine learning model to gain information that it would not know of without it being complex. Currently there is only access to the total number of items to provide agents to some information in regards to their items. The total number of pokemon in the party will allow the user to provide rewards based on the number of pokemon the agent has gathered. The time will provide the user with some insight as to how many in game hours the model took to reach certain check points or flags found within the game. Added a battle state variable which will allow the user to either use models that are specific to the battle scenarios within the game and the game overworld. Currently working on developing the flags for the badges. Have added it on for now.
When the game wrapper is called upon, it now prints out the number of pokemon in the party, the amount of time spent in game, the total number of items in backpack as well as whether the pokemon trainer is in battle or in the overworld.
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.
Thank you for the PR! Looks good, but I've added a few comments.
if self.pyboy.memory[ADDR_BATTLE] == 1: | ||
self.battle_state = 'In Battle' | ||
else: | ||
self.battle_state = 'Overworld' |
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.
Did you test this? I think there's some distinction between trainer battle and wild pokémon.
if self.pyboy.memory[ADDR_TITLE_SCREEN] == 0: | ||
pass | ||
else: | ||
self.number_of_pokemon = self.pyboy.memory[ADDR_NUMBER_OF_POKEMON] | ||
self.total_items = self.pyboy.memory[ADDR_TOTAL_ITEMS] | ||
# Extract the time in game: | ||
_hours = self.pyboy.memory[ADDR_HOURS] | ||
_minutes = self.pyboy.memory[ADDR_MINUTES] | ||
_seconds = self.pyboy.memory[ADDR_SECONDS] | ||
self.game_time = f'{_hours}:{_minutes}:{_seconds}' | ||
|
||
# Check whether the player is in battle mode or out of battle | ||
if self.pyboy.memory[ADDR_BATTLE] == 1: | ||
self.battle_state = 'In Battle' | ||
else: | ||
self.battle_state = 'Overworld' | ||
|
||
self.badges = self.pyboy.memory[ADDR_BADGES] #Research how this works. |
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.
This is all duplicate code. Better just define some default value (0) for all of them. The data of the game wrapper classes are not valid before calling pyboy.tick()
anyway.
_hours = self.pyboy.memory[ADDR_HOURS] | ||
_minutes = self.pyboy.memory[ADDR_MINUTES] |
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 can see from datacrystal which you link to, that hours and minutes are two bytes. You'll need to check how this works.
Hi Baekalfen, Thank you for the comments I did do some print outs, but was a little bit confused on the placement of code and how things worked. Will definitely do some testing on this and convert it this pull request to a draft in the meantime. |
All good. Come to Discord if you need help. There are more people than just me who'd know. |
Added number of pokemon in party, total game time, total number of items, and whether the pokemon trainer is in battle or not.
The purpose of these parameters is to help the user of the game wrapper train AI agents by either switching model between exploration mode and battle mode, to provide insight of in-game time, to provide rewards based on the number of pokemon in party and to observe the number of items gathered while playing the game.