Town
A Data Driven Roguelike Game
Overview
|
Features
Self-Registering Classes
Self-registering class is a feature that allows developer to add new features without change any of the game logic and code. In the source file of each self-registering class, it specifies its own register name, and the game code will initialize a 'Factory' system that uses the name it registered as key to store all the information accordingly.
|
A* Pathfinding
A* is a well-known algorithm that is widely used in pathfinding and graph traversal. This project applies A* as a pathfinding method for each NPC to create an intelligent behavior. In this project, each tile has its own move properties, based on that properties and move properties on each NPC , the algorithm will adjust its g-cost, so the NPC will change their path accordingly to create more organic and realistic feeling.
|
Per NPC Faction
Fiction is a feature that create more dynamic in this game world. Each race has its own initial faction setup against different races. For example, orcs is allies with wolves, but enemy with elf. The faction of each NPC will adjust based on what they saw in the game world. And the adjustment will only affect the NPC itself, for example, if the player killed a wolf, and been spot by orcA, orcA will have negative feeling about player, but orcB will not change it's faction set.
|
Prefab Room Generation
In order to make it add flexibility for developers to generate specific environment setup. This project allows developer to pre-define layout of rooms in XML files under prison map type. Based on the attributes of each room, the map generator will place each room in a proper location in a prison map.
|
Data-Driven NPC Actions
The framework of actions of each NPC is similar to a component system. Behaviors of each action is defined by its own self-registering class. Based on the setting of each NPC in its XML file, the framework will assign actions on each NPC accordingly, and create different behaviors. With this framework, designer can easily combine with different actions to create NPCs with different behaviors.
|
Code Snaps [Github Link]
-
TheGame.hpp
-
TheGame.cpp
-
PathFinding.hpp
-
PathFinding.cpp
-
NPC.hpp
-
NPC.cpp
-
NPCFactory.hpp
-
NPCFactory.cpp
<
>
Demo Video
|