Sithspecter

TOOL:KAurora

Recommended Posts

KAurora


Created by MagnusII, and uploaded with permission.

 

Welcome to the KAuroraEditor. This tool will allow you to perform some operations on the resource files used by the Kotor games.

 

Please do not disassemble, reverse engineer, copy, distribute etc. the program. The source code will be released with a later version along with the necessary license.

 

---------------------------------------------------------------------
Disclaimer

 

WARNING: this program comes with no warranty whatsoever. Use it at your own risk.

 

This is an Alpha. It will have several bugs and problems. It has been preliminary tested on a few walkmeshes and models from Kotor I. I've used Gmax 1.2 and NWMax 0.7 to work with the exported ascii walkmeshes. Notice that the NWMax 0.7 AABB tree building algorithm is bugged and can enter into an infinite loop; I had to comment out the code to be able to work on some of the more complex walkmeshes. The program does not need the AABB data from NWMax anyway; it rebuilds its own AABB tree.

 

---------------------------------------------------------------------
Installation

 

You must have Microsoft .NET Framework 2.0 installed.

 

You must have DirectX 9.0 SDK Update April 2005 or later installed. The redist will be enough.
Note that if you have installed the latest DirectX update without having already installed the .NET Framework, some of the necessary libraries may be missing. If that is the case, install the Framework and then install a newer update. If you're already at the latest level, install the whole SDK.

 

Once you have the prerequisites, just run the executable. Nothing else is required.

 

---------------------------------------------------------------------
Using the program

 

At present, the program has three main functions: it will allow you to extract most of the resources packed in the game files, to export and import the walkmesh (.WOK) files, and to load,render, and import the model (.MDL) files with the option of rendering the textures and the lightmaps.

 

When you run the program, a window with a tree structure will appear, having the two main nodes "Kotor I" and "Kotor II".
You can add the games' resources to the main nodes by simply selecting one of them, and then clicking on one of the menu items under "File". A window will appear; just select the appropriate file or directory and the relative tree will be built under the chosen node.
To export a resource, simply double-click on its node and another window will appear. Click on the "Save As..." button to export the resource.

 

---------------------------------------------------------------------
Walkmeshes

 

The Walkmesh menu lets you load and save a Kotor walkmesh file, and it also gives the possibility of visually editing the room adjacency values.
To load a walkmesh from a node, you must first select a node with the appropriate resource (i.e. a .WOK file). Once it is selected, simply click on the "Load From Selected Node" menu item and the walkmesh will be loaded in memory. You can also load a walkmesh from an ascii or binary file, without the need to build the tree first. Also, if you load a model file with a walkmesh in it, the walkmesh will be autoloaded.
Once a walkmesh is loaded in memory, you can export it either in ascii or binary format by selecting the appropriate menu items. You can also clear the memory; the export items will be disabled.

 

The "Render" option will open a DirectX window with a top-view rendering of the walkmesh, along with a drawing of the first perimetric line in the walkmesh. Edges hilighted in red are those with a room adjacency value different from "-1"; this means they are those edges which, once crossed, will bring you into another room. The room to which they lead is expressed as a zero-based index of the room list which you can find into the .ARE file of the area to which the walkmesh belongs.

 

Some walkmesh files have several perimeters in them. If that is the case, hitting the up and down arrow keys will let you cycle through all the perimetric lines belonging to the walkmesh.
Once you can see the perimeter you want, you can double-click on the edges [best results by trying to hit the edge center]; a window will appear, detailing the edge number along with its current adjacency value. You can change the value by choosing "Apply"; if the value is anything else than "-1", the edge will be hilighted in red.

 

The "Refactor" option is mostly needed when you need to export a binary .WOK of a room having a displacement in the .lyt file, and you didn't load the walkmesh directly from the .WOK. Simply enter the coordinates you find in the .lyt file and hit refactor; the walkmesh will be translated to its new position.
The initial coordinates you find when you open the refactor window represent the position of the walkmesh node.

 

You don't need to refactor if:

 

A) you loaded the walkmesh directly from the .WOK file, or from a file exported using the .WOK as the original source (the walkmesh is already expressed in absolute coordinates in the .WOK)
B) you loaded a .mdl file, it had a walkmesh in it, and the position of the model in its .lyt file is (0, 0, 0). The walkmesh gets auto-translated to its absolute position based on the rest of the model nodes

 

You *DO* need to refactor if:
A) you loaded a .mdl file which had a walkmesh in it, and the model is translated according to the .lyt file.

 

 

 

---------------------------------------------------------------------
Models

 

At the moment, many of the model export and import functions are incomplete. The ascii export is disabled. They will be added in a future release.
The binary export and ascii import are currently limited to models containing nodes of type: dummy, trimesh, walkmesh, and light. Lights will be imported in binaries without crashing the game, but I'm not sure they work properly. Only the first walkmesh in a model will be used for .WOK generation; second and subsequent ones will be ignored (and you shouldn't have them in the first place, anyway, as the game only uses 1 walkmesh/room).

 

Select either Kotor I or II model format before loading the node.

 

To load a model from a node, simply select the node in the tree. To load it from a binary file, you must have the respective .mdx in the same directory. Export is pretty obvious. Just one thing: if you reuse an existing file, the game overwrites the existing one WITHOUT DELETING IT first. So if the new file is shorter than the old one, your new file will have spurious extra bytes at the end. Bottom line: either change the name, or delete the old one before re-exporting.

 

Select wether you want to visualize textures, lightmaps, or both before rendering the model. REMEMBER TO LOAD THE ERF FILES IN THE TEXTUREPACK DIRECTORY if you want to render textures, and the chitin.key if you want lightmaps; otherwise the program won't be able to find them.

 

You can somewhat navigate the model with the arrow keys and the "u" and "d" keys. This will move the camera in fixed increments. It is not possible to rotate the camera at the moment. If nothing is shown on the screen, try to hit "u" a few times to rise the camera higher and get an increased field of view. The program tries to center the initial camera placement, but sometimes this works suboptimally and the model is off center.

 

Right now only trimesh type nodes are rendered. This means no animations, no skinmeshes, no danglymeshes, no sabers, no lights, no emitters and no references. Sorry. On the plus side, area models do look cool in the rendering window.

 

 

 

---------------------------------------------------------------------
Layouts

 

Load a .lyt file from a node. You can now render all the rooms in the lyt at once. Selecting which one to render will be added in a future release (will be useful f.e. to keep the skybox from being included, since skyboxes are huge compared to everything else and they mess up the image proportions).

 

 

 

---------------------------------------------------------------------
So, how do I export, modify, and import a walkmesh anyway?

 

A simple procedure:

 

- load the chitin.key file. All the walkmesh resources are in "models.bif"
- select the one you want to change and load it. Take a note of which edges are red, and which values they have
- export to ascii
- load the ascii model using GMax with NWMax
- modify it as needed, then export it back into ascii format
- load the modified ascii with the editor. You'll see that no edge is hilighted anymore, as the adjacency info has been lost
- use the render window to select the edges you took note of in the second step, and give them their old values back
- export to binary, *using the same name as the original resource*, and put it into the override directory

 

---------------------------------------------------------------------
What if I'm creating an area from scratch and I need a walkmesh?

 

- create the area in GMax, including the walkmesh. Try to keep the walkmesh object as child of the root node (this is the default, so you shouldn't have problems on this)
- export everything to an ascii file using NWMax scripts
- import the ascii in the editor
- choose refactor, insert the .lyt displacement coordinates, hit the button
- manually insert edges adjacency if you need them (I trust you know which edges lead to which rooms in the area you just made....)
- export to a binary .WOK file as above

 

---------------------------------------------------------------------
I want to create an area!

 

Do everything as above, and also binary export the model to produce the mdl and mdx files. Note that if your area is new (i.e. you're not "overwriting" an existing area and recycling its other files) you will also need at a minimum:
- the .lyt file (just look at another one, figuring it out is pretty easy)
- the .vis file (as above)
- you'll need to build a .MOD file containing the .ARE, .GIT and .IFO and put it INTO THE MODULES directory (NOT the override one....). Of course the values in these files should be changed to reflect your new area (e.g. the room struct should contain a list of your new models...)
- put the value "16777215" in the sun diffuse and sun ambient fields in the .ARE file. This will give you a nice white sun. Otherwise, without lights and lightmaps, you'll find yourself in the "absolute pitch black night which doesn't render textures"
- when you apply a texture to the mesh, use only UV mapping types which do not change the number of verts (i.e. planar). If the number of tverts is different from the number of verts (you can check it pretty easily by looking at the ascii file exported from NWMax), your texture will be messed up. This is because having tverts verts needs additional processing which will be added in a future release


 

Share this post


Link to post
Share on other sites

This download includes a file called aurora_fn_export.ms and yesterday I learned that this is an updated file from NWmax needed to properly export models for KAurora. So I took the file and placed it in 3dsMax/scripts/NWmax/nw_ie_inc to replace the original. Now whenever I run the NWmax script in 3ds Max I get the following error pop-up:

 

It's a script load error with aurora_fn_export.ms:

-- Syntax error: at ;, expected <factor>

-- In line:

 

And then 3ds Max just aborts loading NWmax. So now I'm wondering if anyone else had this problem and fixed it or if I'm doing something wrong.

Share this post


Link to post
Share on other sites

Oh yes, for some reason the old script is incompatible with newer versions of 3DS. I have uploaded a script that I modified to work with the newer versions. It under the download as "Updated Export Script".

Share this post


Link to post
Share on other sites

Ah, I didn't see that one... Shame on me.

 

Anyway, this script worked but it didn't fix my problems :(

 

I uploaded it only after you posted, so that's why you didn't see it. ;)

 

Sorry to hear that you're still having issues.

Share this post


Link to post
Share on other sites

I have an edited export script that I'm still testing out. It includes a toggle for lightmaps and non-lightmaps. If all goes well, I can upload it to a future version of this download or come up with some other solution.

  • Like 1

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.

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.