UnrealScript Game Programming Cookbook

(Chris Devlin) #1

2


Archetypes and Prefabs


In this chapter, we will be covering the following recipes:


f Construct a leaking pipe prefab
f Adding particles to our prefab
f Adding audio effects to our prefab
f Create a PointLight archetype
f Create a subarchetype from an archetype

Introduction


As a programmer, one of your tasks is to assist the level designers. This can be done
in a number of ways, but one of the most useful ways is to create what are known as
prefabs and archetypes. By creating templates for objects and actors and only exposing
the variables that a designer will find to be useful, you can make your work, and that of a
designer, far more efficient.


So with that, let's talk about prefabs.


Prefabs


A prefab is a combination of multiple actors into one unit. This allows us to easily manipulate
the properties and visuals of multiple objects on screen at once.


For example, if you wanted to use a torch in a game, you could grab a particle effect for the
fire, another for the smoke, then a static mesh for the torch handle, a sound effect instance
for the crackling sound, and finally a light source for the lighting. Or you could combine all of
these objects into one actor and call it a torch.

Free download pdf