|
|
|
 |
| by Michael
Arrington |
|
The term pre-fab refers to a pre-built
scenery component for a 3D game - users of tools
such as UnrealEd are probably already
familiar with the word and the concept. In this
tutorial, and the rest in the series, we will look
at creating very simple pre-fab level components for
use in a fantasy dungeon game.
|
|
Though this discussion
focuses on creating pre-fabs for an indoor fantasy
environment, the same principles apply equally to
science-fiction or modern interior settings. Don't
let the genre throw you; feel free to make pre-fabs
in any style that takes your fancy.
Click the image at the
right to see a set of my sci-fi pre-fabs,
complete with lightmapping and placeholder figures
swiped from
Polycount (by James
Edwards aka Gwot, and
Daniel Beswick aka
Slightly Twisted).
This tutorial assumes
you are familiar with the most |

from Space Hulk BE by Michael Arrington |
|
common
gameSpace (or gameSpace Light)
tools and have access to a photo-paint application
such as JASC's Paint Shop Pro or
Adobe's Photoshop.
As with any such
tutorial you will need to make allowances for your
own particular setup - particularly regarding 2D
and 3D formats for your favorite game engine.
|
|
Part One:
Laying the Foundation |
|
A little planning goes a long way when designing
games. In this tutorial we will create tileable 3D
level components for a fantasy dungeon game.
What's missing, of course, is any sort of
information about the game in question.
<sermon>While this is fine for a learning exercise
please do not do this in the real world - you will
save time and money if you plan ahead and start
developing only after you have a good idea of the
game you want to make, the content and code
required, and other factors.</sermon>.
We
still have to do a little planning, even without
the details of our little generic fantasy game in
hand. For one thing we need to think about the
specifications for the pre-fabs we are going to
build. It is important to establish details like
size, texturing, tiling, and so on before you
begin to model.
|
|
After a little thinking
we might come up with:
- Level pre-fabs will be single, tileable 3D
modules representing dungeon terrain - to be
assembled in a custom level editor or in the
game engine.
- Pre-fabs must fit within 10x10 unit square
and will generally be 6 to 8 units high, though
they can extend above and below these limits if
desired.
- Pre-fab textures will be 512x512 and only
one texture will be used on each pre-fab.
Overlay textures with dirt, weathering,
lightmapping, etc. can be used to create some
variety in appearance.
- Each set of styles will have one or more
pre-fabs that act as transitions between it and
one or more other styles, e.g. dirty red brick
-> mossy grey stone or rocky cavern -> random
stone blocks.
- Additional props such as torches and chests
may be added later in a level editor or game
engine.
|
 |
|
Not a bad simple
specification for our purposes. We can use this to
plan out a single 'style set' to build - think of
this as a set of tiles that fit together
interchangeably to allow you to create a section
of a dungeon.
We will have
'transition' tiles that make the jump from one
style to another seamlessly. The image at right
shows the basic tiles we will need to build.
First, we need a tile
with just one wall and one with a corner. This
will allow us to build large rooms. We will also
need a tile with walls on either side to serve as
a hallway and a tile that lets us create a
dead-end hallway (or a niche). With just these
four tiles we can create a great many different
dungeon maps.
There are a couple of
missing elements though.
|
 |
|
One is a plain floor
tile, for the center of that large room we talked
about. Also, our wall tiles won't include floor
geometry, so we will use this floor tile under
each wall tile. This will let us mix things up for
more variety.
We will also create a
roof tile, which will be used to cover areas
outside of our walkable dungeon area.
Door are a must too;
dungeon delvers just love to bash them down (some
just listen at them...wimpy elves!) Finally, we
will need to create a 'corner fill' tile. This
tile will be laid down to fill gaps created when
two tiles with walls meet at a corner.
That is a manageable
set of tiles to start, though you can certainly
add many more types of specialty tiles - |
 |
|
special rooms, traps,
and other dungeon fare. At right is a sample of
what we can do with our set of pre-fabs.
Well, maybe it's not
the Tomb of Horrors or the City of the
Spider Queen but the Underdark wasn't
built in a day - and, with some work, this
foundation will take us pretty far.
|
|
Part Two:
Building The Walls |
|
Now that we've done a little planning we can move
to the fun part: actually making the
models. Open gameSpace (or gameSpace
Light) and let's get building!
First off, a template
of sorts might be helpful. On the 'basic' Layer
create your lighting layout - these screenshots
use 'white' from the Light Library.
If you want you can move the Infinite Lights
out of your working area to avoid visual
confusion. Next, create a Cube primitive
with no divisions and use the Object Info box
to change its Size to 10, 10, 6 in X,
Y, and Z, respectively. Then, change
its Location to 0, 0, 3 in X, Y, and Z. When you
are done, Add New Layer and Lock
'basic'.

We will
build our first pre-fab on the layer just created.
Let's start with the single wall pre-fab mentioned
in our list above - should be easy, right? Well it
is! Just create another cube with no divisions.
Again using the Object Info box, change the Size
to 1, 10, 6 and change the Location to 4.5, 0, 3.
That places it flush against one wall of the cube.
You could stop now, if you like boring dungeons -
but let's spice it up a bit!

Before we
do any more modeling, let's get rid of the parts
of the wall we won't ever see. For our purposes we
only really need the top and inside faces of the
cube - everything else can go away. Right-click on
the cube to enter Point Edit mode and
select the Delete Faces icon. Then, click
each of the faces to be removed to delete them.
You should end up with something like the image
below - note that the reference cube layer is
Hidden in this screenshot.

Great!
Now, let's add some detail. You can stay in Point
Edit mode because we're going to add just a little
geometry to make our wall slightly more exciting.
Dungeon walls are notorious for niches - where
else are the little nasties that live there going
to put their sacred urns and whatnot? Let's make
one. Clicking on the Polygon Draw tool will
let us create a new polygon directly on the wall
face. Do that and create a nice little niche.
Things don't always square up well so either move
the vertices to the right spots or click on them
and change their location in the Object Info box.

Using
Add Edges and the other Point Edit mode tools
you can keep adding detail to make your pre-fabs
as complex as you want. Of course poly count may
become an issue depending on how many of these you
are going to have on screen at once. If the user
has control over the camera in your game you have
to assume that he will find a way to
use it to your disadvantage. You should be safe if
you stick to a few hundred polygons for most
applications - even with minimal visibility
checks.
| Important: You must
make a decision about the center point of
your pre-fab models. All models have a
Pivot Point (represented by the Axes
widget) and this is the point that most game
engines and other 3D tools use as a handle
to your model. When you load in your object
it will usually be placed with this point at
0, 0, 0 in world space. I like to put the
Pivot Point at the center of the pre-fab
area - in this case 0, 0, 0. Then, when I
load it into the engine, I can just place
the pre-fabs at an offset of 5 units
(because the prefabs are 10 units on a side)
to make sure everything lines up on a grid.
Placing the Pivot Point at the model center
also means that the model is going to rotate
properly with respect to my grid. You can,
of course, place your Pivot Point anywhere
you choose.
To change the Pivot Point, simply
activate the Axes widget and then either
Move it to a new position or type in a
new Location in the Object Info box. It's
that easy. |
For the
early stages of this series we will stick with
simpler models, we can always make more
complicated models after we have the basics down.
In the next installment of gameSpace Fantasy
Pre-Fabs: Getting Started With Pre-Fabs we
apply UV mapping to our wall and create a texture
for it. Beyond that we will look at creating some
decorations to sprinkle around our dungeon and how
to get these things into a real game engine.
Stay tuned - there's more to come!
gameSpace Fantasy Pre-Fabs Tutorial:
The Tomb of Horrors, City of the Spider
Queen, and the Underdark are
trademarks or registered trademarks of Wizards
of the Coast, Inc., a subsidiary of Hasbro, Inc.
Space Hulk is a trademark or registered
trademark of Games Workshop Ltd. Mention of
these trademarks should not be construed as a
challenge to such status.
|
|
|
|
|