Super Mario (El Personaje y las Mario AI Competitions)

20
DEL JUEGO, A LAS COMPETICIONES DE ‘CIENTÍFICOS’ ABURRIDOS

Transcript of Super Mario (El Personaje y las Mario AI Competitions)

DEL JUEGO, A LAS COMPETICIONES DE ‘CIENTÍFICOS’ ABURRIDOS

Culturilla Videojueguil (I)• Mario es un personaje (fontanero) de

Nintendo creado originalmente por el japonés Shigeru Miyamoto.

• Apareció por primera vez en el juego arcade Donkey Kong (1981), con el nombre de Jumpman.

• Después (en 1983) paso a ser el personaje principal (junto con su hermano Luigi) de un nuevo juego arcade, Mario Bros.

• En ese mismo año, pareció Super Mario Bros., juego estrella en el lanzamiento de la primera consola familiar de éxito, la NES.

Su nombre lo tomó del propietario de las oficinas de Nintendo (Mario Segali). El nombre ‘completo’ es Mario Mario, de ahí que sean los Mario Brothers.

Culturilla Videojueguil (II)• Mario ha aparecido en más de 200 juegos, siendo el

abanderado de todas las consolas de Nintendo, desde Super Mario Bros. en NES, hasta Super Mario Galaxy 2 en Wii.

• El mejor sin duda es Super Mario 64. Reconocido a nivel mundial por los videojugones.

¿Y son buenos esos juegos?. Ventas (I)• Ventas por Sagas, considerando sólo los juegos de plataformas de Mario.

0 50 100 150 200Millones de Unidades

Mario

Final Fantasy

The SIMS

Resident Evil

Tomb Raider

Street Fighter

Ventas globales hasta 2007

¿Y son buenos esos juegos?. Ventas (II)• Ventas por Juego.

0 10 20 30 40 50Millones de Unidades

Super Mario Bros. (NES)Tetris (GB)

Duck Hunt (NES)Super Mario World (SNES)

Super Mario 64 (N64)Mario Kart 64 (N64)

Ventas globales hasta 2007

0 10 20 30 40 50 60 70Millones de Unidades

Wii Sports (Wii)

Wii Play (Wii)

New Super Mario Bros. (NDS)

Mario Kart Wii (Wii)

Call of Duty: Modern Warfare 2 (PS3,360)

New Super Mario Bros. (Wii)

Assasins' Creed 2 (PS3,360)

Final Fantasy XIII (PS3,360)

Metal Gear Solid 4 (PS3)

Batman Arkham Asylum (PS3,360)

Ventas globales hasta 2010

¿Y de qué va?• Bowser ha secuestrado a la princesa del Reino Champiñón

(Peach) y la ha llevado a su castillo.

• Mario y Luigi deben recorrer los niveles, saltando plataformas, esquivando enemigos y entrando en tuberías hasta llegar al final.

¿Qué hace Mario?• Las acción básica es saltar. Se ‘usa’ para

todo:

• Además de romper bloques de ladrillos con la cabeza

• Para coger monedas e items que hay ‘dentro’

Superar obstáculos, evitar huecos

Eliminar enemigos

Enemigos, Trajes e Items• Hay muchos enemigos, entre ellos, las tortugas.

Amigos• Toad: un tio-champiñón que

siempre nos da la noticia de que han secuestrado a la princesa al principio del juego.

• Yoshi: un dragón/dinosaurio que sirve de montura en muchos de los juegos de Mario. Come enemigos y los transforma en huevos que puede lanzar. Mario también lo utiliza para llegar más lejos en los saltos.

Repercusión• Fue antológica su rivalidad con Sonic, la mascota de SEGA.

• Mario se ha convertido en un personaje famoso más allá de los videojuegos.

¿Y esto interesa a los científicos?• Como muchos juegos, cumple

con ciertas reglas de la física (saltos, trayectorias, inercia,…).

• Para nosotros, es interesante desde el punto de vista de la IA..

Marco de Trabajo• Existe un código fuente abierto (en java):

http://www.idsia.ch/~sergey/files/marioai/MarioAI+Benchmark.zip

• Que podemos modificar a nuestro gusto.

La IA de un Agente (I)• El agente se basa en una visualización de su entorno cercano (como un

jugador real), y no conoce la configuración del escenario completo.

• Environment contiene matrices de 22x22 centradas en Mario con las percepciones cercanas.• getEnemiesPos() array de posiciones de enemigos (con su tipo).• getMarioState() información del estado de Mario.

La IA de un Agente (II)• Para construir la IA de un agente, se implementa el método getAction().

public boolean[] getAction() { // this Agent requires observation integrated in advance.

if (mergedObservation[11][13] != 0 || mergedObservation[11][12] != 0 || DangerOfGap()) { if (isMarioAbleToJump || ( !isMarioOnGround && action[Mario.KEY_JUMP])) { action[Mario.KEY_JUMP] = true; } ++trueJumpCounter; } else { action[Mario.KEY_JUMP] = false; trueJumpCounter = 0; }

if (trueJumpCounter > 16) { trueJumpCounter = 0; action[Mario.KEY_JUMP] = false; }

action[Mario.KEY_SPEED] = DangerOfGap(); return action; }

Ejemplo del ForwardAgent

Niveles de Zoom (2 y 1)• Son diferentes niveles de percepción de los agentes, con más o

menos detalles.

• Zoom 2: 0 si no hay obstáculo/enemigo, 1 si hay obstáculo/enemigo

• Zoom 1:

LevelScene0  no obstacle-10 hard obstacle, cannot pass through-11 soft obstacle, can overjump20 angry enemy flower pot or parts of a cannon16 brick (simple or with a hidden coin or with a hidden mushroom/flower)21 question brick (with a coin or mushroom/flower)

Enemies0 - no enemy in a cell2 - Enemy that you can kill by shooting or jumping on it (KIND_BULLET_BILL, KIND_GOOMBA, KIND_GOOMBA_WINGED, KIND_GREEN_KOOPA, KIND_GREEN_KOOPA_WINGED, KIND_RED_KOOPA, KIND_RED_KOOPA_WINGED, KIND_SHELL)9 - KIND_SPIKY or KIND_ENEMY_FLOWER (cannot kill by jumping, but can kill one of them by shooting; hint: FLOWER is only above the flower spot and always above ground)25 - KIND_FIREBALL, mario weapon projectile.

Niveles de Zoom (0)• El nivel más detallado.

• Zoom 0:

LevelSceneAparte de lo que hay en el motor del juego (accesible mediante funciones).16  brick, simple, without any surprise.17 brick with a hidden coin18 brick with a hidden flower //are mapped to 16, prevents cheating21  question brick, contains coin22  question brick, contains flower/mushroom

Enemies public static final int KIND_NONE = 0;    public static final int KIND_MARIO = 1;    public static final int KIND_GOOMBA = 2;    public static final int KIND_GOOMBA_WINGED = 3;    public static final int KIND_RED_KOOPA = 4;    public static final int KIND_RED_KOOPA_WINGED = 5;    public static final int KIND_GREEN_KOOPA = 6;    public static final int KIND_GREEN_KOOPA_WINGED = 7;    public static final int KIND_BULLET_BILL = 8;    public static final int KIND_SPIKY = 9;    public static final int KIND_SPIKY_WINGED = 10;    public static final int KIND_ENEMY_FLOWER = 12;    public static final int KIND_SHELL = 13;    public static final int KIND_MUSHROOM = 14;    public static final int KIND_FIRE_FLOWER = 15;        public static final int KIND_PARTICLE = 21;    public static final int KIND_SPARCLE = 22;    public static final int KIND_COIN_ANIM = 20;    public static final int KIND_FIREBALL = 25;

    public static final int KIND_UNDEF = -42;

Competiciones• GamePlay se debe crear un agente que recorra de forma

autónoma los niveles, intentando coger el máximo número de monedas, eliminar al máximo número de enemigos y tardar el menor tiempo posible en superar cada nivel.

• Learning

• Level Generation se deben crear niveles (haciendo uso de las funciones propias), que cumplan una serie de propiedades y que se ‘adapten’ a los gustos del jugador.

Generación de Nivelespublic class RandomLevel extends Level{

//Store information about the level public int ENEMIES = 0; //the number of enemies the level contains public int BLOCKS_EMPTY = 0; // the number of empty blocks public int BLOCKS_COINS = 0; // the number of coin blocks public int BLOCKS_POWER = 0; // the number of power blocks public int COINS = 0; //These are the coins in boxes that Mario collect

private static Random levelSeedRandom = new Random(); public static long lastSeed;

Random random;

private static final int ODDS_STRAIGHT = 0; private static final int ODDS_HILL_STRAIGHT = 1; private static final int ODDS_TUBES = 2; private static final int ODDS_JUMP = 3; private static final int ODDS_CANNONS = 4; private int[] odds = new int[5]; private int totalOdds; private int difficulty; private int type; private int gaps;

Ejemplo del ForwardAgent

public void creat(long seed, int difficulty, int type) { this.type = type; this.difficulty = difficulty; odds[ODDS_STRAIGHT] = 20; odds[ODDS_HILL_STRAIGHT] = 10; odds[ODDS_TUBES] = 2 + 1 * difficulty; odds[ODDS_JUMP] = 2 * difficulty; odds[ODDS_CANNONS] = -10 + 5 * difficulty;

for (int i = 0; i < odds.length; i++) { totalOdds += odds[i]; odds[i] = totalOdds - odds[i]; }

//create the start location int length = 0; length += buildStraight(0, width, true);

//create all of the medium sections while (length < width - 64) { length += buildZone(length, width - length); }

• EvoStar Competition Event: April 8Deadline: April 1

• WCCI Competition Event: July 18-23 (TBA)Deadline: July 11

• CIG Competition Event: August 18-21 (TBA)Deadline: August 18

Fechas importantes