Forum

Please or Register to create posts and topics.

Tunnels, the Novalogic Way...

This Tutorial was done by Eagle Eye from dfreload.com all credits to him.

Introduction

This Tutorial will give a basic guide to creating tunnels.

This tutorial assumes you have a basic knowledge of 3DS Max, and have previously put models into JO or DFX.

The main advantages of doing tunnels this way are:

1. You can see water.
2. When in a tunnel, the game will only render what the player sees.

This method is also used to create buildings.

Discussion

Point 2 is most important for a game to run smoothly. If a mapper uses too many buildings, with too many textures and/or buildings that don't use this method, then the game will run slowly, will not render correctly, or will crash.

Maybe the map will just not run at all.

So, as modders, we have a responsibility to put out the best models we can, that will aid the mapper in creating maps that run fast, and don't hog system resources.

To do this, we must know how the game engine works, so we can take advantage of the features that make the engine run on "Cruise Control".

Required

1. Jo Mod Tools,
2. Mod tools from Nova (Super OED)
3. 3ds Max (models supplied for this tut have been made with Max 8 SP3)
4. A text Editor.
5. The Basic Scale setup max file, included on the files below
6. My tutorial files attached to the bottom of this post

Tools Supplied in the model download folder:
Darehackers BFCTool.exe
2 scripts for mass decompression and compression of tga, dds, mdt and wave files.

Know your Engine

Naming Conventions and key Elements.

01 - The main mesh of the model
02 - A Mesh dependant on the 01 Object
_01 - The Centre Point of the Main Object in 3 dimensions
_02 - The Centre Point of the Child Object in 3 dimensions, in buildings. we use the same point as the _01 Object.
~01 - Attach point of Main 01 Object
~01a - Attach point of Child Object 02
BB - Blink Box we use 2 different ones for tunnels, they are:
BBL02 - In the above ground part of the tunnel where you can still see out the door.
BBVSL02 - In any section where you can't see through the door to the outside world.
CB01 - Collision Box. Even though we blink out the 01 object, we still use an 01 Collision Box.
OP02-01 - Occlusion Portal, these are planes that let us see whats in the next section, door or windows etc. anywhere that may have been "Blinked Out". They also let us see inside a building with blink boxes, because the game engine doesn't render the tunnels unless you can see them. They Cover doorways or any hole with the "Normal" facing out. The game engine knows which way you placed the "Normal", from there it figures out which way you are looking. We are using vision from area 02 to area 01.
OS01 - Occlusion Shell, these will cause the engine not to render what you can't see.
UPG01 ground - The line that will be the default point when placed on a map.

Below is a list of the parts of my Tunnel Entrance.

When we use this system, we must have an outside (01 object), and an inside (02 object) of a building.

The walls we see when inside a tunnel are the 02 object, so the game will not render the 01 object while we are in there.
That's OK when we have a tunnel entrance, we will have an 01 Object. When you make a tunnel section, you strip off the outside polys to reduce the poly count, these are discarded, whats left makes up the 02 Object. But, for a model to work, it MUST have an 01 object. (this is different for turrets, they don't need an 01 Object).

So, we must have a token 01 object for a tunnel section. I use a box, 0.005 x 0.005 x 0.005. This box must NOT lie inside the 02 geometry at all, if it does, you will pop to the surface.

Keeping this in mind, and going back to the tunnel entrance which does have an 01 object. Any 02 object must not protrude past the x / y of the 01 object. So, that means the bottom section, that is underground, must be the same size as the top, or smaller. If it is bigger, you will pop to the surface.

The Plan Part 1

This step is one of the most important steps, DO NOT FAIL TO PLAN.

If you want tunnels that "Snap" together, to say, a 1 meter grid, then you MUST plan.

My advise is... go to the shop, buy a pad of graph paper, a box of HB pencils, a bigger box of erasers, a steel edge ruler.

You may need a basic calculator, but I use the one in windows if I need to.

While your planning, you'll need a format for names.
Remember, the pack program will not pack past 15 characters. We call this the 11.3 format, the old dos standard was 8.3. That's 11 characters, a dot, and 3 characters for the file format.

You will need a name that hasn't been used in JO or JOE at he minimum.

I have chosen "tuntut" as my base name, which stands for "Tunnel Tutorial".

Then, you need a format for your other pieces. I have followed Nova here, and use E for "Entrance", T for "Tunnel", A for "Rooms", and I'll use R for Ramps.
Eg:
tuntutE1 = Entrance number 1
tuntutT4t = Tunnel 4m T section
tuntutT12 = Tunnel 14m Section
tuntutTR84 = Tunnel Ramp 8m long 4m Drop

Standard Dimensions

If your going to have a model that scales out with the existing items in BHD, JO and DFX, then you must use the BHD Scale for Max that A.Bullet setup for us a few years back.

There's a copy in the download for this tutorial. This is the basis for all our models, and we can scale everything correctly.

Make sure you use the Standard Dimensions written up in both the OED, and SOED Manuals.

Here's a reminder.

Doors = 1.5 meters wide by 2.4 meters high.
Windows = 1.5 meters wide by 1.5 meters high, and 1 meter from the floor (don't forget to add on the height of your floor)
Ceilings = 3.75 meters.
Actionable Items = 1.2 meters from the floor.

##NB##

I used 3.6 meters for the ceiling to make things easier to build. My floors are 0.2 meters thick, so is the ceiling. My models are 4 meters tall. 3.6 + 0.2 + 0.2 = 4. This way, a mapper can use the wire frame in wireframe to easily move your item down in 1 meter increments.

More on scaling discussed below in "The Plan Part 2"

What I built for this Tutorial

Below are the 2 sections I built today for this tutorial. I have included the files in a download I have posted HERE

There are 2 bonus models in the file, they are a T section, and a Ramp down 4 meters

The Textures (dds for the game, and TGA for Max), a text file with the items.def, Model builds in various stages, pcx files for med, 3dp files for the SOED, ase files, 3di files, the model of the ladder I used from JO, are all included.

The texture I took from another game, but, I created an alpha channel, so the model has bump mapping as well.

The Plan Part 2

Now, I didn't use my graph paper, I used max to design my building. In the supplied models, I have grouped off the 2 plans.

You can lower these out of the way, they will be viewable from the top, so you can use them to build your model on.

The SOED will ignore these groups, so they can stay in the model.

Top Floor

To keep things "Snapable", you need to keep all of your models centered.

So make sure your x and y coordinates at both at 0.

Your entrances must be on a 1 meter line in order to use the Snap to 1 meter

The top floor isn't so important, as nothing will be snapped to the main door. So just plan out the top floor, so you can get behind a wall, and not be able to see the front door, and the hole where you decend at the same time.

The blue box on the side is a 1.5m wide doorway, the blue box in the third room will be where we decend.

Bottom Floor

VERY IMPORTANT

The size Bottom Floor must NOT be bigger in size than the Top Floor.
By this I mean the x/y coordinates must not protrude past those of the top floor.
If they do, you will be kicked to the surface.

Now, here's where we must make sure we do things right. You will setup some measurements here that will carry on through all the tunnels you make that will snap to this section.

Keep a pad and pencil handy, record the sizes of boxes you need, for future reference.

Now, the most important thing here is the exit, which is the larger blue box.

I set it at 3.6 meters. Why, well as above, I use a building height of 4 meters, so the mapper can lower the piece in 1m increments. I use a floor and ceiling depth of 200mm.

3.6 + .2 + .2 = 4 meters.

The center line of where you will cut the door must be on a 1 meter mark.

Create your Model

I have used Boolean Cuts to create my Tunnels from a single Box.

To incorporate my top and bottom floors, and get a reasonable distance underground, I will use 3 levels.

Level 1, The Top floor entry from the outside world.
Level 2, The access tube between the Top & Bottom floor.
Level 3, The Bottom floor, with exit to the tunnels.

In the plan above, each room is 8 meters, x 8 meters, x 4 meters high.

So, 3 levels @ 4 meters high = 12 meters high.

So, we need a box that is 8x8x12 to cut up into our Entry.

I Placed a box on the ground of the above size, centered it above my grouped plans, I then lowered it down 8 meters (2 thirds underground.)

I made this box see through, so I can see my rooms.

Using the plans above, create boxes, and move them into place.

VERY IMPORTANT

Make sure you raise your boxes off the ground, you z value needs to be 0.2

Cut away your rooms.

The bottom floor can just be the size of the main box, less the width of the walls, and don't forget to raise it 0.20 higher than the base of the main box.

Once you have your main room cut, you can cut a shape, that you can use to boolean away the second floor.

Mine is 8.5 x 8.5 x 4, centered, then lowered 4 meters, I then cut a hole 0.40 wider than the drop down tube, centered over the drop down tube.

Once in place over the main model, boolean cut it away.


Once you finish creating the whole section, make sure it's an editable mesh, and grab all the faces below the bit that will show on the surface.

Detach them, this will be the first piece of our 02 Object.

On the remaining top section, detach all the outside poly's, as 1 object if you can.

The outside poly's will become our 01 Object. Whats left, the inside of the top section, will become the rest of our 02 Object.

Make sure you rename them the right way around. There's no need to join the two 02 Objects together, the game will treat them as one.

Below is my 01 Object, detached from the rest of the model.

When you remove the faces, leave the ones that on a wall where another piece will attach. This will ensure that you won't see light coming through the join.

At this stage, I apply the texture. Bring up your materials, you will find one there.

I'll go over the mapping later.

At this stage, I import what I need from my store file. You can see the OP, and arrow I put on the model for mapping purposes.

I have supplied my store model in the download for this tut.


Make sure your OP's are lined up to your doors/windows. This model has 2, one below ground, and one on the main entrance above ground. My walls are 0.2 meters thick, your OP should be no more than 0.100 meters from the edge of your model. So, mine could be a bit closer to the edge, and work OK, any further away, and we'll have a problem with not being able to see from room to room.

Look at the wire frame, make sure your OP extends into the walls, and doesn't just sit on the edge of the door/window. Any gap will cause a problem, so always over lap into the walls/floor.

I create boxes for the Blink Boxes, The Blue on is the BBL02, the Purple ones are all BBVSL02, you can number these BBVSL02, BBVSL02a, BBVSL02b etc.

NOTE: No more than 16 BB's per Model.


Next, I created the OS01's, these are the 3 Occlusions shell for the model. The OS boxes should be totally enclose by the model, so, I made mine 0.1 meters smaller than the main model.

Name then all the same, OS01, there should be as few as possible per model. These will also show on the spin map.

Next, make sure you create a box for the UPG01 ground, make sure it's centered to the model's x/y coordinates.. I usually do this right at the beginning of a model.

My boxes are usually 0.125 x 0.125 x 0.125, make the height 2 segments, set the height of this box to line up on the base line of the model.

Create another box, center it to the model on the x,y and z coordinates, must be in the middle of the mass of the model.

Call it _01, clone it, call it _02, clone it, call it ~01, clone it, call it ~01a

These are the center and attach points that gel the model together.

The Ladder

I borrowed the model of the standard 7 meter ladder from JO, and put in on my entrance, this way, it use textures that are already part of the game.

I included the model of the ladder, just merge it into your model. It is the same scale, well, it will be if you started your model using the basic scale from ABullet.

You will need to create a plane called CL01 so the player can climb the ladder, you will need a CB behind the ladder to work with the CL.

Collision Boxes

You'll need to create a lot of CB's, they are all called CB01_xx, where xx is usually the name of your model. My model has about 30 of them.

Remember, no concave, no holes.

Items Def

Choose an ID not used already. I have gone over all available mods and selected a set that no mod has ever used.

Make sure they are set as a building, with attributes as below. Use a noshadow on the actual tunnels, or you will have a shadow on the terrain above the tunnel.

begin "Tunnel Entrance" 
  id 109735 
  attrib:  TunnelPiece landable Concave Reflect 
  type building 
  subtype RL_Tunnel 
  graphic tuntut

The Final Product in Game

Notice the bump mapping

There's a bonus file in the download, it's a T Section.

 

Uploaded files:
  • You need to login to have access to uploads.

The Tunnel Section.

If you want to make your own tunnel section, load in my base file, it's called EE_Base_Scaled.

It's a scaled file with a UPG01 ground, I have already put the material into the material editor, and, there's a reference point that has been frozen.

Create a box, 4m x 12m x 4m.

Use the Move and Select tool to center it on the grid, notice at the bottom, x, y & z are all at 0.0m

Save the file now, choose a name, don't overwrite the base file.

Next, we create the box that we will boolean cut from the main model to create the inside of the tunnel.

Create a box 3.6 x 3.6 x 13m, center it and raise it 0.2 from the ground.

Looking from the left, you will see that it's dead center. We raised it up 0.2 because that is the thickness of our walls and floors that we planned earlier.

We made the box 3.6 x 3.6, because that's the size of the hole we cut in the Entrance model above.

Cut away the inside using a boolean cut.

Next, make your box into an editable mesh, (with box selected, right click, choose option)
Delete the 4 outside faces of the box, leave the end ones intact.


You should have something like this.

Next, leave the box selected, press m to bring up the material editor, and assign the texture to the box.

Now, we adjust the texture and add a map. Pull down the modifier and add UVW Mapping, select box, and adjust the length, width & height to 3.6.
This is the size of the walls we chose above.
Make sure the mapping on your main entrance matches these settings as well.
Any other section MUST have these UVW Map Settings so the textures will line up on all the pieces you make.

Label your box as 02_xx, where xx is the name of your model.
Next, we can create the OP's. we need one at each end. Now, I'll show you the trick, don't import them from my store file, instead, create another box, this time, 3.8 x 3.8 x 11.9.
Center the box, and raise it up 0.1m. Looking from the left, you can see it's lined up nicely.


Now, with the new box selected, hide unselected.
Convert your box into an editable mesh.
Select the end plane and detach it, call it OP02-01.
Rotate your model, and select the other end face, detach it, and also call it OP02-01.
The 4 sided box you have left can be deleted.
What you have left now are 2 perfectly lined up faces that you have named as your OP's.

Next, we need the BBVSL02 box, so, create a box the same size as your original box, 4 x 4 x 12, and call it BBVSL02.
Center the box on the grid.

Next we need an OS01, so we know this must be enclosed by the model, so create a box a bit smaller than the original one. Say 3.9 x 3.9 x 11.9.
Center it on the grid, raise it 0.05


Now, we need 4 CB's for this model, top, bottom, and 2 sides, go ahead and create 4 boxes, label them as CB01_xx
I usually make them see through as well (doesn't affect the model, it's just so I can see through them )
We are almost finished, we need the 01 object, and also the 2 center points, and 2 attach points, and some arrows for the mapper to use in the med.
We'll do the center and attach points first, all 4 can be in exactly the same place. Dead center x,y,z of the model.
We already have the UPG01 ground, which is dead center x,y, so we'll clone that, and raise it up to the z center.
So, select the UPG01 ground, and clone it, call the clone _01
Give it 2 height segments so you can see the center line, raise the _01 box up to the center of your object, which is about 1.938m

Now, clone this box again, call it _02.
Clone it again, call it ~01.
Clone it again and call it ~01a
Now, we need to merge some stuff in my store file.
So, go to file/merge, and locate the EE_Store_File_Scaled.max file.
Merge in the group [tunnel stuff]
Hide all of objects except this group.
Ungroup the group, select the two 02 objects called 02_arrow_tuttunE01 and 02_arrow_tuttunE04.
Hide them, then delete all the other parts of this group.
Adjust the arrows so they are at the ends of the tunnels, in fact, if you followed my tut, they will already be in the correct place.

We now have everything we need except the token 01 object.
This Token 01 object can NOT be inline with any existing geometry of the 02 object.

Create a box, 0.005 x 0.005 x 0.005, use the move tool, and bring it right up close to your 02 object, not quite touching in any of the views, top, left and right. This will make sure it's just outside our 02 object by a bee's dick !! mine is 0.003m outside.

Our tunnel is finished, unhide all, save, and export as an ase.
Open your SOED, set the paths for your model textures etc.
Import the ase.
To get the model to use the alpha channel as the Bump Map, do this.
Edit the material, choose "Boring - multi texture - opaque".
Set the diffuse 2 as the same texture.
Set the surface/sound as "Stone"

Select the Dchnk material, it's one I took from the glass on a helo, we need to make this non renderable.
Make sure it's set to flat glass, alpha test ticked, and move ignore ticked. Then it will only show up in the med.

If you save off the model settings as a 3dp file, the SOED will not remember the diffuse 2 settings for the "Boring - multi texture - opaque". You will have to reset them if you make any adjustments.

Render the model, and save as a 3di.

Put it in the game