Monday, November 26, 2012

Controlling A Fighter

Disclaimer: This blog post is a little more boring than normal, it talks about how I set up the new controller for the fighter characters. Basically it's about how I refactored the old controller into a more modular setup and improved upon the systems individually.



The new Character Controller is a huge improvment to the Superverse expereince, designed to allow designers a great deal of control over the way fighters interact with one another, as well as create an easily expandable, modular base from which to allow developers to continue creating and implementing new functionality.


The Superverse FighterController System is broken into several parts, each a behavior on the same object. The behaviors all inherit FighterControllerBehavior, which inherits the project's BaseBehavior. All FighterControllerBehavior have convenience functions for accessing fellow behaviors, as well as certain resources, such as the raw control data.


All FighterControllerBehavior follow the same class naming convention: Fighter[Responsibility]Controller


They are as follows

FighterMovementController
Responsible for moving the fighter around the map. Handles nothing about fighting moves. Uses only the movement aspect of controls. Will handle lower animations (idle - crouching - jumping - walking - running) when those are present.

FighterInputController
Responsible for updating the inputs, and reading particular changes. Acts more as an input util for other behaviors, especially Movement and Primary.

FighterCollisionController
Handles collision data from the FighterColliders. Uses a bitmask to figure out which ones it is listening to. Forwards hit in its own event if bitmask return match.
FighterColliders are behaviors that manage the individuals section of the biped. Each can have the bit they represent set, or can calculate it based on the name of the object they are on (convenience for operating with Max's Biped Rig) They each know their parent controller, and send hit to it with their bit flag.

FighterPrimaryController

Controls the animations and handels the general state of the fighter. Uses most of the other controllers to do so, wither directly or through events.

They are:

Fighter Statistics:
Handles the players energy, as well as defense and other aspects, currently controls gui as well.
Respawner:
Respawns player on death, currently would be used if they hit the killing volume.

Material Flasher:
Flashes all the renderers that are children of the behavior a different color and back.

There are also components like behaviors that act as data components and utilitys.


FighterStatistics:

There are also AttackBehaviors, classes that use energy and have a delay to for the special attacks that the player will use









No comments:

Post a Comment