Java: Noughts and Crosses

Yet another AI project, a classic Noughts and Crosses (Tic-tac-toe) game. I guess this one does not need any comments. Built similarly as the previous AI games.

Download the source code: NoughtsAndCrosses.zip (113 KB)

Java: Traveling Salesman Problem

Another AI project, where we had to solve the Traveling Salesman Problem. My solution is quite dumb, basically it is a simple heuristical search, where the tour of the cities is calculated by alwasy traveling to the nearest not yet visited city. I guess I put more effort into the graphics than into solving the problem itself, nevertheless I got max points to the assignment. The program uses Swing to draw graphics and the interface is in Estonian again.

Download the source code: TravelingSalesman-
Source.zip
 (4.6 MB)

Java: Kalah Game

In University, I took a course called Artificial Intelligence (AI) which was an introductory course to AI and had home assignments where we had to program various games and use some AI method for the game logic. One of those games was Kalah, and my version used ther Minimax algorithm. The graphical user interface is made with Swing and the graphics is made by me. The interface text is in Estonian.

Download the Kalah game binaries and source code: AI-Kalah.zip (376 KB)

Java 3D: Rubik’s Cube Game

Since I like 3D graphics so much, I've always wanted to program a 3D game from scratch. In the beginning of 2007 (can't remember exactly, silly brain!) I decided to try out Java 3D and create a Rubik's Cube solving game. I'm not very good at solving the cube in real life, I've only solved it a few times altogether but that doesn't mean I couldn't create a simple game about it.

So, I researched the ways one can do 3D in Java and found this library called LWJGL (Lightweight Java Game Library) which uses OpenGL to render 3D graphics. LWJGL is not a game engine, it just enables the developers to get access to 3D graphics, input and sound to write their own game code.

It can't say much about the experience writing the game with LWJGL since it was quite a long time ago and I don't remember the particulars any more (silly brain is silly again). I do remember that getting the whole thing up and running was not as hard as I imagined.

Download the source code and binaries (currently for Windows only) here: RubiksCube.zip (3 MB)

About my current programming project…

For about a year now, I've been working on a little cross-platform C++ library that would help put together 3D OpenGL games. I say a library, because I don't really want to make a game engine, I just want to keep common boilerplate code somewhere separate. I'm developing this library mainly for learning purposes, I do not intend to offer is as a actual game development library.

It all started when I bought two game programming related books - the Game Programming Gems and Game Coding Complete (3rd edition), which is an excellent and well-written book. The books gave me quite good understanding about what game programming is like and also provided many useful code snippets (such as the event system and hashed string from Game Coding Complete).

So far, I have managed to create a simple model viewer using my library. I've got OpenGL 3 functionality (I'm not using any fixed functionality... at least I try not to) as far as having a custom matrix stack, the renderer draw the scene into a frame buffer and display it on screen, I've just got diffuse and specular lighting working with GLSL shaders. I've also implemented a basic GUI system, which can draw images, buttons and text on screen and react to mouse input. There is also an in-game Quake-style console for sending commands to the application and a basic component based entity system that still needs a few quirks sorted out.

My library also supports Bitmap and TrueType fonts. I'm using the FreeType library for the TrueType fonts, and I'm just rendering the font glyphs to a texture during runtime (at initialization) to get pixel perfect fonts. If you are interested in the code, I might just make a post about it.

I'm currently only using a few 3rd party libraries including Boost, FreeType, GLEW, GLFW and GLM (which is an excellent math library by the way!). Probably some more libraries will be added later for sound and networking. At first I was using SDL for window creation and input polling, but then switched to GLFW, because it is more lightweight and more OpenGL oriented.

I've split the library into modules such as Core, Renderer, Input etc. so each module can be compiled into a separate DLL or linked statically to an executable (preferred way). I'm using Boost.Build as the build system, since I found it relatively easy to get started with. I might switch over to CMake at some point though, because it seems to be more popular and easier to use perhaps...

I will continue developing this library at least to a point where I can make a reasonable little 3D game with sound and networking... perhaps a pong sort of game. If you are also interested in game programing, I would definately recommend the books mentioned above and also theses sites: Game Development on StackExchange.com and GameDev.net.

Here are a few screenshots of the model viewer: