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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

150<br />

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

Even simpler, we might just want to cause a couple of shafts of light to stream into<br />

a room onto a relic, a magical sword, or a hero helper character. We can also use a<br />

light trigger to build this behavior.<br />

This sample shows how to create a spotlight on the hero helper when a player is<br />

near them:<br />

// JavaScript sample of "light" trigger support<br />

if(player.nearHeroHelper()) {<br />

createSpotlight(heroHelper);<br />

}<br />

BUILDING BEHAVIORS<br />

You’ve now seen some basic script examples and experienced some of the power in<br />

using triggers. <strong>Building</strong> behaviors often requires using a measure of both. It’s important<br />

that you learn enough about scripting and triggers to combine their power together<br />

into building behaviors. Let’s look at another example that demonstrates how you<br />

would use trigger information to control entire groups of creatures.<br />

Creature Creator<br />

Sometimes you will want to use triggers to control the behavior of prop creatures for<br />

pure visual effect. These might include insect swarms, flocks of birds, or schools of<br />

fish. Depending on your script system specifics, sometimes you will use commandline<br />

entries (like the sine wave attack pattern), and other times you will simply set<br />

properties in a tool—properties that define how your trigger is going to behave.<br />

So, suppose we set down a trigger of the type creature_creator. The kinds of properties<br />

we might edit for its behavior include (but are not limited to) the following:<br />

� The maximum number of creatures generated (let’s say, 10)<br />

� Which type of creature will spawn? (We might have 15 choices here, bug_1,<br />

bug_2, fish_1, fish_2, and so forth. Sometimes we can even spawn the same<br />

trigger with two or more types—like two different kinds of bugs coming from<br />

the same hive. We might “hide” the trigger inside a hive actor in the scene.)<br />

� What is the spawn radius, in units? (How far around the trigger will these<br />

creatures spawn?)<br />

� What is the spawning rate or speed? (How fast will these creatures spawn?)<br />

� What is the spawn life? (How long do these creatures “live” on the screen<br />

before they die off or disappear?)

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

Saved successfully!

Ooh no, something went wrong!