Genre: 2D Roguelike
Engine: Personal Engine in C++ with OpenGL
Development Time: 8 Weeks
Used XML data files to define attributes for map generators, monsters, factions, items, AI behaviors.
Game can be saved and loaded by using XML files.
Made a self-registering system to make new assets integrating easily.
Implemented A* pathing algorithm for enemy AI.
What Went Well
Did a good job on tasks design and time management
Did a good job on project design which makes project structure clean and organized.
State machine and String table are helpful
Gained experience with AI
What Went Wrong
What I Learned
UI design is not good and needs some work.
Dungeon generator function is not good. Need to work on the logic.
A* path finding
NPC behaviors and registration
Faction system functionality
Self-Registering Code / Factories
The self-registering system is part of the soul in this game. It allows the developer to add or edit features without changing game logic and game code. On the game code side, a factory system will handle registration and store information for new features.
A* algorithm is one of the well known pathfinding algorithms in game industry. It is very efficient and effective in static grid map. In this roguelike game, A* is used for NPCs' movement. It will make NPCs feel smarter. Each tile in the game map has its own properties and A* pathfinding system will change the cost for each step based on those properties.
Each map generator has its own logic to generate maps. For example, I can set 30% wall tiles and 70% air tiles. I can also set there is a 50% chance that a wall tile is surrounded by air tiles etc.. These can be defined by XML files or through codes. Players are allowed to regenerate maps before entering the game.
Saving and Loading System
The saving and loading system is a difficult part of this game. When I save a map, I need to save the original map and the map player has already detected it. When saving other entities, I will compare it with the prototype first and store the difference from the prototype. These differences may be caused by items, factions, stats... Also, IDs need to be saved for NPCs to handle faction system.
NPCs need to know what's the next step they should take if they have more than one behavior. To handle this problem, I put weight and rules on different behaviors. There is a "Think" function for each NPC which will figure out which behavior should be selected based on the weight every turn.