Algorithms

Progress!

To avoid spending time on the supporting logic (mainly, graphics, frameworks, etc), and to go cross-platform from the start, I decided to pick a language where I could focus on the game logic instead; Java. As an added benefit refactoring is a breeze with Eclipse.

Graphics

Coming from a MUD background, and having some experience with the effort that goes into graphics, using ascii appeals immensely. I decided to skip pure terminal output using jcurses, and to go with opengl, using the lwjgl library. Its a lot less work to set up, and allows some nifty tricks we wouldn’t be able to do otherwise.

As a total newbie with graphics under java This tutorial saved me a lot of time setting up lwjgl.

To the right you see the result of this first iteration. I finished locations, combining locations into chambers, queue rooms for digging, and basic A* pathfinding. Four happy dwarf Mind Flayers are digging out my new chamber. Note the Elder Brain sitting in its chamber.

Chamber Algorithm

The Chamber algorithm is interesting. Based on artificial borders (doors, etc) the algorithm assigns newly digged out locations to chambers, creating new chambers as needed. (See picture, each room floor tile appears in a different style). If a location is removed from a chamber, or if two nearby chambers are merged the algorithm disbands the room and reassigns all the rooms within to a new chamber.

Doing this will allow us to divine chamber function depending on its dimensions and the objects within it. It does require a player to properly enclose a room, but that’s a small price to pay.

With the basics in place its time to work on some gameplay elements, next!