Making and Using Prefabs

Prerequisites:
The Basics

Overview:
There are several reasons why you might want to create and/or use "prefabricated" elements in your maps.  For example, it's nice to have a selection of prebuilt sets of brushes for common items like tables, doors, beds, and light posts as well as more complex items like pool tables, curved hallways, or even 747 jets.  You can create prefabricated (or "prefab") items from scratch, or steal them from the Deus Ex maps.  There are a couple of different methods for using prefabs, but the method I use not only retains all of the brush texturing, it also allows non-brush items to be included, such as lights, NPC's, triggers, patrol points, etc.

Download:
Download four example prefabs (46K)

Contents:
Using an existing prefab
Creating a prefab from a Deus Ex map


Using an existing prefab

Overview:
To give you an idea how it works, I've created four example prefabs from some of the Deus Ex maps.

1. Load ALL texture packages

Since a prefab (the way I do it) could reference any number of textures, be sure to load all of the texture packages into UnrealEd before importing the prefab.  In the texture browser, hit Load, select the first texture package, scroll to the last one, hold down Shift, and select the last one.  Now hit Open and all of the texture packages will load in.  There will likely be a pause since every texture from the game will now be loaded.

 

2. Import the prefab

Pull up a map if you haven't already and make sure there's enough room available for a bed, closet, end table, or if you want, a 747.  Be sure to download the example prefabs at the link at the top of this page and unzip them somewhere.

From the File menu, select Import Level.  An Import Map dialog box will come up requesting the name of a .T3D file.  (a .T3D file is an "Unreal Text File".  Basically, that's a text file version of a map or part of a map that you can actually pull up in Notepad.  If they are set up correctly, they can be imported into another map)  Find one of the .T3D files that you downloaded and double-click on it.

You should get the "Import a map" dialog box.  Be sure to select "Add contents to existing map", since we want to add the prefab to your existing map.  Hit Import.

 

3. Move prefab into position and rebuild geometry

The prefab should now be loaded into your map.  Zoom out and pan around if you can't find it - it won't necessarily be centered in the 2D views.  While the brushes and actors of the prefab are still selected, move the whole assembly where you want it.  Hit F8 and rebuilt geometry.  The bed, closet (with working doors), end table (with working lamp), or 747 should now be visible in the 3D view.

NOTE: Not all .T3D files (in fact, very few) that you will find on the web are set up this way.  Unfortunately there is another type of .T3D file that is created with the Brush -> Export feature, but the two types are not compatible.


Creating a prefab from a Deus Ex map

Overview:
You can create your own prefabs based on elements in the real Deus Ex maps fairly easily.  Use this same method for creating prefabs from your own brushes or sets of objects.  In this example, we'll steal the pool table from the New York City bar map, complete with working pool balls.

 

1. Load a Deus Ex map

Pull up the 02_NYC_Bar.dx map.  You'll have to enter *.dx in the Open Map File dialog box to see the Deus Ex maps show up in the list.

 

2. Position and size red brush around the desired elements

Let's say we want to grab the pool table from the bar, but not the overhead light or any other elements.  Find the pool table in the map and move/resize the red brush so that it is surrounding the pool table, but not anything else.  The overhead and side 2D windows should look something like this:

 

3. Select elements to copy

Hit the "Select actors inside brush" button. If you've never used that before, it looks like this: . It's quite handy for selecting specific areas of a map. The brushes and everything else inside the red brush should now be selected; it should look like this in the 2D windows:

You DO want to include the ZoneInfo item, since that sets up the surface of the pool table with lower friction.

 

4. Copy elements and paste them into an empty map

Select Copy from the Edit menu.  You can now either hit New Level from the File menu or pull up a second instance of UnrealEd.  If you're a bit light on RAM, you may want to just hit New Level.

Select Paste from the Edit menu to paste the elements into the empty map.  At this point, the pool table is not usable, since it is not in a hollow area, but that's not important.  We're just doing this to create a prefab, not play pool. :)

At this point in the process, I like to position the elements in the center of the map to make it more predictable where it will show up when it's imported into a map later.  But that's optional.

 

5. Export the prefab

Now just select Export Level from the File menu and give your prefab a name, such as PoolTable.t3d.  You can now use the same method described in the first part of the tutorial to load the pool table into any map.


Back to main page