Enemy Instruction Example:

On Midnight Star, we used a mixture of spreadsheets and UnrealScript to create enemy behaviors. Below is an example of of a simple instruction that causes the enemy to telegraph their attack with a sound cue and particle effect that lasts an amount of time specified in a spreadsheet. This was designed to give the players time to either proactively deal with the enemy by killing it or react with their shield.

state Ins_Telegraph
     EndState( Name NextStateName )
          //CurInstruction.DurMin is the amount of telegraph time. This is "charging" portion of the effect. At its completion it fires the burst portion.
          //CurInstruction.DurRange is the duration of the "burst" portion of the telegraph. This is a fixed duration.
          CurInstruction.DurMin[0] * ( 1.0 + MyGameInfo.GPMultipliers[eGM_Enemy_TelegraphDuration] ));
          Sleep( (CurInstruction.DurMin[0] * (1.0 + MyGameInfo.GPMultipliers[eGM_Enemy_TelegraphDuration]) + CurInstruction.DurRange[0])  );
Telegraph( float Duration )
     if(PreFireSound != none)
     if (TelegraphPSC != none)
          TelegraphPSC.SetFloatParameter('Duration', Duration);

The above script is implemented through an excel spreadsheet where enemy actions are created. The duration is set to last 1 second with a 0.125 delay before projectiles begin firing. The duration of the telegraph is affected by a multiplier depending on the difficulty setting the player has chosen.


Result (the charge up effects before enemies fire):

Enemy Action Example:

The first boss the player faces is the Colossus, a hulking mass of flesh and machinery hell bent on destroying the player. The Colossus is a fairly straightforward fight. He has only 3 attacks: turret fire, rubble toss, and bull rush. The player uses mechanics they have utilized throughout the game to beat him – use the shield to block turret fire, destroy the rubble before it’s thrown, and perform a successful melee attack to dodge the bullrush. Below is how the turret fire attack is scripted to work:

These are all the instructions used to create the Colossus turret fire attack.

Ins_CancelAction: The script ensures that there are gunners in the turrets, otherwise it bails out of the action.

MoveToNode: Instructs the Colossus to move to a fire point the action table previously chose.

INS_OffscreenPause: A common instruction that delays the enemy from attacking if offscreen. The player receives a UI notification they are about to be attacked. This duration varies depending on difficulty, making it easier for casual players to maintain their rhythm.

INS_TogglePlayerFocus: If the player is not focused on an enemy or pickup, the camera will be adjusted to bring this enemy onscreen.

Posture: This is used to call anims, this specific entry will play the AimCallout anim in the Stand posture (a roar that makes the Colossus’ mouth vulnerable to attack.)

INS_MergeAction: Inserts other actions defined elsewhere in the spreadsheet. These are commonly used actions shared between enemies, here it’s most importantly used to call the action to fire the turrets. (This action is detailed below.)

Cooldowns: One of the key components to Midnight Star is making sure that no enemy is too aggressive and that a variety of attacks are occurring. The Action Cooldown applies to this specific action of firing the turrets. This is set to 20 seconds unless the Colossus is in its Aggressive mood with a 6 second cooldown. The Channel Cooldown for the Colossus is the Boss Channel which means there will be a 7 second cooldown. The Token Cooldown controls how often the enemy can receive permission to attack. The Colossus only has a 1 second cooldown in case all other enemies are dead at which point it berserks and will constantly attack the player.

The rest of the actions clean up the Colossus attack, having it play a postfire animation that makes it vulnerable to counter-attack and then have it retreat to the background while other enemies assault the player.

In this action, many of the same instructions are used. Conditions are used to have instructions that will make the attack easier to deal with on easier difficulties.

Squad Action: This is used to instruct other members of the Colossus squad. There are 2 gunners present that fire at the player. This action instruction tells them to fire at the player. If the gunners are killed, the Colossus will bail out of the action early.

Pause: This is used to have the Colossus idle for the set duration. In this instance, the pause is used to increase the delay between bursts of fire on easier difficulties.

Enemy Animation Scripts:

Each animation called in Midnight Star has a series of Anim Notifies which interact with instructions in UnrealScript. This animation is the callout before the Turret Fire attack. I worked with our animator to polish the timing on the various effects, specifically when to toggle weakpoints such as the Colossus’ mouth.

The Colossus fight can be seen below in its entirety.

Cinematic Example:

On Blink, we had an opening cinematic where the protagonist teleports into an elevator shaft and after being bounced around, learns how to teleport at will. A portion of the matinee sequence I created is shown below.