Grind - Enemies

Because of certain items - namely, the mind control - all enemies had to use the same controls as players. The AI had to be built around that, and as such, used code that simulated a fictional game controller to control their movements and attacking.

One of the more unconventional enemies was the Hopper. The Hopper was designed to slow players down and make them think. Whereas the Imps could be simply approached and slaughtered, the Hopper required thought - if you simply charged them, they'd fly off screen. You had to wait for them to attack before striking them in return.

Hopper AI was fairly straightforward, and used a simple state machine. It'd avoid players, then attack, then pause, and they could only be attacked while in the pause state. Having this behavior required minor integration with the levels. When a player approaches, it'd translate straight upwards off screen. Then it would look for null objects set in the level with a specific tag, and choose the one furthest from all players in the area. Then it would simply adjust its location to that null's location, and drop. Having null objects used in this way ensures that they are guaranteed to not teleport over a pit or too far from the players.

Hopper dodge nodes.

Hopper dodge nodes.



Grind - Level Tool Kit

Aside from AI development, the other major scripting role I had was to develop tools for the level designers to use to add functionality to their levels. As such, I created a "trigger" system comprised of a number of separate objects that could be chained together for various effects. For example, there was a simple "trigger" script that could be applied to an object and use its collision. This script would then be pointed towards another object. When a player activates that trigger, it would send an impulse to the next object, and activate particular scripts on that object, such as moving a platform into place, teleporting them to a new location, damaging them, displaying a message on screen, recording level-specific data (such as how many enemies a particular player had killed), and so on. Most of the individual components had the capacity to further activate another object, leading to the ability to daisy chain events together.

An example of the tool kit being used. When the players land on this platform, they collide with the collision box. When this box is touched by players, it activates both enemy spawners and the wall behind them. The wall has a mover script attached to it that runs on a timer. The players are forced to deal with the monsters before the wall behind them pushes them off the platform and into the lava below.