cyyyary / marioai

Automatically exported from code.google.com/p/marioai
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Replays cause a null pointer exception #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. record a run by calling cmdLineOptions.setRecordFile("name") before an 
episode.
2.  Replay file by running Main with "-rep name"

What is the expected output? What do you see instead?
Expect to see the reply.  Instead, Java prints out a null pointer exception:

java.lang.NullPointerException
    at ch.idsia.benchmark.mario.engine.LevelScene.reset(LevelScene.java:992)
    at ch.idsia.benchmark.mario.environments.MarioEnvironment.reset(MarioEnvironment.java:92)
    at ch.idsia.benchmark.tasks.BasicTask.reset(BasicTask.java:56)
    at ch.idsia.scenarios.Main.main(Main.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
Exception in thread "main" java.lang.NullPointerException
    at ch.idsia.benchmark.mario.engine.LevelScene.reset(LevelScene.java:1020)
    at ch.idsia.benchmark.mario.environments.MarioEnvironment.reset(MarioEnvironment.java:92)
    at ch.idsia.benchmark.tasks.BasicTask.reset(BasicTask.java:56)
    at ch.idsia.scenarios.Main.main(Main.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)

What version of the product are you using? On what operating system?
Latest from subversion. IntelliJ 9.0.3. Windows latest x64

Original issue reported on code.google.com by melin...@gmail.com on 27 Oct 2010 at 5:01

GoogleCodeExporter commented 9 years ago
Okay, I did a pretty thorough review of the replay code and it seems like using 
Main will never work as it currently is.

I thought about editing Main to make a replay task instead of a basic task but 
then I noticed the Replay file and so decided that it was good for the purpose.

To get it to work, I made some changes mostly getting visualization from the 
command line instead of the replay.

I'm also curious about the GlobalOptions.isVisulization which seems to be used 
to open and close the level in ReplayTask.  No better way?

Original comment by melin...@gmail.com on 27 Oct 2010 at 8:41

Attachments:

GoogleCodeExporter commented 9 years ago
Sorry, but we have not updated the documentation yet. To replay recorded file 
you should use class Replay like this:
java ch.idsia.scenarios.Replay <replay_file>

We'll update documentation soon! Thanks you!

Original comment by Nikolay....@gmail.com on 27 Oct 2010 at 11:09

GoogleCodeExporter commented 9 years ago
Issue 6 has been merged into this issue.

Original comment by Nikolay....@gmail.com on 27 Oct 2010 at 11:12

GoogleCodeExporter commented 9 years ago
Yeah, I realized a bit later that the intention was probably to use Replay.

The current way is fair though it does lead to another error which I'll open a 
new issue for.

Thanks.

Original comment by melin...@gmail.com on 27 Oct 2010 at 11:34

GoogleCodeExporter commented 9 years ago
Thanks! Waiting for your response!

Original comment by Nikolay....@gmail.com on 27 Oct 2010 at 11:36