After taking the course CS7032: Agents, AI & Games at Trinity College, Dublin. We were asked to design and implement an artificial intelligence algorithm for the famous PacMan game, under the rules of http://pacman-vs-ghosts.net/ (Which seems to be down as of now) and using our knowledge of abstract architectures.
We could choose to design either the behaviour of Ms PacMan or the phantoms. I though implementing Ms PacMan AI would be “faster” as there’s only one entity to design. Never have I been so wrong. It took me around one week of spare time to get it right. Though in the end, I got some acceptable results.
The core AI algorithm is inspired by reactive agents and the evaluative feedback approach. I ran around a thousand games with multiple strategies and identified the best one by plotting the score histogram. The results are on the report.
One algorithm which I found particularly interesting is “Clustering regions by connected components”, which is a linearithmic algorithm with respect to the number of components. This algorithm has certainly many different use cases outside the PacMan world. I explain this algorithm in the report. A screenshot showing the pills clustered by region:
The project is open source and is hosted on github. Feel free to browse the code and adapt it to your needs: MyPacMan.java
Without further ado, here you have the full report. Enjoy the reading!
NB: the report was rendered using LaTeX and the graphs where plotted using Mathematica 9.
Long live Java
The following web app illustrates how easily Java and WebGL can be used together with Libgdx game development framework to create fancy 3D scenes.
Click on the image to see the webGL app. Note: you’ll need a WebGL compatible browser such as Firefox or Chrome.
A screenshot of the webGL application.
Instructions: use the arrow keys to move the camera and drag the mouse to rotate the camera.
Notes about the code
- The code uses WebGL which is pretty much OpenGL ES 2.0.
- The sky and mountains background texture (a.k.a Skybox) are rendered using cube mapping and custom shaders.
- There is one shader program for rendering the water which is based on the excellent Jay Conrod’s water simulation shader. The water looks jaggy because there aren’t many triangles in the model. Feel free to change this.
- The boat 3D model comes from here and the texture from here.
- The teddy bear comes from here (if you know the original source, let me know).
- All models were exported to G3DT format using blender.
NB. The code will be available on github in the coming days.
Edit: The code is available here: https://github.com/recastrodiaz/java-webgl
Cross-platform game development
The holly grail of developers is to code once and run everywhere. Unfortunately, this is hardly true as platforms are extremely different from each other. Furthermore, screen sizes and input devices are not the same. Nevertheless, the Java ecosystem provides great multi platform support out of the box. Add GWT and Monotouch to the mix and you’ll support Mac, Windows, Linux, Android, HTML5 and iOS from day one. Check the following cross-platform gaming frameworks to see how it can be done: PlayN and Libgdx.
Born as an informatics project, a new game has arrived: Phiball.
It’s the result of the work and effort of a very active and motivated team.
The game is in fact a mix of the classic Brick Breaker game with sophisticated physics and ‘à la Mario’ stars. It’s a java based game and uses pulpcore and jbox2d under the hood.
Try to reach all the stars in each of the 10 levels by shooting the canon. Hint: you can change the ball’s impulse by varying the time you press the left mouse button.
Tell us what you think !
You can play it online here.