This describes the artifical inteligence and character controllers.They are using the fact, that game world is divided to squares, using position modulation. path finding and path node grid system is also used to carry out any movement tasks.
This is sub-layout for documentation pages
The AI here reffers to some logic, which allows to control the character (Player / Monster). So basically, even if user clicks on screen to move the character, there is AI which takes the command, and executes it.
We want to be able to control the character (move here, attack this character, use item -> navigate to item and use it),
and also make sure that ongoing command will be interrupted correctly.
We want to move character from path node \(A\) to path node \(B\).
For simplicity consider, that there exists direct link between \(A\) and \(B\).
This boils down to following actions:
The waiting queue is realized using simple linked list.
It is located in the CombatController, and there are commands being inserted. Each command inherits from the CharacterCommandBase class.
A command is always in one of the following states:
|NEW||The command has not yet been worked with at all|
|EXECUTING||unpack() hasbeen called upon the command instance|
|ABORT_REQUESTED||Abort for the command was reuested|
|TERMINATED||It is safe to remove the command. It ended / suspended its work successfully|
When command is added to quue, it has the NEW state.
When it is about to get executed for the first time, unpack is called, and state is chnged to EXECUTING.
When abort is called, the class instance is supposed to finish important work, and then set state to TERMINATED. Command witth such state is then removed from queue
Combat (how to attack melee, ranged, chase target) is explained here.