Check for unknown capability 'logout' - Do you use an outdated Plugin?

Infinite Super Mario AI

The other day I saw that there is a Super Mario Competition for a conference in September 2009. I decided that this was a fun project to hone my AI programming skills and started to write a little path planning AI, using A*. The source code for this can also be found on this page.
Update (6. Sept 09): My Mario AI has won both Mario competitions this year, the ICE-GIC conference held at Imperial College in July and the IEEE Computational Intelligence in Games symposium in Milan in September! It was a really close decision between the first three solutions though (all of which are using A*). Yay! Check the slides of the competition presentation here. Source-code of my entry is below, other entries can soon be found on Julians page.

Videos

Android Live Wallpaper

A member from the XDA developer forum, Pikipirs, has ported Infinite Super Mario and my AI to Android and made an awesome live wallpaper! You can find more about it at the corresponding forum post.


Source Code

As the CIG competition is now closed, I've published the source code of my A* search bot here. The source code is annotated and reasonably well structured. However, it might not be the simplest to understand in parts, as it wasn't written to show how A* works, but hacked together in order to play Mario well. I've tried to make it clear what's what, though.
Download source code

Overview:

  • AStarAgent.java: The entry point of the source-code, called by the API. It calls the optimize() function in AStarSimulator.java
  • AStarSimulator.java: Contains the meat of the A* search. The SearchNode class contains a node, including its action, and a copy of the world state. The optimize() function sets up the A* planner, extracts the latest plan and returns an optimal action. search() contains the planning loop itself, which explores the search space.
  • LevelScene.java: This class contains most of the world-state, and holds the Mario-object and enemy objects.

How to get it to run:

  • Download the competition mario code from Julian's site.
  • Put my Mario AI into the src/competition/cig/robinbaumgarten/ folder
  • Launch \src\ch\idsia\scenarios\Play.java, changed so that it loads AStarAgent.java.
  • I've put some trouble-shooting hints on this page.

License

The source-code is published under the WTFPL. Basically, do whatever you like with the source code. Of course, if you use it, I'd be happy if you mention that it has been developed by me, and give me a heads up.

Quick FAQ

A* heuristic: Get to the right border of the screen as fast as possible. Avoid being hurt.

Development time: Didn't track it, my guesstimate is 20-30 hours for the core functionality. Another 30 for playing around with different heuristics.

Most headache: Java serialisation of the game state while searching, debugging the physics simulation engine.

Real time: It does run in real-time, although it needs a decent computer to get enough search depth to find its way out. With 24 fps, you get about 40ms each tick to plan. I search for several ticks before updating the search space to get a deeper searchdepth.

Does Mario still die? Yeah, sometimes he still falls into a pit (like it almost happened in the long video). When the AI can't avoid a spiky, it can get hurt (it might be able to avoid the spiky if it had more computing time, but the real-time constraint forbids this).

Best reply to the youtube video: “So I undestand correctly: da computer will play video games for us, so we have more free time? Way cool.”

More info: I've talked to Alex Champandard from AIGameDev.com about my Mario AI, read it here.

.