Blueprint Scripting: Instructor A.I.
Design Goal: Script an instructor A.I., Marcus, to show his younger brother Arlo, the player character, how to move through the level and instruct him in the basic mechanics of the game.
Description: Early in the development of From The Ashes, I wanted to focus my design on accessibility. Platforming itself can be challenging enough for players, let alone first person platforming, grappling hooks and wall running. I thought it would be best if players had the chance to see someone else moving through the level to have a better idea on how to use their abilities correctly.
The script starts whenever an actor collides with a collision box attached to Marcus. Then the actor is checked to see if it is Arlo or not. If it is Arlo, then the current stage in the tutorial is triggered by the switch statement.
Once the tutorial stage starts, the collision box around Marcus is immediately disabled to prevent the script from being triggered while executing. Marcus then performs the given action which generally includes a mix of talking, moving to points, jumping and shooting a grapple.
At the end of each tutorial stage script the new tutorial stage value is set and the collision box around Marcus is reactivated, allowing the player to progress to the next stage.
Design Challenge: There were several challenges with scripting the A.I., the most frequent issue is how delicate the code is. Marcus linearly moves to specific points or moves relative to the direction he is facing. This meant even the slightest geometry changes would often break the A.I. and require rework.
The second and more difficult challenge was a combination of the above manual requirements and a taste of chaos theory in action. One section of the level features moving islands that rotate in a circular fashion. Because the A.I. only moves after the player finishes reading his text, the game doesn't control the orientation of the islands when the A.I. attempts to attach to them. As a result, even small differences in the initial state of the islands caused large differences in the final position of the A.I., oftentimes resulting in his death. A lot of effort was needed to normalize this chaotic system because testing is by definition inconsistent. After a lot of back and forth with the programmer to help with this issue, I had to tell the A.I. to apply movement input behind him, normalizing the chaos of his swinging motion and creating a consistently functioning A.I.