I worked with a friend on a simple console game BloodMoon for purely educational purposes, and took away a few key lessons. Similar to most projects I work on for learning, we built the entire framework without the use of any gaming libraries, though I did begin to implement an interface using the Python curses library for fancier console output.
One key aspect to this project was procedural level generation, for a unique Thief-style dungeon world with each iteration. The PokeyConfig class at the center of the PokeyWorks framework was one result of this collaboration. Among other lessons were player, item, and tile data structures. I made the decision a couple of weeks ago to consolidate some of these concepts, and I began programming what would become the PokeyGame, WorldGenerator, and Pathfinder classes that encompass most of the core game framework.
PokeyGame contains core data structures, like the game object (PokeyGame), map tiles (WorldTile), items, players, and more. While maps can be generated by any method desired by the ultimate game application, the included WorldGenerator allows levels to be generated by a procedural algorithm, then returned as a grid, or saved as a template file if invoked at the command line. In the process of putting this tool together, I found the need for a flexible path finding tool to ensure each level is passable.
I spent a few days researching A* and the other various algorithms, and decided to create a Pathfinder class that included multiple options. Since the maps being generated are grids with equal movement cost in each direction, the Greedy Best-First Search algorithm has had the best results thus far.
Code Samples :