Jump to content

Home

The Kotor walkmesh format


magnusll

Recommended Posts

I have completed the rebuilding functions for the AABB trees (based on the above notes i.e. zeroing the "MostSignificantPlane" field... hopefully the game engine won't miss it too much; it shouldn't be needed for the tree traversal algorithm anyway), the adjacency matrixes and the perimeters. I just need to add in the code for the PerimetersCount structure, which is trivial since the perimeters are already done, and then I can start preliminary testing on imported walkmeshes.

 

On the "bad news" side, I've just discovered that the "m18ab_02a" walkmesh has no less than 195 faces adjacent to another room.... this is the piece of info which I mentioned must be set manually as it's not included in the walkmesh itself. I guess this rules out scratchbuilt walkmeshes with an half-mile long adjacency line, unless you have way too much free time on your hands....

Link to comment
Share on other sites

And that is what magnusll is trying to? To create a compiling tool to compile the walkmeshes?

Yup, and this is another step closer to custom area creation!

On the "bad news" side, I've just discovered that the "m18ab_02a" walkmesh has no less than 195 faces adjacent to another room.... this is the piece of info which I mentioned must be set manually as it's not included in the walkmesh itself. I guess this rules out scratchbuilt walkmeshes with an half-mile long adjacency line, unless you have way too much free time on your hands....
Looks like walkmeshes will still be hard to make though...
Link to comment
Share on other sites

Looks like walkmeshes will still be hard to make though...

I see it this way... A little bit of extra work to make an area is a small price to pay considering that if we don't want to do all of that work we will never create a new area. Personally, I don't care how walkmeshes get done as long as they CAN be gotten done.;)

Link to comment
Share on other sites

Why not do it the same way as BioWare did it? They made it someway. Why cant we do the same?

 

Errr, because we don't know what they did, i assume they have a special importer/exporter plugin for 3DSMax, but that isn't certain, and they may even have their own 3D tool for all their modeling needs which seems more likely.

Link to comment
Share on other sites

Why not do it the same way as BioWare did it? They made it someway. Why cant we do the same?

 

The adjacency info was probably set using some kind of tool which linked together all the various maps/walkmeshes/etc. belonging to the same area. We don't have any such tool. The one I'm working on uses a single walkmesh at a time - and the info about which other rooms are adjacent to the mesh cannot be found in it since, technically, that info pertains to the layout of the area as a whole rather than the walkmesh itself.

 

It is reasonable to try and come up with an add-on to the import/export utility which makes editing this info easier - for example, a simple 3-d window which visualizes a wireframe rendition of the walkmesh and lets you select the edges to be linked by clicking directly on them, maybe with an additional option to load the rooms from an .are file and show the possible values as a dropdown list using the room names instead of a zero-based index. But honestly, I'd much rather release a functional (if somewhat clunky) utility as soon as possible, than delay it for weeks while I try to learn Direct3D programming to implement a spiffy visualization window.

Link to comment
Share on other sites

Instead of learning Direct3D, maybe you could create an exporter from 3ds max/gmax by learning MaxScript? I tryed once and its pretty simple, Autodesk have documentation on it included with 3ds max.

 

 

Don't forget the Win32 stuff you'll need for those nice "windows" .

 

Anyway I'm just glad you people are trying to crack this hard big nut .

Can't help ; sadly I suck at scripting and programming .

 

Hope you can make a good tool that doesn't ask to much of weird file handleling magic .

Link to comment
Share on other sites

Another quick update... I completed the code for rebuilding the binary format and started the preliminary tests. I chose to use the Valley of the Dark Lords' walkmesh as a testbed, as it's a relatively complex one.

 

The first three tests ended in swift crashes :p, but that was due to a stupid mistake I made in the code which rebuilds the header. After fixing that bug, I was able to successfully load a savegame using the recompiled walkmesh.

I first tried by simply modifying the faces which represent the fallen column in the middle column row, making them walkables. I could walk in the valley and everything was apparently normal, but going near the fallen column, I was still unable to walk on it.

Unsure if that was a problem of the imported walkmesh, I further modified it, this time changing a few faces into "unwalkableness". Reloaded the savegame and... I got stuck. I couldn't move, as apparently the whole valley (or most of it anyway) was suddenly unwalkable. Also tried to teleport away and reenter it, but couldn't manage as the engine wouldn't let me walk in.

 

I was puzzled by this, and thought at first about a bug in the rebuilding of the walkable adjacency matrix or the perimeters. Then I noticed how inserting a few unwalkable faces messed up the whole valley; an idea struck me, I made a check, and sure enough.... the faces are sorted :evil3: . All the walkable faces come first, and then the unwalkable ones are stored in the last positions of the faces' array. I completely missed this little bit of info until now :doh:

 

I've added the relevant code in, but will have to wait until tomorrow before being able to do a few more tests. I'll let you know as soon as I can finally make these $%&/ walkmeshes work...

Link to comment
Share on other sites

I've done the tests with the new code. I put the newly-edited .wok in the override folder, I loaded the save game aaaaaaand.....

 

... it works :cool:

 

I can finally walk where I'm supposed to be able to and not walk where I'm not supposed to. The pathfinding algorithms do not seem to have any problem either, as your companions (and/or enemies) are still able to find their way around.

 

I've also tried with another walkmesh: the room in the Taris sewers with the Rancor in it. I made unwalkable the faces where the Rancor is, while making walkable the lateral ones near the room exit (where there's the lightly depressed floor with a gap before the central corridor).

The first attempt made the whole room unreachable, but that was because I forgot to manually put back in the room adjacencies. Once that was corrected, I could waltz in the room and pelt the Rancor to my leisure, as it couldn't move. Who's the boss now, hu, stupid Rancor :D

 

Give me a few days to put everything in an usable form, and I'll start looking for a place to upload the utility. I'll also include some simple window which will let you manually edit the room adjacencies (as the walkmesh is useless without them), along with a small tutorial on how to edit them. As soon as I can get everything uploaded, I'll post the link in the "T3-M4's Astromech Droid Center" forum.

Link to comment
Share on other sites

I can finally walk where I'm supposed to be able to and not walk where I'm not supposed to. The pathfinding algorithms do not seem to have any problem either, as your companions (and/or enemies) are still able to find their way around.

 

Very nice. :)

 

As for the path finding, the path nodes seem to be specified in the areaname.PTH file within the area's module, which is a standard GFF format file. So if you make major changes to where you can and cannot walk in an area you may need to make changes to this file as well and move the nodes around.

Link to comment
Share on other sites

Very nice, indeed :).

 

Just as an addendum to what stoffe said: The path nodes in the .pth files are to do with waypoints; more specifically, how to get from one of them to the other. You could just have two waypoints in a module and have an elaborate pathway file to direct the NPC walking that path to various locations - which is completely pointless when one considers the fact that it's much easier to place a waypoint than it is to edit the .pth for a module. The movement of NPCs without waypoints (such as party members following the player) seem to be independent of this file :).

 

If you do want need to edit the pathways - because you've created a massive "unwalkable" area where a path would normally lead a creature through - then beware. One error can lead to glitches in waypoint walking - large glitches.

 

Anyway, nice to see some progress on this :).

Link to comment
Share on other sites

Give me a few days to put everything in an usable form, and I'll start looking for a place to upload the utility. I'll also include some simple window which will let you manually edit the room adjacencies (as the walkmesh is useless without them), along with a small tutorial on how to edit them. As soon as I can get everything uploaded, I'll post the link in the "T3-M4's Astromech Droid Center" forum.

If you need a place to upload, or at least an alternative, just let us know. We'd be happy to host the utility at SWK (starwarsknights.com) along with all of the other modding tools, I'm sure the community would welcome this one to the Family :D

Link to comment
Share on other sites

Just an heads-up for those who may be tracking this thread: I've created another thread in the modding tools forum with a link to the first release of the editor. You can find it here:

 

thread

 

Further discussion of the utility will take place in the dedicated thread.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...