Sign in to follow this  
Sithspecter

Words of Wisdom for Harmonious Walkmeshes

Recommended Posts

A KNIGHTS OF THE OLD REPUBLIC TUTORIAL

 

Words of Wisdom for Harmonious Walkmeshes

By Sithspecter

 

Overview:

 

In this tutorial I will explain what walkmeshes do and how to create and modify them.

 

What are walkmeshes?

 

Walkmeshes, sometimes called a height map or mesh, covers the surface of an area, determining where a character can actually walk. The walkmesh is really a 2.5 dimension height mesh. It covers the whole area, but it can never be at two different heights at the same point (I’ve done tests to attempt this, it does not work, the engine does not support it). So, for instance, it’s impossible to make a bridge that you can walk over with a walkable path under it.

 

The primary purpose of the walkmesh is to determine where a creature can walk and where it cannot. It also has secondary purposes, such as determining what sound a creature makes when moving over the surface, if there should be grass growing on the surface, and if two creatures can see each other (line of sight). It will also add visual effects on some surfaces, such as water and puddles, when something is moving through it.

 

Use:

 

Walkmeshes are primarily used in areas, but also have use in doors and placeables.

 

Structure:

 

KotOR Walkmeshes are typically split up into hallway sections and individual rooms. After studying several areas, I have determined that individual walkmesh sections usually need to be ~100 polies or less. If it ends up being larger than this, it’s a good idea to split it into two sections. Unless you have a small, simple room as your entire area, it is highly recommended that your walkmesh be split up into sections.

This brings up another important point. Walkmeshes aren’t just flat, they have walls that go up on the side. These walls always use the Non-Walk/#7 multimaterial. This blocks line of sight and prevents the player from “sticking” along the edge of the walkmesh. When you run into the walkmesh, you will be able to keep moving parallel to the wall’s face in that particular area. The only portion of the walkmesh hat does not need a “wall” is the place where two sections will join in the game.

 

If you have a walkmesh that has a “donut” shape with a large hole in the middle, it’s best to split it into two or more sections. I’m not sure why this is, but KotOR does not seem to like donut shaped walkmeshes. You can attempt it, but it will likely be less trouble to split it up.

 

Note the following example of a circular hallway:

 

Walkmesh_Tutorial.jpg

 

 

I have created an example of a circular hallway. Note that it is donut shaped, and has been split into sections (Sections have been spaced out for illustrative purposes, if this was an actual export they would need to be touching in a continuous circle).

 

Note also that the walls have been extruded, but the portions where the walkmesh connects do not have walls. The walkmesh has the NWMax Multimaterial applied (happens automatically when you add the walkmesh modifier) and the walls have been changed to the Non-Walk sub-material (#7, appears purple).

 

Creation:

 

KotOR walkmeshes can be very frustrating to get correct. However, I hope I can provide some insight for smooth creation.

 

First, you’ll need your modeled area. In my areas, I usually have the base floor height to ~5 meters, with the whole area raised up that much. This will come in handy when we test our walkmeshes (also KotOR does not render shadows below -1 or -2 meters on the z-coordinate). Usually I get my area in game an test it using a massive plane for the walkmesh. When you are happy with the geometry and lightmaps (another tutorial for a different day), it’s time to sit down and do the walkmeshes.

 

You’ll want to have a 3DS scene open with all your geometry for the whole area. I find it is best to create the base walkmesh for the whole area, and then split it up. How I do this is I convert all the geometry to an editable poly, and then I use the slice modifier at about 250 cm above the floor height, with the “Remove Top” setting checked. This gets all the ceilings and junk we don’t care about out of the way.

Next, I hide everything except the floor pieces. If you’ve done a good job of modeling, this will be fairly easy. But I attach all the floor pieces together, and get rid of the textures by selecting the large pices and typing $.mat=nul in the Max Script mini listenter. Next, I weld all the vertexes to ~5-10 cm, and go around simplifiying the mesh. For instance, if you have a circular room with 96 sides, you really only need a 16-24 sided walkmesh. The goal is to eliminate uncessary meshes. Another thing to strive for is to try to make sure all your polygons are quads or triangles. This can help you out a lot. One tip for fast cleanup is to press CTRL+BACKSPACE when deleting edges, as this gets rid of any unecessary vertices too.

 

Once basic cleanup is done, you can unhide the remaining geometry. Go back in your floor mesh and clean up the edges, move the vertexes to the actual wall locations, etc. Once you are satisfied with the placement and that all your polygons are quads and triagles, you can break the mesh up into the different sections.

 

When editing your walkmesh, always do so in Editable Poly. When it’s time to put it in the game, then convert to mesh, and then add the AuroraWalkmesh modifier.

 

What I do to test is I take one basic section at a time and put it in the game with no walls. I delete all the other walkmeshes from my Override (or .mod, whichever way you want to set it up), and adjust the spawn point in the .ifo accordingly. I run around all parts of the mesh, checking for issues. If you’ve positioned your area a few meters up in the z-coordinate, you’ll fall down to 0 when there is an issue.

If there’s a problem, go back and check to make sure you don’t have overlapping edges, hidden polygons, or isolated vertexes. Also if there are blatant polygons that have more than 4 sides, that can be an issue. If you used the cut tool, it can often create polygons that are sort of hidden and it becomes and issue. I’ll often use the click and drag select tool to select three or four polygons that I can see. If you select those, and the number of selected polygons is more than you can visually see, you’ve got one hidden in there that needs to be deleted and edges that need to be cleaned up.

 

Once you are sure there are no issues with the flat part, now it’s time to raise the walls. Convert to Editable Polygon, then hit the “3” key to select.borders. Hit an edge on the border of your walkmesh. It should select all the edges around your walkmesh. Hit the “2” key, and extrude the edges, set to 0.0 height and 0.0 width. Then, move those edges 400-500cm straight up. Now you have your walls! Delete the extra polygons where your rooms are supposed to connect. Make sure to weld vertexes once again to 0.1 cm! Convert to an editable mesh, ResetXForm, and add the Walkmesh modifier.

 

Test again in the game. If it works, great! If it doesn’t, troubleshoot some more. Remember, any time you’re going through the floor or getting stuck in weird ways, you need to go back into 3DSMax.

 

If it’s working, now is the time to link the edges for this particular mesh. Go into KAurora\Walkmesh\Load From Binary File and open the one you just created. Hit render. You should see your mesh. Now press the up and down arrows until where the edge that you want to link is outlined in black. Double click on this. A box will come up where you can enter a number. You put in the number of the line in the layout file of the area you want to link to. Except that the layout file is base 0, meaning the first line is 0, second line is 1, etc. So basically you put in which room line minus one. So if you’re linking to the third line under roomcount, you’d put 2. Now hit apply. Your edge should turn red. Also you need to link the two adjacent edges to the same value. Once you’re done, save it as a binary .wok once more, and you’re done with that section. I typically go in game once I have multiple walkmeshes in and check them each time I link two together.

 

Most of the time, if you have issues, it’s not the link. Most of the time, it’s the walkmesh geometry that’s screwed up. If you do think it’s the link, open up the binary .wok file in the renderer and check the edges against the lines in the layout file. Remember, 1st line 0, 2nd line 1, 3rd line 2, etc.

 

Walkmesh Tutorial.pdf

  • Like 3

Share this post


Link to post
Share on other sites

This post is quick and dirty, but I will try to have a more expanded one in the future. I just got finished creating a walkmesh with multiple parts for a large area, and wanted to write down everything that I learned in the process.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this