Game AI code synthesis from Statecharts: from time-sliced to event-driven

Home
Code Generation
Microwave Model
SpaceRacer AI Model
TankWars AI Model

Game AI code synthesis from Statecharts: from time-sliced to event-driven

Project Goals

  1. Refactored the Statechart Code Generator to reduce code duplication
  2. Create template to generate Java code
  3. Integrate model-based AI in SpacerRacer
  4. Fix any existing exporter to work with refactored generator and test them with an example

Project Step

  1. Refactore export into Class and State diagram - Done
  2. Recreate Python export - Done
  3. Recreate C++ export - Done
  4. Create Java export - Done
  5. Integrate Java generated code with AI module in SpaceRacer - Done
  6. Integrate C++ generated code with AI module in Tank Wars - Done
  7. Integrate Python generated code with microwave example - Done
  8. Integrate Cedric's C# code generator - Done

Development Diary

Thursday, December 21st, 2006
  • Update this page to reflect final state of this project.
  • Uploaded the formalism code and exporter.
  • Uploaded the formalism code.
Tuesday, December 19th, 2006
  • Finished the Python exporter.
  • Integrated C# exporter from Cedric's project.
Friday, December 15th, 2006
  • Finished the C++ and Java exporter.
Sunday, December 4th, 2006 Sunday, December 3rd, 2006
  • Updated website, added lots of pictures, but need to work on the text
  • Coding is going well, but support for the GEN command is a but tricky
Tuesday, November 28th, 2006
  • SCORE! SpacerRacer ship running over Atom3 code
Monday, November 24th, 2006
  • Lack of updates on this page doesn't indicate lack of progress on the project. Au contraire, work has been coming on along very well.
  • Create new types for the class diagram : methods, constructors, destructors and object reference.
  • Finished most of the refactoring.
  • Code generator for Java and C++ are about 50% built/rebuilt.
Monday, November 6th, 2006
  • Built this page.
Saturday, November 4th, 2006
  • Refactored most of the code generation into Python classes. Had to disable parameters and history to get everything to work thought.
  • Worked on the English template (Generate an English text file instead of code, useful for debugging generator).

Class Diagrams with State charts

The "Class Diagrams with State charts" formalism combines the expressive power of both Class Diagram and State charts and allow use to generate code. Class Diagrams are used to describe the composition of components and their relation with other components. The state chart is used to describe the behavior of a component.

In this project, we will use this formalism to model a game AI.

SpaceRacer

SpaceRacer is a Java-based racing game that was developed for 2006 edition of McGill's Be a Computer Scientist for a Week Summer Camp. This game allowed high school students to create an "AI" that could navigate a ship through a field of asteroid. At the end of the camp, we raced all the AI to compare the effectiveness of each student's strategy.

In this project, we are modeling a ship AI for the game using the Class Digram and State Chart formalism.

Files

  • Class Diagram with State Chart formalism and generators [zip]
  • Atom 3 SpaceRacer demo [zip] requires Java 1.5 (or better)
  • Atom3 Tank Wars Demo [zip] requires Windows and Glut

References

  • Model-Based Design of Game AI, Alexandre Denault, Jörg Kienzle and Hans Vangheluwe, 2nd International North-American Conference on Intelligent Games and Simulation, September 2006, p67-71
  • David Harel. Statecharts: A visual formalism for complex systems. Science of Computer Programming, 8:231 – 274, 1987.
  • Juan de Lara, Hans Vangheluwe, and Manuel Alfonseca. Meta-modelling and graph grammars for multiparadigm modelling in AToM3. Software and Systems Modeling (SoSyM), 3(3):194–209, August 2004.