Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

9 Commits

Repository files navigation

MARIOAI

This repository is a python focused base for the Mario AI tool. All original code can be found in:

http://julian.togelius.com/mariocompetition2009/

Server configuration

Note: you need java installed and configured in your computer in order to run the server.

Whether execute the server.bat or use the following command inside the server directory:

java ch.idsia.scenarios.MainRun -server on

Marking a python bot

The original code provided by Togelius were simplified and can be found in marioai package. Now, you can simply inherit the marioai.Agent class and implement its methods. Use the following boilerplate:

class MyAgent(marioai.Agent):
def sense(self, obs):
super(MyAgent, self).sense(obs)
def act(self):
return [0, 0, 0, 0, 0]
def giveRewards(self, reward, cum_reward):
pass

Sensorial information

By default, the base agent store the following sensorial information:

  • can_jump: a boolean attribute that tells if the agent can jump or not.
  • on_ground: tells if the agents is touching the ground or not.
  • mario_floats: the Mario position on the level.
  • enemies_floats: the enemies position on the level.
  • level_scene: a 22x22 numpy array containing the elements of the level aroung the agent (Mario is at [11, 11]).
ValueMeaning
-11soft obstacle, can jump through
-10hard obstacle, cannot pass through
0no obstacle or enemy
1mario
2Enemy goomba
3Enemy goomba winged
4Enemy red koopa
5Enemy red koopa winged
6Enemy green koopa
7Enemy green koopa winged
8Enemy bullet bill
9Enemy spiky
10Enemy spiky winged
12Enemy flower
13Enemy shell
14mushroom
15fire_flower
16brick (simple/with coin/with mushroom/with flower)
20enemy obstacle (ex.: flower pot or parts of a cannon)
21question brick (with a coin or mushroom/flower)
25mario weapon projectile
42undefined

Control signals

Each position of the array represents a different action, use 1 to enable an action and 0 to disable it:

[backward, forward, crouch, jump, speed/bombs]

Example:

# send the agent to the right
def act(self):
return [0, 1, 0, 0, 0]
# jump backward
def act(self):
return [1, 0, 0, 1, 0]

About

Fork of the 2009 MarioAI code plus some additions to the Python client

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages