This post is kinda late….about 6 months late since I started working on my tile based game engine, codenamed Starlight Engine. Anyway, I’m gonna post a quick run through of my current progress, for my own reference in the future.

First a little details about the engine. The engine uses a stack based data structure, where screens are stored in the stack. Screens are basically everything you see in the engine, menus for example. Supposedly I’m currently viewing the main menu, and I pushed the start game button which will take me to the game screen. What happens is that the game screen is pushed to the top of the stack, and the engine updates it and stops updating the screen under it, which is the main menu. If I decided that I wanted to return to the main menu, the engine simply pops the top most screen from the stack, and renders the screen under it. This allows for a more simple way of handling screen transitions, of which I had various problematic encounters with in previous projects. The engine keeps a reference to all of the screens present in the game, and passing the references to classes that request for it.

For this implementation, the screens are updated from top to bottom of the stack, whereas rendering is done from bottom to top. This allow screens to only cover part of the window, while allowing stuff under it to show through. An example is shown below, with a message box only covering part of the screen.

A message box obscuring only part of the screen.

A central texture manager class is created to manage the textures that will be used throughout the game. The TextureManager class loads all textures during startup, and passes out references to classes that require them during runtime. This implementation is to ensure that the textures are loaded only once, and it is also better to reduce disk access later in the game as texture files could end up with a pretty large size.

I also successfully implemented my own text renderer into the engine, which uses bitmap fonts generated by AngelCode’s BMFont tool. This is the first time I’ve ever worked with bitmap fonts, and is quite a challenging experience. The fonts could be limited to wrap within an arbitrary amount of pixels, and can also be aligned left, right and center. Unfortunately, there are a few downsides of using this implementation. The fonts get distorted when scaled, and also adding in a new set of fonts is quite cumbersome.

Text could be aligned and set to wrap within a boundary.

So far, the most important GUI component needed for the game is a button. Creating a MouseListener class is relatively trivial as compared to adding font support. The buttons currently used in the engine are texture mapped quads, with the coordinates hard coded. This should be updated in future revisions.

The main menu, with four buttons. Note that the buttons are actually texture mapped quads.

For the character creation screen, the player will get to insert a name for their character, and therefore I have created a TextInput component. This was also easy, as I already have the font renderer at my disposal. Perhaps with this I could implement a debug console if the need arises.

The character creation screen. Here, the player can insert a name and customize his character.

And finally, after a few days of hair pulling I finally managed to put together basic tile support for the engine. It is currently in its early stages and quite useless, but it should get better after a few days. The tilesets I use are taken from this awesome site. The tiles are originally intended for use with RPG Maker, and therefore I also created a simple tool to expand the tilesets to tiles usable in my engine. Oh and also, I’m using Tiled as my map editor, as it seems to be the most recently updated map editor I could find. I would create my own editor if time allows…maybe after I graduate.

A very primitive tile engine.

And that should be it for now. I’ll update here after I have significant progress to show next time.