Doors and dwk's for beginners
Come here for tutorials and 3d training. The aim is to point out good 3d training sites or methods.

Moderators: Winterhawk99, Mermut, Bannor Bloodfist

Post Reply
Posts: 363
Joined: Sat Dec 17, 2005 7:11 pm

Doors and dwk's for beginners

Post by OldMansBeard »

Most doors have a .mdl file and an accompanying .dwk file.

The .mdl defines the visible geometry (possibly animated) and the .dwk file defines the "invisible" geometry.

If a door is just a transition with no geometry to speak of, it doesn't need a dwk. Otherwise it probably does.

The filenames have to correspond, obviously, because that's how the engine knows they belong together.

Unlike tiles, where the wok file is just a copy of the walkmesh data in the .mdl, with doors the walkmesh is only in the dwk and not in the .mdl at all.

The dwk has to conform to a definite structure to work properly.

You might find it helpful to look at t_door01.dwk by way of example.

There are no animations in a .dwk, just geometry.

The base node of the dwk is a dummy called _DWK and all the other nodes in the dwk file are parented to it.

The dwk base node and its child dwk nodes are not mentioned in the .mdl file except that you may find them listed as dummies in the animations (but they don't have to be - it doesn't matter).

The child nodes in the dwk have special names and special functions. Conventionally, they all have names beginning with a prefix consisting of the last two characters of the followed by _DWK_ and then a suffix denoting their specific function.

There are two types of dwk geometry node: dp dummies and wg trimeshes. I've always supposed that dp stands for "dummy point" and wg stands for "walkmesh geometry" but I don't actually know.

It doesn't matter what order the dp dummies and wg meshes come in the dwk file, as long as they all follow the base node somwhere.

wg meshes

You need a wg mesh for each animation state defined in the .mdl file. Ordinary doors that swing either way have states 'closed', 'open1' and 'open2' so they have xx_DWK_wg_closed, xx_DWK_wg_open1 and xx_DWK_wg_open2 meshes to correspond.

Each wg mesh defines a simple kind of walkmesh corresponding to the door being in that state. The engine dynamically overlays the appropriate one over the tile walkmesh when the door is opened or closed.

The same material numbers out of surfacemat.2da are used for wg meshes as they are for tile walkmeshes. So 7 means nonwalkable, 8 means transparent and so on.

You can't overlay walkable wg over a non-walkable piece of tile and expect it to magically become walkable - it won't be. Likewise, you can't overlay transparent over obscuring and expect to be able to see through it.

dp dummies

These are points used by the engine to position the creature when it is opening or closing the door. There would normally be one or two for each possible state.

If your PC opens an ordinary closed wooden door, the engine moves the PC such that his hand is over the nearest dp_closed point when doing the "get mid" animation. Depending which side of the door he happens to be, it might be the xx_DWK_dp_closed_01 or the xx_DWK_dp_closed_02 node so these would be positioned a suitable distance each side of the door, near the doorhandle if there is one.

Likewise, there would normally be at least one dp for each open state (to position the creature for closing the door) but you can have more than one to allow for approaching the door from either side.

When positioning dp nodes, Z doesn't matter. It is conventional to set it to zero.

Posts: 153
Joined: Fri Apr 01, 2005 6:00 pm
ctp: No
dla: No
TBotR: No
nwnihof: No

Post by Chandigar »

ARGH. Ok... I'm about to give up. So, I've been building doors for a long time but I finally discovered that my doors aren't working properly... they open, close, etc exactly as they should and PCs are blocked from walking through them but for some reason NPCs can walk AND shoot right through the doors and PCs can target through the doors. I can't figure out what I'm doing wrong.

I built the doors based on Mr. X's door tutorial, I also checked all the stuff in this post and everything looks right... BUT the problem persists. Anyone out there build any doors from scratch and/or seen this problem before?

User avatar
Posts: 267
Joined: Wed Jan 05, 2011 10:21 pm
ctp: No
dla: No
TBotR: No
nwnihof: No

Errata Information

Post by Christopher »

I have only adj. door in a tileset and updated a 2da or so... But I horde information like nobodies business.

Reference link to another forum/Thread: Doors

I am also attaching a word Doc on the GFF format for doors. Not sure if it is of use to you, but someone might be able to use it. More of my horded information.

If I get the time I will update my notes further from Bioware post searching.

Post Reply