kevinhughes27 / TensorKart

self-driving MarioKart with TensorFlow
MIT License
1.58k stars 255 forks source link

Basic question: play a demo #55

Open fujiki-1emon opened 6 years ago

fujiki-1emon commented 6 years ago

Greetings,

I wanted to see some demo running and how the system runs and tried to run python test.py without any inference from a model (fixing joystick = [0, 0, 1, 0, 0]). At first, it seemed well, but finally I got the problem below without seeing the agent moving around. It must be a trivial issue, but I'd like you to help me solve the problem.

peek 2017-11-01 23-29

Thanks.

bzier commented 6 years ago

Thank you for sharing that screen capture. That's incredibly helpful. I've seen symptoms of this before, but never actually seen what's going on to understand it.

The first thing to be aware of is how the gym environment is detecting the end of an episode (end of a race). At the end of a race, the game 'zooms out' to show replays and timings, etc. I am currently using this to detect when the race is over. See here at the bullet point for _evaluate_end_state(). That info is actually slightly out of date. It mentions all black pixels, but the code currently looks for all corners of the same color. See here for why.

Now at this point you may guess what the problem is. In your screen capture, you can see that the emulator is rendering briefly in full size and then flickering to a really tiny image, then back to full size, etc. The problem comes in when we encounter 30 consecutive frames of that 'zoomed out' tiny view and consider it the end of the race.

Unfortunately I'm not sure that this is a trivial issue as it is likely an issue in the underlying N64 emulator or video driver. Even if that behavior didn't trigger my environment's end episode detection, you likely would not get good behavior from any AI executing with that as the input... even a human would probably struggle significantly :)

I'll have to take a closer look at this later tonight to see if I can track down anything. Just be aware that it may not be a quick fix.

bzier commented 6 years ago

Hey @Fujiki-Nakamura, Out of curiosity, what are your system specs? What version of Ubuntu are you running? What kind of graphics card? Etc. I don't know if that information will be helpful or not, but it could play into things.

Also, did you change any of the configuration settings for the gym environment, or just leave everything as default?

Thanks.

fujiki-1emon commented 6 years ago

@bzier Thank you for your comments! and sorry for the late response..

I should have informed you about that. I'm using Ubuntu 16.04 LTS. I'll check about the specs and the graphics card. Please wait for a while.

[edit] Specs:

I just checked System Settings > Details > Overview. If it's not enough for you, please let me know.

I think I didn't change anything regarding to the settings such as gym-mupen64plus/gym_mupen64plus/envs/config.yml.

bzier commented 6 years ago

No problem on the timing. I only can check in on this and respond a couple times throughout the day anyway.

Thanks for the additional info. I'll keep thinking about it and see what I can figure out. It would be good to pin this down and ensure it behaves consistently. I'll respond back if I have any more info or questions.