Creating Your Own Worlds with the Unreal Engine
You now have a rudimentary grasp of the engine, its components, and how they work together to present an actual game. Now, let’s start looking at what you, the game designer, need to create in order to actually use the engine in your own games.
(And, by the way, not just games. The worlds you create are entirely up to you. The Unreal Engine can be used for virtually any visualization project. Imagine attending a bid meeting for a large-scale construction job, and showing your potential client a fully interactive 3D walkthrough they can control, powered by the jaw-dropping visuals of Unreal Engine 3. Ka-ching—sale made!)
Virtually all data that the Unreal Engine uses is stored in packages: collections of the assets needed for your game or project. Packages are often separated by the kind of assets they contain. You might, for example, have a package called ComputerMeshes that held only the static meshes needed to construct a game scene. However, you might also include the textures for those meshes in the same package.
In the end, just think of a package as a container used to load assets into the game. Except for maps (which in a sense are their own packages), all game assets are contained within packages. You learn more about each kind of asset as you move through this book.
Maps, also called levels and sometimes called scenes, are where you create environments in the Unreal Engine (see FIGURE 1.19).
Figure 1.19 Maps are the actual levels you play in the game.
Technically, a map is simply a collection of various game assets that are shown to the player, with many of these assets pulled from the packages you’ve created. Artistically, the map is where you set the stage for your game or visualization experience. It’s where you construct the overall shape of your environment, and use your assets to decorate it and bring it to life.
For convenience, each map contains its own package, where you can store assets that are only used in the game level the map displays. Most assets, however, are stored in separate packages, where they’re accessible to any level that needs them.
If you place an asset in a map’s package, but don’t actually use it the level, it is culled from the map’s level package next time the level is saved. For example, imagine that you add the texture of a brick wall to your level’s package, but you never actually display a brick wall. Unreal Engine 3 realizes it doesn’t need to waste precious memory on that brick wall texture, and dumps it from the package.
Textures and Materials
As you probably realize by now, both textures and materials are stored in packages. Textures are simply 2D images used to create materials in your levels and on other game assets (see FIGURE 1.20). We dedicate a whole chapter to materials and textures; for now, just know that every visible surface you create has a material applied to it, and most materials contain at least one texture. Think of a texture as part of a material: the 2D image that supplies color and other important information. Think of a material as an instruction for how light plays on your object’s surface. In Unreal Engine 3, each surface must have a material applied, and the material contains textures and other rendering instructions. (There’s a lot more to it, but that’ll hold you for now.)
Figure 1.20 Two different textures: one painted in Photoshop and the other acquired with a camera
Some textures, such as normal maps, present an illusion that the surface has much more physical detail than your hardware can actually render. Through the use of normal maps, models that are only comprised of a few thousand polygons can look like they were constructed from millions of polys!
You create textures using 2D graphics software that isn’t part of the Unreal Engine—for example, Photoshop, ZBrush, or Painter. You can also use images you’ve captured with digital cameras or scanners.
Once you have created your textures, you use them to create materials within the Unreal Editor. A single material can use multiple textures (though using too many can waste precious system resources). These materials can be applied to any surface in your maps. More on this in Chapter 6, “Introduction to Materials.”
Like textures, sounds must be created outside of Unreal Engine 3. You can use an external software application, or get your sounds from audio file compilations, such as sound effect CDs or royalty free sound files available online. Sounds are usually played in response to events during gameplay, such as the opening of a door, the starting of a lift, or the firing of a weapon. Ambient sounds—for instance, running water, chirping crickets, or running machinery—might also run throughout an entire scene.
Once you’ve imported your sounds, Unreal Engine 3’s SoundCue Editor gives you tremendous flexibility in how you use them. You can mix multiple sound effects into a single sound, play certain sounds randomly, and even adjust the volume, speed, and modulation of individual effects. Using the SoundCue Editor, you can transform even the simplest audio into a complex and powerfully realistic symphony of effects.
Using Kismet, Unreal Engine 3’s embedded visual scripting system, you can also create complex music systems that play certain songs and effects in response to specific events, such as when a player’s health drops below a certain level, or when the player accelerates to high speed.
We’ve already referred to static meshes a couple of times, in passing. As you work with Unreal Engine games, you use them constantly. So, what exactly are they?
Let’s step back a bit. In 3D graphics, objects are built from polygon meshes—collections of vertices, edges and faces that define the shape of objects. Different kinds of polygon meshes behave differently. You can do different things with each, but some work faster than others. Static meshes render really fast, and you can use them to create very complex shapes, which makes them great for gaming. They can’t be used for everything, however. (Among their limitations, you can’t animate their vertices.) But most modern Unreal Engine 3 game environments are so completely covered in static meshes that you can’t even see their underlying geometries.
Static meshes are designed to be instanced (reproduced) multiple times completely within your video card. They require essentially no work from your PC’s or game console’s main processor. This means they can be drawn extremely fast, even when you’re using thousands of them. Don’t get carried away, though. You still get the best performance if you reuse meshes wherever possible instead of creating new ones. Only the first instance of a static mesh uses a significant portion of memory. For all other copies, only positional, rotational, and scale information is stored in your video card’s memory and the other rendering bits don’t need to be copied again. It goes without saying that the more efficiently you use memory, the better your game performs.
Sometimes, of course, you’ll have good reasons to create new meshes. Just remember, with everything in game creation (and life), you need to know the tradeoffs. Using the Unreal Editor’s Primitive Stats browser, you can sort all of a level’s assets by memory usage (see FIGURE 1.21). Notice that your level is playing a tad slow? Find your biggest memory hogs. If static meshes are at the top of the list, maybe you want to throttle back on how many you’re using, or how complex they are. (We talk more about the Primitive Stats browser in Chapter 11, “Level Optimization.”)
Figure 1.21 The Primitive Stats browser can help you see if you are using too many static meshes in your level.
Animations and Skeletal Meshes
Game characters typically aren’t static meshes. They’re skeletal meshes: meshes that deform based on a digital skeleton. You create them and add their skeletons through a process called “rigging.” That’s another task that happens outside the Unreal Engine, typically in 3D applications such as 3ds Max or Maya. Once a skeletal mesh is rigged, it can be animated to make it look like it’s running, jumping, shooting, doing pelvic thrusts, or whatever else your wild imagination conjures up.
Meshes and their corresponding animations are, unsurprisingly, stored in packages. Animations are stored as a separate type of asset that you can assign to any character with a similar skeletal structure. This simplifies animation, and frees up precious game resources by reducing the number of animation sequences that must be loaded into memory.
The Tools of the Trade
Now that you have a general idea of the types of game assets you’ll build, let’s talk tools. As you’ve seen, many assets must be created in external software applications. In this section, we mention a few of the most popular, but you can certainly use others. We start, however, with an immensely powerful tool that is part of the Unreal Engine, and one that every Unreal level and game developer needs: the Unreal Editor itself.
Unreal Editor (UnrealEd)
The Unreal Editor (a.k.a., UnrealEd) is the central application you use to create maps, populate them with meshes, create your materials, construct sound effects from audio files, and much more (see FIGURE 1.22). It’s also the only program used to open and browse the contents of an Unreal package. It’s not a content creator. It is an outstanding tool for transforming raw content into breathtaking games.
Figure 1.22 The Unreal Editor user interface
Because Unreal Engine 3 is a 3D gaming engine, you need 3D assets—whether they’re characters or the static meshes you pour all over your Unreal environments. Plenty of 3D applications can create content for Unreal Engine 3, but the two most popular are Autodesk’s 3ds Max and Maya (see FIGURE 1.23). You can find out more about them at www.autodesk.com, which sometimes—not always—makes trial or training copies available for download.
Figure 1.23 The 3ds Max user interface
To create textures for your game’s materials, you need graphics editing software such as Adobe Photoshop or Corel Painter (see FIGURE 1.24). Each of these contains huge palettes of tools for working with photographic references as textures, or for painting your own.
Figure 1.24 Textures can be edited inside Photoshop.
There are other applications as well, including some that enable you to paint directly on the surface of your models. For instance, there’s Pixologic’s ZBrush. This nifty package doesn’t just enable you to create textures; it allows you to model multimillion polygon meshes for producing super-realistic normal maps for your meshes. (Don’t understand all that just yet? You will soon. But for now, trust us: that’s impressive.)
With all the 3D applications out there, each with its own fave formats, it would be cool to standardize a single format for sending information into Unreal Engine 3. Then, users of any application could freely create and swap Unreal game assets without switching to different software. Unreal Engine 3 supports the Collada file format, which has plug-in versions for virtually every major 3D application on the market (see FIGURE 1.25). For more information about Collada, and to download its latest plug-ins, visit collada.org.
Figure 1.25 Collada offers a unified file format for 3D assets.
For audio, Unreal Editor’s SoundCue Editor uses WAV files. Yup, theoretically you could use Windows’ ancient Sound Recorder application to create those. And you could rely on the SoundCue Editor itself to adjust modulation and volume. But we suspect you’ll want an audio environment that’s a little more comprehensive. Two good options are
Sony’s Sound Forge and Adobe Audition (see FIGURE 1.26).
Figure 1.26 Adobe Audition
Whatever program you choose, make sure it lets you edit waveforms to remove any slight pauses at the end of your effects. That’s essential for easy blending between different effects.
This book gives you an incredible amount of information on creating and using game assets. But, let’s face it: Some of these third-party applications are pretty technical. Many aspiring game artists will want some sort of training to help them along the way.
There are plenty of online and offline locations for 3D application and texturing training. Your humble authors would like to recommend their own site, 3DBuzz.com. Come visit: We have hundreds of hours of free training videos available for download, as well as professional level training videos that help us pay the rent (see FIGURE 1.27).
A quick commercial (just one, we promise): 3D Buzz has been in the online 3D training business for over five years now. We work very closely with Epic Games; in fact, we produced the 60+ hours of training videos released with the Unreal Tournament 2004 DVD Special Edition as well as a series of training videos included with the Special Edition PC release of Unreal Tournament 3. So, yeah, we know this stuff.