25.12.2012 Views

Ultimate Game Design : Building game worlds

Ultimate Game Design : Building game worlds

Ultimate Game Design : Building game worlds

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Building</strong> <strong>Game</strong> Worlds<br />

144<br />

U L T I M A T E G A M E D E S I G N<br />

USING TRIGGERS<br />

As we’ve seen, some behaviors are handled with scripts built in JavaScript/JScript,<br />

Python, Visual Basic, or another proprietary language. Increasingly, however, to<br />

complement simple script systems, complex trigger systems are used. A trigger is simply<br />

a switch that can cause an event, or series of events, to occur when tripped. This is<br />

sometimes called event handling.<br />

<strong>Building</strong> up and using complex trigger systems has a couple of practical advantages.<br />

First, value and parameter editors to control trigger properties can be built into Windows-based<br />

editors (GUI-based editors) quite easily. Second, designers and artists<br />

rarely have more than basic programming abilities (if any), so the property-editing<br />

nature and workflow of setting up trigger behavior is much easier for the<br />

nonprogrammer.<br />

The most powerful world-editing systems combine trigger functionality with<br />

line-item scripting (like the shooter behaviors using a sine wave). Triggers are usually<br />

placed in a scene and represented by icons in a 3-D scene within an editor. They are<br />

completely invisible to the player. Triggers can be used in a number of interesting<br />

ways to build up <strong>game</strong> behaviors.<br />

In most world-editing software, trigger properties can be set up to include several<br />

types of associated information. These include<br />

� True and false modes (to set the logical state or condition of the trigger)<br />

� Value fields (to enter radius, distance, strength, and offset information)<br />

� Text fields (to print a message to the screen for a player, or for testing purposes)<br />

� File pointers (to point to a file resource as part of a trigger event)<br />

Let’s look at a quick example from the very popular UnrealEd (version 3.0) showing<br />

the power of this kind of trigger-based editing. In many <strong>game</strong>s, when an actor is shot<br />

by a weapon, we frequently want to launch a resulting behavior of some kind. For a<br />

shoot trigger, a trigger that trips when it has been shot by a projectile weapon, we<br />

want to launch a behavior—maybe a further scripted event—or maybe we want to<br />

display a simple text message.<br />

Figure 6-5 shows that for an assigned shoot trigger type (TT_Shoot), when the<br />

trigger is tripped, a text message will be displayed: “Ouch, you shot me!”<br />

This is a simple example to be sure, but it reveals the power of having a field-edited<br />

trigger system at your disposal for shaping actor-based behaviors. Many <strong>game</strong> developers<br />

create similar systems to enable trigger-based behavior editing.<br />

It’s important to remember that triggers can be edited in a field-edited GUI-type<br />

tool (like the UnrealEd example), edited directly in the script code, or edited in both.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!