Game Development Reference
In-Depth Information
The attack demo
Like our previous demos, we will start with a basic scene with a ground and walls. The
demos here will involve an enemy ship attacking a player, so add a ship to the scene,
name it player , and add simple controls to move the ship around. Also, tint the color
of the material to make the player ship stand out from the enemy ship that we'll add
in a moment. Of course, the player ship isn't an AI, so it doesn't need a RAIN AIRig,
but it does need to have a RAIN Entity component. With the player selected, go to
RAIN | Create Entity . Next, it needs a visual aspect for the AI enemies to see it; from
the Add Aspect dropdown, select Visual Aspect and rename the aspect to player .
This provides a base for our attack demo. This is how the RAIN attack demos will look
with a player ship:
Next, we need an enemy for the attack. The enemies will also be ship models, and as
we are focusing on just the AI, we won't worry about the actual game mechanics of
attacking, such as having the ship fire projectiles at the player, then having the player
respond to being hit, and so on. Usually, these kind of attack AI states involve playing
different animations for the AI, and we will explore these more in Chapter 10 , Anim-
ation and AI ; for now, we just need a simple visualization to illustrate the attack. To
visualize, we'll store a Boolean variable in RAIN's working memory flagging if the en-
emy is attacking and if so, start blinking.
To set this up, add a ship to the scene and add an AIRig to it by going to RAIN |
Create AI . To add an attack flag, select the RAIN Memory tab on the ship AI (the light
bulb icon) and from Add Variable , select bool . Rename the variable to isAttack-
ing and leave it to the default value of false. The memory with the isAttacking
variable set should look like the following screenshot:
Search WWH ::




Custom Search