openai / retro

Retro Games in Gym
MIT License
3.37k stars 523 forks source link

Sonic The Hedgehog 2 Genesis #233

Open onaclov2000 opened 3 years ago

onaclov2000 commented 3 years ago

Issue summary

When running the retro env, if sonic moves to the right to a certain point (perhaps a few hundred pixels? not sure exact amount), the game freezes, I can't seem to figure why this is the case, I was running on my other machine and saw the same problem but thought it was linux related, I now realize it's related to the version of retro (basically the version I had on windows was old, and only had genesis and one other core), but I updated this afternoon and now it freezes and doesn't continue running.

System information

onaclov2000 commented 3 years ago

I added a "print (info)" and it outputs this over and over now:

{'x': 389, 'lives': 3, 'screen_x_end': 10656, 'game_mode': 12, 'score': 0, 'zone': 0, 'level_end_bonus': 0, 'rings': 0, 'act': 0, 'y': 624, 'screen_x': 229, 'screen_y': 528}

{'x': 394, 'lives': 3, 'screen_x_end': 10656, 'game_mode': 12, 'score': 0, 'zone': 0, 'level_end_bonus': 0, 'rings': 0, 'act': 0, 'y': 624, 'screen_x': 234, 'screen_y': 528}

{'x': 400, 'lives': 248, 'screen_x_end': 10656, 'game_mode': 12, 'score': 29819029, 'zone': 0, 'level_end_bonus': 0, 'rings': 200, 'act': 142, 'y': 624, 'screen_x': 240, 'screen_y': 528}

{'x': 400, 'lives': 248, 'screen_x_end': 10656, 'game_mode': 12, 'score': 29819029, 'zone': 0, 'level_end_bonus': 0, 'rings': 200, 'act': 142, 'y': 624, 'screen_x': 240, 'screen_y': 528}

It appears something is happening that changes the number of lives to 248 which is odd, maximizes the score, and sets it to 200 rings....

I ran it again and included the action selected:

{'x': 451, 'lives': 3, 'screen_x_end': 10656, 'game_mode': 12, 'score': 0, 'zone': 0, 'level_end_bonus': 0, 'rings': 0, 'act': 0, 'y': 624, 'screen_x': 291, 'screen_y': 528} 
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]

{'x': 456, 'lives': 131, 'screen_x_end': 10656, 'game_mode': 12, 'score': 8323283, 'zone': 0, 'level_end_bonus': 0, 'rings': 144, 'act': 157, 'y': 624, 'screen_x': 296, 'screen_y': 528}
 [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]
onaclov2000 commented 3 years ago

I backed all the way to pip install gym-retro==v0.5.3 I believe, and it's broken back to there too. unfortunately. I have no idea how I had a working version (or what version it was)

onaclov2000 commented 3 years ago

I migrated to using Super Mario World for experiments, but would really like to get sonic working again, I'm unsure if this is an issue with the emulator, the game, or gym-retro.

onaclov2000 commented 3 years ago

I think I found a version for linux I have backed up, though I'm not sure I have anything else, one option would be to chase down around what version the emulator was at way back when and compile that, and pull it in. I'll probably look into it. I tried "Airstriker" and that seemed to work fine, so I'm a bit confused why sonic is seemingly broken (I haven't done extensive review, so perhaps it's something else I've broken, I might try a demo "random agent" and see if it is successful)

TiddlyWiddly commented 3 years ago

Sound like maybe the memory address for "lives" isn't correct.

onaclov2000 commented 3 years ago

That's possible, maybe the base address changed between versions, but I think that it gets overwritten when you reinstall, so the Json in the repo is broken if that's the case (but it is the right value for a while, so I have no idea what the deal is)