GamePlay track‎ > ‎

Getting Started

This section describes how to get into: 
  • download the source
  • play with existing code
  • where and how to write you own code
  • where to ask question and get support 
  • how to submit your entry.

  1. Download the Mario AI Benchmark source package and unpack it.
    Update: the code is now also hosted on GitHub, at . This is where you are likely to find the most updated version.
  2. Play with it to get the feeling and inspiration!

    $ cd bin
    java ch.idsia.scenarios.Main

    and enjoy playing on a simple level with default options! Control keys are: arrows, `a` and `s`

    Remaining in bin directory compare yourself to several controllers coming with the software out of the box:

    $ java ch.idsia.scenarios.Main -ag ch.idsia.agents.controllers.ForwardAgent

    java ch.idsia.scenarios.Main -ag ch.idsia.agents. controllers.ForwardJumpingAgent

    Play together with the agents slightly more difficult level (-ld 1) with another seed (-ls 42) and of different length (-ll 256) and of different type (-lt 1)

    $ java ch.idsia.scenarios.Main -ag ch.idsia.agents. controllers.ForwardJumpingAgent -ld 1 -ls 42 -ll 256 -lt 1 & java ch.idsia.scenarios.Main -ag ch.idsia.agents. controllers.ForwardAgent -vlx 330 -ld 1 -ls 42 -ll 256 -lt 1 & java ch.idsia.scenarios.Main -ag ch.idsia.agents. controllers.ScaredAgent -vlx 330 -vly 290 -ld 1 -ls 42 -ll 256 -lt 1 & java ch.idsia.scenarios.Main -vlx 0 -vly 290 -ld 1 -ls 42 -ll 256 -lt 1 

    Check out for more advanced options available in src/ch/idsia/utils/ Details and usage hints about the options are here.

    At this point you are quivering from anticipation and desire to dip in and get closer to the source code and implementation details, right? Here we go!

    All the agents referred so far could be found in src/ch/idsia/agents/ai package. Just go there and have a look at the getAction() method. Note! Unlike previous year you have to implement the  boolean[] getAction() method. Observations are provided by integrateObservation(...) of the Agent interface and example implementation of it you can retrieve either by extending the BasicAIAgent or by just copying that method from the latter. Shortly: this would save "couple" of computations ticks each time step for your Agent/Controller algorithm from gathering the observation information during the decision making process. As for clearing reference have a look at this code (taken from ch/idsia/maibe/tasks/ to get the feeling of how it's inside.

    agent.integrateObservation(environment);            environment.performAction(agent.getAction());

    Got a grasp about how it works! Great! When evaluating your agent you might think of speeding up the animation or even getting rid of the visualization at all. Here is our next section:

  3. Speeding up the evaluations and visualization hints:

    There are several ways to influence the visualization procedure. 
    Keyboard: during the animation process by pressing +/- increase or decrease the FPS. If the FPS value is > 99, visual component switches to mode with maximum possible FPS and shows `FPS: \infty`. Press V to stop the visualization, yet keeping the evaluation process alive. This is useful when MarioAI Benchmark is running at maximum possible FPS, you got the behavior of the agent, but you'd like to keep the 'honest' score and do not interrupt him, but just speed up. This approach will give the highest possible evaluation speed.
    Command line parameters: -fps <int>, -vis <on|off>
    java ch.idsia.scenarios.Main -ag ch.idsia.agents. controllers.ForwardAgent -fps 100

    will run at a maximum FPS rate with visualization.

    java ch.idsia.scenarios.Main -ag ch.idsia.agents. controllers.ForwardAgent -vis off

    will run at highest evaluation speed without visualization and even instantiating the visual component. VisualComponent unlike the previous versions is completely detached from the evaluation procedures. 

    And here goes the corresponding CmdLineOptions procedures:
    CmdLineOptions.setFPS(int), CmdLineOptions.setVisualization(bool)

  4. Implementing your own agent/controller.

    Develop your Controller or learning Agent using ch.idsia.agents.Agent interface in Java or Python. Have a look at example Controllers and Agents in package.

    In package competition you'll find out three packages: evostar, wcci, cig. One of them, cig, contains an example of a submission entry based on extending the BasicAIAgent. Another one, evostar, contains an example of submission created from scratch. Follow the very simple submission instructions carefully to get your Agents evaluated since evaluation would be done by a script. Study carefully the information provided by the Environment interface. 22x22 arrays are relative to the Mario perspective, the view is egocentric w.r.t. to a fixed point 11,11. getEnemiesPos() returns array of physical coordinates of creatures: i-th position is the type of the creature, i+1 is the x position of the creature, i+2 is the y position of the creature. getMarioState() contains the remaining useful information including time limit value and time left till the end of the level. At some point this knowledge might appear to be exceptionally essential and important. Creating helper methods within your package implement the getAction() method and ensure it follows the Rules.
  5. Join the Mario Competition Google Group to participate discussions

    6. Submit you best solution and win!