Nothing Special   »   [go: up one dir, main page]

Nwn2 CCC Guide

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

Neverwinter Nights 2 Toolset

Custom Content Creation Guide


Creatures & Placeables
by
Ivan Leben

version 1.0

Introduction
Thank you, for downloading this manual! Keep in mind that this is far from
being a complete and thorough guide, but rather just a collection of all the
little details that I came across while surfing dozens of NWN2 forums for hours.
At this point it is hard for me to tell, where I got all the bits from, because I have
certainly read over about 100 posts or pages, filtering the misleading info and
searching for the right clues. Some of them are also purely the result of my own
experimenting. This means I am not able to give credit to all the people whose
posts helped me individually, but at least I will credit the creators of the muchimportant and useful tools that a custom content creator needs by linking to
their download pages.
I would like to point out that custom content is still not completely supported
by the developers of NWN2 and its toolset so many of this things are related to
changing the original files of the game, or by overriding them with your own
versions. The only thing supported so far is the actual technique of overriding the
existing files. That means you will still have to tweak those files manually and
without any documentation provided from the developers of the software.
However, as the NWN2 team stated in several interview, the support for custom
content is planned to be extended somewhere in the future.
Moreover, this means, that this document will probably not be much relevant
anymore after the CCC tools get fairly integrated into the original NWN2 Toolset.
Anyway, I will be only glad to see that day come, when creating custom content
will not require using a dozen of external tools, and the community will be
provided with an all-in-one tool to unleash their powerful immagination into great
playable modules! For now, this document is just a reflection of the currrent
state that the NWN2 community is in, regarding custom content creation.
This guide doesn't teach you how to use modelling software like 3ds Max or
Photoshop to create models and textures. It just gives information on how to
integrate that content into NWN2 engine.
Note that there are other techniques as well to create and convert your own
models to MDB format instead of using 3ds Max. These include the Descreet's
free gmax software and NWMax suite for exporting to various formats from it or
using the OBJ2MDB converter. These techniques will not be covered in this
guide but I believe that much of the process would still remain the same even if
you chose an alternative path.
Any feedback in terms of constructive criticism, ideas about improvement of this
guide or just a message that it was helpful to you will be greatly appreciated! You
can email me at ivan.leben@gmail.com .
Page2/23

Credits
Bioware Forum Members For invaluable clues that pointed me in the right
direction at the beginning of my experimentation
Thieves-Guild.net Forum Members Some more useful information,
especially cal1s for the detailed info on various techniques of custom content
deployment and installation in NWN2.
Martin Wright DXTBmp program
EwaldTheUnimaginative - TlkEdit2 program
Tanita NWN2Packer program
tazpn 3ds Max MDB Importer/Exporter
RMIT University, Melbourne For offering this great Games Graphics
Programming course that I am attending, especially Fabio Zambetta the
teacher of GameStudio courses. The environment here inspires me more than
ever!

Page3/23

1. Additional tools you are going to need


Most of these are downloadable from NWVault, except for DXTBmp which
features its own website:
DXTBmp (http://www.mnwright.btinternet.co.uk/programs/dxtbmp.htm)
TlkEdit2 (http://nwvault.ign.com/View.php?view=NWN2Tools.Detail&id=15)
NWN2Packer (http://nwvault.ign.com/View.php?view=GlobalSearch)
3DS Max MDB Imported/Exporter
(http://nwvault.ign.com/View.php?view=NWN2PlugIns.Detail&id=27#Files)

2. Unpack the existing content


All the original content of the game is stored in the Data sub-folder inside your
NWN2 installation folder. There you will find lots of different zip files. Simply
unzip the 2DA.zip and NWN2_Models.zip. You will need the files in those two
archives later on.

Page4/23

4. Prepare a blank normal map


There are basically two types of maps that make a low-poly model give an
impression of being highly detailed via texturing: bump-map and normal-map.
Bump-mapping is simpler and was used by older game engines and some 3D
rendering software. Normal-mapping is more complex and has been only recently
integrated into graphic card pipelines.
The way bump mapping works is that it uses the luminosity (greyscale) info and
interprete it as a height offset from the surface being textured in the direction of
its normal vector. This additional height info is then used to calculate the
bumped slope and derive per-pixel normals from it. Each pixel is then shaded
using its own calculated normal.
On the other hand, normal mapping uses texture data quite differently. The red,
green, and blue color channels of the texture bitmap are interpreted as the XYZ
values of the normals in a certain unit-space. Now, this could be object-space
which means the normal coodrinates are specified relative to the whole object
coordinate system for each triangle. Or this could be so-called tangent-space
where the XYZ normal values are relative to the already existing normal vector of
the triangle (or pixel in case of interpolated smooth-shading).

Apparently, NWN2 engine uses tangent-space, which is quite cool, since you
can use just a single color to create a simple normal map that doesn't affect any
of the original normals. This means you don't need any specific tools to start off
with your model, but just an ordinary painter.

Page5/23

So, what would this color be? To get to this, you have to understand that the XYZ
values taken from the bitmap are actually "signed". This means that when using
8-bits per pixel for each color (24-bit RGB bitmap) the bits are interpreted as
-128 to +127 for each of the XYZ coordinate. These values are then normalized
by the engine to a [-1,1] range to be able to represent any possible normalized
vector (whose length is 1).
However, the way painter programs handle color bits is unsigned, thus 0 to 255
for each color. By doing the math you can fairly easily come to a conclusion that
a color value of 128 is actually 0 in the tangent-space normal map and a color
value 255 means 1 in the tangent-space.
Well, if we want unchanged normals, this obviously means we want them to
point straight out of the triangles. Such a 3D vector in tangent-space would then
be (0,0,1) or (128,128,255) as a color in a painter program. Note that some
game engines swap Red/Green and X/Y order, but we don't care about that, since
they are both 0.

Open up a painter program, create 128x128 rectangular image and fill it with
(128,128,255) color. Then save the image to a blank_normal_map.bmp file
(without quotes).

Page6/23

3. Creating a placeable model with 3D Studio


Max
You can either start from scratch or import an existing model file, delete the
mesh and create your own mesh instead. The first technique is completely ok if
you want to just create a placeable, but the later one is recommended if you are
going to create a custom creature, since this will show the skeleton you are
actually using in the editor.
Let's say you want to create a
custom placeable and start
from scratch. First model your
mesh and collapse down all
the modifiers you might have
on top of your mesh, like
Symmetry, additional Mesh Edit
or Mesh Smooth. The exporter
actually does this for you but I
haven't really checked to what
extent, so it might be best to
collapse the modifier stack until
there is only the pure mesh
object.

Now, the crucial requirement


here is to texture your model.
If you don't set up an UVW
mapping and assign a bitmap
texture to it, the model is
either not going to display in
the toolset or the toolset will
crash! So adjust the UVW
coordinates with the standard
method of adding / collapsing
UVW Map modifiers and
spread your mesh over the
bitmap space with an Unwrap
UVW modifier. You can leave
this modifier uncollapsed,
since the exporter will go over
it and handle that for you.

Page7/23

Then create a material and assign a Bitmap map in its diffuse color slot. There's
another requirement here. The textures must be in a DDS format which is usually
not supported by the drawing tools. There is, however, an export plugin for
Photoshop, but I still prefer using DXTBmp program that I linked. You simply
open a bitmap image and save it as one of the multiple DDS formats. AFAIK all
the formats are supported by NWN2 engine, just take care you choose the right
one in case you need alpha channel for transparency.

Once you get your texture converted to DDS open up the material editor and
create a new material for your placeable. Select a Bitmap map for the diffuse
slot of the material and assign its source to be the DDS image that you've just
created.
The next requirement is to provide a normal map. Basically the diffuse and
normal map are the 2 minimum requirements without which the model wont
work in the game engine. The way the exporter maps the texture slots from 3ds
Max to respective textures in the MDB format is a bit tricky though. Since some
names are not found or just similar in the 3ds Max texture slot naming, the MDB
exported maps the slots in the following manner:
3ds Max Material

MDB format

diffuse

diffuse (required)

bump

normal (required)

specular

tint

self-illumination

glow

Page8/23

Convert, the blank_normal_map.bmp image to DDS format, like you did with
the diffuse map. Add another Bitmap map to 3ds Max material bump slot and
set its source to blank_normal_map.dds file you have just created.

Ok, once you've modeled and textured your mesh, there are just a few more
things to do. First you have to create the collision-check meshes. These are
two simple meshes, used to provide dynamic-collision for your object so the
player walks around it
instead of through it. First of
them is a very coarse one
(usually just a cube) and the
other one is a little more
detailed, but still try to keep
it very very simple so the
calculations don't take too
much time. Place this two
meshes relative to your
object just the way you want
them to be used in-game
and name them with the
same name the object has
but with the _C2 and _C3
suffices.
Note that there is a common naming convention for everything related to NWN2
content. The models are usually named in all upper-case letters starting with a
PLC_ prefix.

Page9/23

The last thing you have to do about the model is set its User-Defined
properties needed for the exporter to properly set certain property bits in the
MDB file. To do this, right click your model mesh, select properties and switch to
User-Defined tab. In the textbox enter either "UIFlag = None" or "UIFlag =
Alpha_Test" without parenthesis if you want the alpha layer of your textures to be
used or not respectively.

Now you are finished with creating your model. Export it into a MDB file named
the same as the main mesh. If you are not interested in creating a custom
creature, jump to section 5. of this guide.

Page10/23

4. Creating a creature model with 3ds Max


Unfortunately, things get a bit more limiting here. The skeleton / animation
format used by NWN2 for is not documented. It is a format exported from some
very expensive Granny 3D software. That's why currently there is no way to
create our own skeletons and animations to be maped onto them. This means
you have to use an existing model and its skeleton which most closely
matches your model looks & movement and start from there. Browse into the
NWN2_Models folder which you extracted from the zip file in the preparation
stage.

Try to import some of the model files and see which one you prefer as your start
point. Note that there are usually separate model files for body / head / helmet
etc for each creature / npc. The simplest thing for a start would be to find 1
which only uses a single file or just a body and head file. Try to guess that from
the file names. Additionally, note that N_ prefix is used for the npc files and C_
prefix for creatures.

Page11/23

Once you pick a model to start with, write down the name of the main mesh and
delete that mesh (including the two variants with _L01 and _L02 suffices) from
the scene. Moreover, a handy trick here might be to also use the Display Floater
to hide all the spheres named COLSXX where XX is any number. These are the
collision spheres used for collision-detection inside the game.

Now model the mesh of your creature and texture it the same way as
described in the placeable creation section. If your starting model uses several
files, you will somehow have to separate your mesh into those files and repeate
the process for body / head again.

Page12/23

Next step is to skin your creature. Apply a skin modifier and include the bones
you want to use. Since the exporter / importer somehow guesses the actual
posion of the bones, the way the are linked and how the envelopes are placed
according to vertex weights, it might be a good idea to just paint the vertex
weights manually and not relly on envelopes at all. If you use envelopes you
might find them shifted / distorted once you export and import the model again.
Note that changing the bones structure or their pivot positions and lengths will
not result in a custom skeleton being used by your creature! This skeleton setup
is just guessed by the importer and the changes are not going to be written
anywhere. Only the vertex-weights and bone-binding will be saved.

Once you're done with skinning, there are some User-Defined properties to be
set again. Use the UIFlag attribute as described in the placeable creation section
and add another property into a new line "Skeleton = [skeleton name]" without
parenthesis. Open the Schematic View (usually the icon in the toolbar left of the
material editor) and search for the top-most bone in the bone structure.
Replace the [skeleton name] value of the user-defined property with the name of
that bone.

Page13/23

Name the mesh of the model exactly the same way the
original model was named. This is required, since we are
using an existing model and not creating a new one, so we
have to use an existing entry in the file holding the list of
the appearances (will be described later on). If you followed
the guide you should have written the model name
somewhere before.

Create 2 additional copies of the model. This are going to


be the lower LOD (Level-Of-Detail) meshes used by the
game engine when the camera moves far away from the
creature. If you don't care about the impact on the framesper-second of your module (or you are going to use this
creature just once in an area) you can use exactly the same
meshes for lower LOD as for the full-detail view. However, if
you are going to create a pack of these creatures which
attacks the player in an encounter it might be a good idea
to actually use the MultiRes modifier to reduce the polycount for 2 LODs. Name the medium-detail version with a
_L01 suffix and the lowest-detail version with a _L02 suffix.
In case you actually lower the detail level of the two LODs
you will probably have to re-skin these meshes again to readjust vertex weights according to new vertex positions.

I haven't tried it yet but I suppose you can delete some of the COLSXX-named
collision spheres or adjust them to your needs as long as you keep them named
in the increasing-suffix fashion starting with COLS00 and without any 'holes" in
the numbering. Now you're done with your custom creature model. Export it into
a MDB file named the same as the main mesh.

Page14/23

5. Getting your models into the game


There are many ways to import custom content into the game engine. The
technique used depends on the extent to which you want to affect the original
content. If you provide your own file, named the same as an original file, your file
will override the original one and will be used instead of it. There is, however,
a certain hierarchy defining which files override the previous ones. Basically the
hierarchy (starting from the lowest priority) is supposed to be like this:

zipped content

hak packs

override folders

This means that files contained in a hak pack override the original content
in the zip archives and files in the override content override all the others. This
herarchy is right now still a little bugged and its hard to tell how the priority is
ordered among all the possible hak-pack destinations (game, campaign, module)
and the two override folders (Atari one and My Documents one). Furthermore,
certain files don't work (don't really override) from hak-packs and some others
don't work from the override folder. This is about to be fixed in the upcoming
game patches according to the development team. If you find that a file doesn't
work in one place, just try putting it somewhere else.
The way to use the override folder is pretty much straight-forward. Simply copy
your modified version of a file along with all the new files used (textures etc.)
into an override folder, fire the toolset and the content should change
approprietly. This means that if you let's say modified the
N_Aldanon_CL_Body01.MDB file and placed your version into an override folder
along with the textures used the Aldanon NPC should use your model and
textures binded to it instead of the original one when placed into an area via the
toolset. But be careful, since this will affect the whole content, probably even
when you play the original campaign. You could do the same thing with a
placeable if u used an existing model or just named your model mesh and file
the same as the original.

Page15/23

Page16/23

On the other hand, hak-packs might be more


convenient since they only affect the content
binded to. To create a hak pack, use the
NWN2Packer tool linked above. Run it, click
"New" and then click "Import" and select
every file you want to be included in your
hak-pack. Then click Save As, name the file
whatever way you want, but make sure you
append the .hak ending or the file will be
saved as .erf by default. This file must be
placed into the "hak" subfolder of the NWN2
installation folder!

The way to bind a hak-pack to a module is the following: open the module in the
toolset, click View->Module Properties, move the pointer to the Hak Packs field
and click the "..." button that shows on the right.

Now click Add and set the FileName field by browsing for each hak-pack you
want to use. The same content in the later ones you add overrides the previous
ones. The different content from each of them will stack though.

Page17/23

6. Custom blueprints and 2DA files


What if you decided to add 100 different trees to your module? Would you
override 100 of the original tree models and sacrifice the ability to use them in
the toolet? Or would you override 100 of the useful placeables like barrels,
tabels, chairs etc.? What if you don't want to lose any of the original content but
still be able to import your own? Well, that requires a little more hacking.
Note that what we are doing here is not creating a new creature or placeable
along with all its properties as a whole. Rather we are creating just a new
appearance that a creature or a placeable can have. The other properies of a
creature / placeable are set in its blueprint or specifically per-instance as its
placed onto the map. So where is the list of the possible appearances defined?
The list of the appearances is stored in two files, for placeables and creatures
respectively. The file used for the placeable appearances is "placeables.2da" and
the file defining creature and NPC appearances is simply "appearance.2da". Both
files are found in the 2DA subfolder unzipped from the 2DA.zip archive.

7. Hacking placeables.2da
Fire up the TlkEdit2 tool linked above, make a copy of the placeables.2da file
and open it. Note that the tool has some problems firing up and sometimes you
will wait indefinitely for it to open. If that's the case, ese the Windows Task
Manager to kill the hanging instances of the program and try again. Once you've
opened the file you will see it's a two-dimensional table or array (hence the
2da file ending). Each row in the table defines one of the possible placeable
appearances and entry in a column defines one of the appearance properties. If
a field contains the "****" value it means that it is not used. This value must be
exactly four stars, no more no less!
The fields important to us are Row.No, Label, StrRef and
NWN2_ModelName. The first field obviously defines the order of the row, the
Label field defines the internal name used for an appearance and the
NWN2_ModelName is the name of the MDB file used for the model, but without
the .MDB ending. StrRef number is actually a reference into another file, called
dialog.TLK and will be described later.

Page18/23

We are going to create our own entry now. Select the first row in the file and
click on the Copy Row icon in the toolbar. Then scroll down to the end of file and
select the empty row under the last row. Click the Paste Row icon.

There are strict row numbering rules. This means that your
row should have Row.No value equal to the RowNo above it +
1. There should be no holes in the numbering and you
shouldn't insert a row somewhere inbetween. If you do that,
you might affect all the content in the following rows up to
the end of file because the indexes will get shifted! You should also not use the
rows which are all "striked-out" with "****" values, since those are reserved for
potential additional content by the game.
The way you should set the fields in your row is the folowing:
Field Name
Label
StrRef
PlaceableModelType
Fade
NWN2_ModelType

Value
your appearance name
leave for now
0
1
the name of your model file withouth the ending

NWN2_LowGore

additional model for Low-Gore setting or "****"

NWN2_PartsCount
IsAccessory
ModelName
All the other fields

0
0
RESERVED (without quotes)
**** (without quotes)

Page19/23

This is a setup that I am sure to work, since I've tried it. I haven't yet tried to find
out the meaning of all the fields but so far I've been successful in using my
custom content with these settings.
Now about the StrRef field. This is actually the number of a row in the
dialog.TLK file. Open that file (its directly in the NWN2 installation folder) and
observe its content. Each row defines nothing but a piece of text. Actually this
file defines localized strings used inside the game and the toolset. All the other
files that support localized text point to this file instead and switching the
language to another one is simply a matter of providing a translated TLK file.
Quite smart.
As I said, we are only defining a new appearance for a placeable. This will be
available to select in our module for any blueprint or instance we create via the
Appearance drop-down menu in the placeable properties. But in order for our
custom appearance to actually appear in the drop-down menu, we have to
provide it with a localized name in the dialog.TLK file. This means that adding a
line to placeables.2da with the StrRef field empty, starred-out or invalid index will
make it unreachable from the toolset.

8. Hacking dialog.TLK
Now here's a buggy bug . Custom dialog.TLK files don't work from a hak-pack.
Additionally, they neither work from the Override folder. And finally, they don't
seem to really work from the "Custom TLK file" field of the Module Properties
panel either. What this means is the only way to make it work is to actually mess
with the original file, at least afaik. And there's more: if you change the contents
of your dialog.TLK file, you will fail to apply any updates to the game, since
the updater will rant about the file not matching the original. So you better make
a back-up copy of the original file before you try to edit it. You will have to reapply the changes to a new one after patching though. Actually it is much safer
to also apply your custom 2da lines to the new placeables.2da file after a patch
instead of still using the old copy, as you might lose some new content
introduced by a patch that way.
To add a line to dialog.TLK, scroll down to the end of file and double-click the
"String" field (the second one). Enter the localized name for your placeable
appearance. Once you deselect the row, its StrRef field (the first one) will be
automatically set to previous + 1.

Page20/23

Hit Save and switch back to placeables.2da. Insert the StrRef you got for the TLK
row into the StrRef field of your appearance line and save the file. You're done!

Page21/23

9. Try it out
Pack all your custom / changed files into a Hak Pack using the technique
described above. This means all the custom model files, textures, and the
hacked placeables.2da file. Fire the toolset, create a new area and map your Hak
Pack to the module using the technique described earlier.

Now create a new blueprint for your


custom placeable. Open the Appearance
field drop-down menu and scroll down to
the end. Hopefully, you should find the
localized name of your custom placeable
there. Double-click to select and close the
menu.
Move the mouse onto the map and place
your placeable. If all went ok you should
see your own placeable in the toolset!

Page22/23

10. Troubleshooting
If you can't find your placeable in the drop-down menu, assure your line in the
placeables.2da file is ok, that it points to a valid line in the dialog.TLK file and
that your hak-pack is mapped to your module.
In case the toolset crashes when you try to place the custom placeable or it is
simply not displayed, check again that you assigned both the diffuse and normal
(bump map) before exporting your model, that the model is named properly and
that its required User-Defined values are set.
However, if the model appears right but the textures are weird (some
blue/red/green/yellow rectangles and a text saying "texture missing") it means
that the toolset couldn't find the texture referenced by your model. Double-check
that you included the texture in the hak file / override folder and that it is in a
DDS format.
Creating a custom creature appearance might be a little harder, since there's a
lot of fields you have to set right, like target the proper skeleton and body / head
/ helmet files etc. But with a little bit of experimentation I believe you can
achieve that too. If you don't want to bother though, just override an existing
model, but then remember its name, so you know what you have to search for in
the toolset.

Page23/23

You might also like