Jump to content


Building a N64 map in Source Engine

Recommended Posts

Posted  Edited by Moltard

Ignore this guide and look at the updated version:





Building a N64 map in Source Engine

This guide assume you have read Ripping N64 models to Source - V2 and you know how to rip models from N64 games.


Here we will focus on how to build a replica of an area from any N64 game.

Again, if the emulator cannot start the game with Nemu64 enabled, then the game is probably impossible to rip.

Don't forget to take a look at my tool as it will make the texturing way easier:


The method I use is basically building the map in Hammer with brushes, using a Reference Model.


I add a prop_static in the map, browse to the model and I can start building following its shape.
To make things clean, I use the visgroups to easily Enable and Disable the different models.


Here you can see all the rooms of the Stone Tower Temple from Majora's Mask.


Getting a reference model

So, you know how to use the plugin to get the VRML, you can extract the model you want and compile it to Source engine.
If you don't, go back reading the previous guide.

Convert the .wrl to .obj, import it into Milkshape, scale it by the amount you need and delete all materials.
Once you have your model with all materials deleted, do a final scale up to adjust it for your game and export the .smd

Use my tool to convert the .wrl and automatically delete every texture of the .obj.

One important thing to know is the default material path used by a model when you don't specify one in the .qc file.
It will take the path of the $modelname and change the model name into a folder.

For example:

	$scale 1
	$modelname    "oot_trace/OOT_FT/OOT_FT_Room1a.mdl"
	$body oot_FT_Port "OOT_FT_Room1a.smd"
	$sequence idle "OOT_FT_Room1a" activity ACT_IDLE -1 fps 1

This is an example of .qc I have been using for my reference models in CS:S.
In this case, the model will look for the VMTs in materials\models\oot_trace\OOT_FT\OOT_FT_Room1a\.

You remember that we deleted all materials, so which one would he look for ?
Well the .smd need atleast 1 material and if none exist, it create one called default.
So in this case, the model is looking for a default.vmt in the above folder.

While for CS:S it's fine to have missing texture for the reference model (you have seen above the purple black texture).
It's not on CS:GO, because that game has the awesome idea of displaying missing textures as blackness.


Pretty cool right, you can't do any mapping with this.

So a solution I found was to make the model load a default texture.

	$scale 1.6
	$modelname    "oot_trace/OOT_FT/OOT_FT_Room1a.mdl"
	$body oot_FT_Port "OOT_FT_Room1a.smd"
	$cdmaterials "n64_reference"
	$sequence idle "OOT_FT_Room1a" activity ACT_IDLE -1 fps 1

You can see this new line $cdmaterials "n64_reference".
The model will now look for default.vmt in that folder.

Of course, what you need now is the actual .vmt and .vtf to load.
So why not the good old missing texture from all the other source game.


You can download the vmt and vtf by cliking here Texture Reference.


The texture might look a bit weird compared to CS:S, but once you zoom in, it's fine.

Feel free to use any other .vtf you want, even though the purple black is simple to use in my opinion.
Edit the $basetexture in default.vmt

For the .qc file, I recommend you to have different 'base' folders for the reference models and the map models.
For example, here i used oot_trace/OOT_FT (OOT_FT = Ocarina of Time Fire Temple).

All my reference models use that path.

For the ripped models I add in the map, I use moltard/OOT_FT/.

I plan to make the reference model creation automatic with my tool.


Adding the model in your map

Add a prop_static in your map (if you are starting a new map, make a brush and add the prop_static on that brush).
Browse to the model you compiled.


Hold Alt and move the prop to align it on the grid.
Depending of the size of the prop, you will be able to build with big or small unit.

Zelda related, I had to build everything with Unit 1, when I used the original scale.
After I scaled up by 1.6, I could build with Unit 8, making everything way easier and faster to build.

So now that you have your model, add it to a visgroup.
Select the prop and click on the red cube of the topbar.


A small window appear.
Make sure 'Create new visgroup' is checked. Add a name and click OK.


Your model will disappear from the views, and you can see the new Visgroup added on the right.
You can check and uncheck it to make the model appear and disappear.


In my first screenshot, you might have noticed I have Sub Visgroup like those you find in the Auto tab.
To make them, select a visgroup with your Right Click and drag it on another existing visgroup.

To create a new visgroup without using any brush/entity, click on the Edit button.
A small window appear, click on New group at the bottom, it will make a new visgroup, you can then rename it and Close the window.


You can now drag your model visgroup on the new one


Method to align reference models

I have a method to quickly add all the reference models of your map, that might not work with all games.

In Zelda games, all the models of an area/temple/cave all use the exact same origin.


You can see that the first room and the second room of the Fire Temple got the same origin point.

So assuming you named the reference models in a logic way (Room1, Room2, Room3, etc...), you can quickly edit the path of the prop_static to select the model you want.

Select your first reference prop, copy it (Ctrl C) and do Paste Special (Ctrl Shift V).
Set the amount of copy you want to make. If you have 12 models in your area, put 12.
Then press Enter or click OK.


In my case, 28 because there are 28 differents room in the Fire Temple of Ocarina of time.
All the models will be stacked on the first reference model.
The next step is to select the model and change its path.
Since everything is stacked, you can

  • Click on the first model
  • Change the path (in my case to Room2a)
  • Click on the first model again
  • Change again the path (now Room3a)
  • etc...

After doing that for all the models, everything is perfectly aligned and the rooms are next to each others.



Build the map

So now, it's obvious, you follow the shape of the model to build your brushes.
I recommend you to build with Nodraw, and use the 3D Flat Mode of the 3D view.
Click on the word Camera to change the mode.


While it might seems really easy mapping at first, once you encounter complex shapes, you will have issues building.
The 2D views will not render every walls you need to build.

Let's take the lava room of the Fire temple for a good example


You can probably see the problem.
The 2D views cannot help us build, so we need to use the 3D view.
But even the 3D view doesn't help much, because of the way textures are applied, you cannot know the size of the brushes you need to make.

I found out the method to build after struggling building the Ikana Valley in my old project.

Change the 3D view from Textured/Flat to Wireframe.


Now, you can magically see how every solid were built in the original N64 games.
Triangular shapes everywhere.
Back then, every shape had to be triangular (even the Source engine transform brushes into triangles during compile).

So while we still cannot use the 2D views to see what we are building, we have the 3D view.

You will mainly need to work with brushes with 5 faces in this case. The vertex tool will be your best friend.

At first you will surely create many invalid solid (Alt + P to check the errors).
But the more you use it, the less you make errors.

Here is the Lava Room built and textured (took over 300 brushes to make):


Best way to never get invalid solids

If you always move 2 aligned vertices of a brush, and if you always work with brushes with 5 faces, there will be 0 issues.

Here is a video that show how you should always move the 2 adjacents vertices together.

That way you can easily duplicate the brush, move the vertices to create any shape you want.

The problems will happen when you will have to use brushes with 4 faces, which are kinda weird.
They can be invalid while Hammer doesn't notice it.
I often got that problem when building in wireframe mode.

In that mode, I wouldn't notice that the brush was concave.


The solution is pretty simple to fix, you just need to switch 2 vertices position.


Another problems of the brushes with 4 faces

These brush are really not well handled by Hammer and when reloading the map, you could have the following problem


A vertice get split into few mini-vertices.

You will only see it if you zoom in the 2D views and you might notice cracks between the brushes in the 3D views.

You can try fixing it with the Vertex Tool, by making a box to select all mini vertices.

Then press Ctrl B to merge them all together. Once you reload the map, the problem will surely appear again.

If these brushes are func_detail, you won't have any issue during the compilation, but it's always better to not have these glitched brushes.

The best way to prevent that is, like I said above, to use brushes with 5 faces.

Or to use HammerPatch which is not something I recommend.

While it's working as intended, that makes you dependent from a modification of Hammer.

And I assume HammerPatch doesn't work on CS:GO since that game runs a modified version of Hammer.

Brushes vertices glitching on map reload

Sometimes, when doing brushwork with 4 faces solids, these brushes can get modified when you reload the .vmf

It mostly happens on very large brushes, and it splits a vertex in 2 (or more) mini-vertices with an offset of like 0.1 unit.


So the brush no longer has all his vertices aligned on the grid but it's the kind of brush that need to be a func_detail anyway.

In this case, it is fine, you cannot really do anything to fix the issue, because that's how Hammer act with those brushes.

If you really want to fix the problem, select the Vertex Tool.

Make a selection box around the whole brush to select all vertexes at the same time.

Do Ctrl B to snap to the closest grid point each vertexes and if the message Merge Vertices message appear, press Yes.

It might just re-do the exact same problem on the map reload.

But if the offset is very large (like 10 units), your brush is probably incorrectly made and you might aswell remake it.

Brushes with 3 faces error

To make brushes with 4 faces, you usually use the vertex tool and merge the vertices together.

If you merge the wrong vertices together, you can end up with a 3 faces solid.

It is obviously invalid and need to be fixed.

You can remake the brush or you can transform it back into a 4 faces solid.

To do so, select the brush and the Vertex Tool.

On one of the 2D views, you should see 2 vertices that are not connected together.

Select both (Hold Ctrl) and press Ctrl F to reconnect them.


Texturing the map

You have all the textures of the area in the VRML rip and if needed, you can use RiceVideo to get some .png.

Since we want to do an exact replica, the texturework should be like in the original game.


Use my tool to automatically texture the .obj

To know which texture to apply on which face, we will need to use Milkshape and do the texturing in it.
Since you know how to do the texturing for a single model, it won't change here.

It can take some times though because there are hundreds of different groups.
You can of course delete many groups that are unneeded, or that you already converted as a single model.


Another way is to look in the game what texture seems to be used, but make sure you are using the good one.

As for the texture scale in hammer, it's all about adjusting it until you get the good one.
To help you, find a distinctive point on a texture, and count how many time it appears.

i.e. Count the bricks of a brick texture in Milkshape.


But luckily, once you have found the texture scale of one texture, that texture scale is the same for many others textures in the area.
It can change of course, but rarely.

With the Zelda maps, 2.25 on X and Y axis was the scale I used the most.


3D Skybox

Assuming you know how to build 3D skybox, you know that per default the brushes in the skybox are 1/16 the size of the map brush.
Knowing that, you can compile a downscaled reference model, by changing the $scale value in the .qc file.

For the example, I will use the Fire Temple map I'm doing.


As you can see, the spawn area is surrounded by Skybox brushes.
Using a 3D skybox for this area was the cleanest way I could do.
Not only was the reference model massive but the area would have been too big and if people don't even visit, what's the point of adding it in the main map.


In red you can see the playable area.

Everything around is the reference model.

As with any 3D skybox, I selected brushes from my main map as reference, I duplicated them, scaled them down along with a sky_camera which I moved in a 3D Skybox.

Once I did that, I added my 'mini reference model' in the 3D skybox, and I aligned it with my reference brushes.


Once it's correctly added, I simply needed to rip the 'skybox area' and texture it in Milkshape.

After that, I convert to .smd, I compile with a 1/16 scale in the $qc, and I align it with my mini reference model.


As you can see, everything is perfecly aligned.
So I add all the skybox references (model and brushes) into a visgroup to disable them for the compile.

I could also delete them, but it's better to have a backup in case I edit the skybox


Once compiled, here is the result in game



Thanks for reading this guide, let me know if you have any question or if I should add some informations.

Edited by Moltard


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...