Project Title: Reaction AI
Development: ActionScript 3.0
My Role: Programmer
This project primarily explored path-finding within the current room structure, as well as the structure design for implementing further player classes. Overall, this provided an opportunity to explore some additional techniques to continue improving gameplay mechanics currently within the project.
Enemies, like the player, are considered units within the room system. Unlike the player, they follow a basic state machine designation, which currently only offers idle behavior. The enemy essentially starts by requesting a random wander location, requests a path to arrive at the intended goal, and then begins following an update procedure to move between nodes.
This meant that the current collision grid per room needed to be applied to a Tile Grid in order to initialize all node connections for the A* pathfinder. From there, the connection grid could be updated dynamically depending on wall alterations within any given room.
Paths that are generated are also smoothed, which means that the actual list of nodes is trimmed depending on the potential to reduce the amount of node steps required to reach the goal. For instance, an enemy crossing directly horizontally to a location does not need to account for all node locations along the way, and therefore the movement can be understood as a movement from Node[0] to Node[N], where N represents the final node of the linear movement.
This is done by ray-tracing, which determines when a direct connection between nodes eventually may yield a wall collision. When this occurs, the previously noted step of nodes is trimmed, and the smoothing begins utilizing the next node connection as the basis. The smoothing also accounts for the unit size, allowing for the detection of corners to prevent pathing units from seemingly clipping over diagonal locations with sharp edges.
Within the current system, around 150 enemies can wander around the screen without any overt issues, this is primarily due to the compact nature of each individual rooms. This could be further improved by enacting techniques such as creating a request queue, saving connection data, or multi-threading. To further enhance the gameplay, I added the feature of wave spawning. Within each room, there are also pink spawn locations for enemies. Level data allows for a dynamic list of spawn amounts and durations, enabling rooms to generate enemies over time that will wander around the area.
The player is consistently accounted for in the Tile Grid, allowing the player's location to be counted as a wall for pathing enemies. Furthermore, any enemies that would be pathing also can collide with the player. Upon collision, they only need to re-path based on the player's location. However, the player undergoes some basic collision resolution based on their velocity and interpenetration during the collision in order to more readily bounce off enemies. This allows the player to be repelled when colliding with enemies, and can generate some interesting interactions when surrounded by a mob of enemies that will push the player out.
While only the foundation is implemented, I also began building a system for a dynamic class selection process. Apparent at the start of the game, players can cycle through potential characters. Each character is a variation of the overall player structure, and therefore primarily only needs to alter the visuals, animations, and ability functions for the player. This allows for class interactions, status, and attacks to be treated universally by other gameplay systems. For instance, when the current Onslaught class attacks, its actual attack is sent as a general object to the Enemy Manager, and is handled as a generic area of effect damaging ability, which can also be applied to all other class abilities.
Going forward, I want to continue working with the AI of the game, as well as build onto the actual class structure. More than likely, I may move many of the current systems to another project type, allowing me to engage a different programming language, which should offer more when it comes to implementing graphics and multi-threading.