Doors
Written by Fidcal
STILL BEING CHECKED AND TESTED BUT COMMENTS WELCOME...
Introduction
This tutorial explains how to put doors into your Dark Mod map using Dark Radiant and adjust them and their properties.
Quick way for the moderately knowledgeable to skip the detail and just get an ordinary unlocked door in your map as fast as possible you need only...
- Create a door model
- Change it from func_static to atdm:mover_door
- Create a door handle (must be created after the door!)
- Change it from func_static to atdm:mover_door_handle
- Add the door_body property to the handle and give it the name of the door
- To open clockwise change the rotate property from 0 90 0 to 0 -90 0.
The rest of this tutorial assumes very little prior knowledge so is suitable for beginners even without Doom editing experience. You need to know:
- 'entity inspector' is available from the view menu or shortcut key.
- 'orthoview' means any of the xyz top, side, front, grid views
- Up, down, left, and right in Dark Radiant's top orthoview are regarded here as the standard map directions of North, South, East, and West where useful for clarity.
- Where the term brush is used with a door it mostly also applies to a door made up of a group of brushes and/or patches.
- Where the term door is used it often will also apply to any object you wish to rotate when frobbed, for instance an openable window, box lid, or even more exotic objects that the imaginative mapper might conceive like a signal, engine part, toy, or whatever. So long as it needs to turn or slide just a fixed amount when frobbed then return when frobbed again then the following applies.
Door types
All tangible objects in Dark Mod are entities having either a pre-made model shape or else brush/patch(es). So there are two ways to create a door in Dark Radiant: as a model door or a textured brush door (or a hybrid of the two.)
Models are ready made door objects but cannot within Dark Radiant (at the time of writing) be resized, rescaled, or retextured, cropped or clipped whereas brushes are very flexible in that respect and can be worked into custom shapes for your map, including secret doors that blend into walls and other surfaces.
Although many models are already assigned to entities in Dark Radiant's right click create entity list, all door models are (at the time of writing) in the create models list and are automatically assigned to static entities by default. So these are immediately useable as static doors or can be quickly made into functioning doors (see later.) by re-parenting them to a functioning door entity.
Remember also that door functions may be applied to objects other than doors for instance to openable windows, drawbridges, gates, in fact anything that needs a partial rotation or slide when frobbed then return when frobbed again such as a signal device.
Creating a Door
Put simply, to make a door you will be creating an 'entity with model' or 'entity with brush' or some variation thereof.
Creating a Model Door
There are two approaches to make a model door; the first is simpler for a working door; the second if you just want a static door. But both routes can produce a fully working door.
First approach:
- Create any temporary brush
- Right click in orthoview and select Create Entity then atdm:mover_door.
- Left lick the model name line in the entity inspector.
- Below it on the Entity Inspector panel you should now see a button 'Choose Model'
- Left click it, select a door model from the darkmod group.
- Note that you can left drag the image in the Choose Model dialog to rotate it around.
- The temporary brush was deleted.
- You now have a working door with default properties.
- To add a handle and other adjustments, see Customising and Adjusting Door Properties later if needed.
Alternatively you can do it the other way round:
- Right click in the orthoview, select Create Model then darkmod and select a door.
- Note that you can left drag the image in the Choose Model dialog to rotate it around.
- Click OK and you have a static door.
- If you want to make it work (openable, frobbable) then...
- Select the entity inspector,
- Select the top classname line so it highlights
- Select the func_static line in the input box + check(tick) button below the properties window.
- Edit func_static to atdm:mover_door
- Click the check(tick) button
- You now have a working door with default properties
- To add a handle and other adjustments, see Customising and Adjusting Door Properties later if needed.
Creating a Textured Brush Door
The simplest brush door:
- Tip : If unsure of size then you might insert a temporary human AI first to get a sense of height.
- Drag out a new brush to the size required, eg, a seven foot high door is 84" x 1.1 = about 90 units in Dark Radiant.
- Give it a door texture from the texture browser (or wall texture for a secret door)
- Right click in orthoview and select Create Entity then atdm:mover_door
- You now have a default door that rotates around its centre.
- To move the rotation point to the door edge and other adjustments, see * See Customising and Adjusting Door Properties later if needed.
Multi-brush doors:
More complex multi-brush doors can be created using the clipper tool, CSG, etc. (not covered in this tutorial) and then assign atdm:mover_door for that whole brush structure. Also you can collect various brushes position together in relation to one another as needed, select them all, then assign atdm:mover_door for the group. All the brushes will be children of the atdm:mover_door entity and will rotate and be frobbable, etc. as one unit, as one door. To add further brushes or even model shapes later see the section on Adding handles and other items to doors
Customising and Adjusting Door Properties
Handles, lockplates, etc. can be added to doors and door properties can be adjusted for rotation, sliding, locking, and more.
Adding handles and other items to doors
You can add handles and other items to doors such that they move correctly with the door whether rotating, sliding, or both and even if the door is not vertical such as a skylight or trapdoor.
To add a working model door handle (works with both a model door and a brush door):
- First make sure you create the door first. Don't create a handle then a door then try to add the handle!
- Proceed as for Creating a Model Door above but instead of the entity atdm:mover_door use atdm:mover_door_handle and when you choose a model choose a door handle instead of a door.
- Position it where you wish on your door. (brush door too thick/thin? see Resizing and Retexturing a Brush Door)
- To synchronize this with your particular door you need to add the property door_body and the individual door name to the handle. To do this...
- Select the door.
- In the entity inspector, select the name line
- Select the bottom line in the input box below the properties window.
- Highlight the name and copy it to the Windows clipboard (Menu > Edit or Ctrl + C)
- Deselect the door with Esc
- Select the handle
- Select the top line in the input box below the properties window.
- Edit it to read door_body.
- Select the bottom line in the input box below the properties window.
- Paste in the door name (Menu > Edit or Ctrl + V)
- Click the check(tick) button
- You now have a working door handle with default properties
To add a brush to a brush door:
- Select the brush door. If it is consists of more than one brush then select them all (entity must be last.)
- Use Menu > Edit > Parent. This ensures the parent entity adopts the new item(s).
- If you have trouble selecting them in the orthoview because other brushes, etc. get selected then try in the camera view or as a last resort move them temporarily to an open area (but keep them in the same positions relative to each other.) Use Shift + Left Click on new item(s) then Shift + Left Click on main entity. Once they are all selected use the Menu > Edit > Parent.
To add non-handles, eg, knockers, hinges, whether model or brush to a Model Door:
- This method is not ideal. Maybe later there will be a better way.
- Do not use the same method as for a brush door.
- Select the brush.
- Right click in orthoview and select Create Entity then atdm:mover_door_handle
- Position it where you wish on your door.
- To synchronize this with your particular door you need to add the property door_body and the individual door name to the brush entity. To do this...
- Select the Model door.
- In the entity inspector, select the name line
- Select the bottom line in the input box below the properties window.
- Highlight the name and copy it to the Windows clipboard (Menu > Edit or Ctrl + C)
- Deselect the door with Esc
- Select the brush entity
- Select the top line in the input box below the properties window.
- Edit it to read door_body.
- Select the bottom line in the input box below the properties window.
- Paste in the door name (Menu > Edit or Ctrl + V)
- Click the check(tick) button
- This brush turns like a handle. To stop it...
- Adding rotate 0 0 0 or disabling the handle script won't help.
- Add a real handle (as in the section above To add a working model door handle... and it must be added LAST.)
- If you don't want a real working handle added maybe try another tiny brush with the handle function and hide it inside the door?
Locking Doors, Keys and Lockpicks
To lock a door check the show inherited properties in the entity inspector for a atdm:mover_door entity and you should see the locked property. Select it and in the input box below the properties you can change its value:
0 = unlocked (default) 1 = locked
If locked it will require an entity that is associated with it to be able to act as a key to unlock it.
To make a door lockpickable check the show inherited properties in the entity inspector for a atdm:mover_door entity and you should see the pickable property. Select it and in the input box below the properties you can change its value:
0 = unpickable 1 = pickable (default)
If pickable then the door can be opened with a lockpick.
lock_pins property (WIP - UPDATE LATE) SEE ALSO SOUND SECTION FOR PINS.
Open, Partially Open, or Closed Door at Game Start
By default, doors are closed at game start. If you want a door to be already open or partially open then do the following. Note that at the time of writing this has no effect on a door that is closed, that is, with the open property to set to 0. This means that when a player tries to open a partially opened door it will first close and can then be opened. So you might consider some other method such as starting it fully open, triggering it to close but block it half way then remove the blockage.
Rotating Door:
- Select the door.
- Make sure its open property is set to 1
- Select the entity inspector
- Check show inherited properties
- Select the open property
- Edit the value to 1 in the input box below and click the check button
- The door will now be fully open at game start.
- If you want it only partly open:
- Right click the entity inspector and select add property
- Click the + sign on the left of the top line where atdm:mover_door is listed to open the folder. (if atdm:mover_door is not listed then the entity was likely changed from eg, func_static. If so, save the map and reload to update the add property list)
- scroll down, select start_rotate then click OK.
- This adds it to the property list.
- Now select start_rotate in the property list.
- Edit the bottom line of the input box below the properties window to the angle you want in the same form as described in the Rotate Direction and Open Angle section. So for example, to have a door with a fully open default rotate value of 0 90 0 to start only half open you would give it a start_rotate value of 0 45 0. (remember, when first frobbed it will close not open fully)
Sliding Door:
- Select the door.
- Make sure its open property is set to 1
- Select the entity inspector
- Check show inherited properties
- Select the open property
- Edit the value to 1 in the input box below and click the check button
- The door will now be fully open at game start.
- If you want it only partly open:
- Right click the entity inspector and select add property
- Click the + sign on the left of the top line where atdm:mover_door is listed to open the folder.
- scroll down, select start_position then click OK. (if atdm:mover_door is not listed then the entity was likely changed from eg, func_static. If so, save the map and reload to update the add property list)
- This adds it to the property list.
- Now select start_position in the property list.
- Edit the bottom line of the input box below the properties window to the position you want in the same form as described in the Sliding (Translation) Amount and Direction section. So for example, to have a door with a fully open default translate value of 0 50 0 to start only half open you would give it a start_position value of 0 25 0. (remember, when first frobbed it will close not open fully)
Rotation Centre, Pivot, Hinge point
The centre of rotation of a door is at the origin point of its entity and the door rotates with reference to the orientation of that origin point, not the world map. See Rotate Direction... for more about that. This section only deals with the position of the rotation centre in the door.
Model Door Centre of Rotation:
The centre of rotation of a model door cannot be changed within Dark Radiant. Because a model door rotates around the centre 'spine' of its back edge this will cause clipping (penetration into solid) as in this example (where the door is set to open to 89 degrees for clarity):
So care is needed with placement. You will not normally position a door right next to a wall as in the example but against a shallow frame so clipping will barely be noticeable but either way it can fixed. You can correct it by adding a translation (see Sliding (Translation) Directions) value of half the door width in the direction of the door handle. This will gently move the door out as it rotates to clear any solid on that side as in this diagram:
Half a door width will typically be about 2. Any 'attachments' such as door handles will still synchronize with the door movement whether the door is rotating, sliding, or both.
Brush Door Centre of Rotation:
The centre of rotation of a brush door can be changed. The default origin point of a brush is at its centre. Therefore a default rotating brush door will rotate around its centre when you first create it. So, mappers will commonly need to move that rotation point to a corner or even to some other offset position for example, for an openable window using the door function.
Put simply, to move the rotation point of a brush door you need to move the entity origin relative to the brush(es) or vice versa.
Moving the entity origin (centre of rotation) relative to a brush door:
- Tip: easy way to get the coordinates of the point where you want to move the centre of rotation:
- Deselect door.
- Select an orthoview through the rotation axis, eg, top view if normal door rotating around a vertical axis.
- Drag out a small temporary brush roughly at the point you want the rotation.
- Zoom in if necessary and reduce the size of the temporary brush very small say, to 2 x 2 grid units.
- Drag it so its centre is at the point where you want the door to rotate. This should be on the corner on the leading edge side (the side to where the door is opening.) to avoid clipping as in this diagram....
- Right click orthoview and select convert to func_static to give it an entity origin
- In the entity inspector click the origin line
- Select the input box + check(tick) button below the properties window.
- Drag the mouse over the origin coordinates to highlight.
- Copy the coordinates to the Windows clipboard (edit menu or Ctrl + C)
- Click orthoview and hit backspace to delete the temporary brush.
- Select the door.
- In the entity inspector click the origin line
- Select the input box + check(tick) button below the properties window.
- Copy the coordinates back from the Windows clipboard (edit menu or Ctrl + V)
- Click on the check(tick) button to confirm and apply the new coordinates.
- In the orthoview you should see the origin icon move to the new position.
- You should now find that door rotates around that point.
Rotate Direction and Open Angle
By default, rotating doors open anti-clockwise (viewed from above) by 90 degrees from the start orientation. If you want to change this edit the rotate property in the entity inspector. Don't confuse this rotate action with the start rotation property. In the entity inspector remember that to see the inherited rotate property you must check the box 'Show inherited properties'.
The three values shown in the rotate property are degrees from the closed position around Y Z X entity origin axes (NOT absolute map axes) and so include any start rotation. So the Z value is the axis vertical to the entity origin. If you tilt a model door over in Dark Radiant then its entity origin tilts too so the Z axis is tilted too (with respect to the world map vertical.) So with a normally opening model door if you lay it flat on its back it will open upwards and not rotate around on the floor. But a brush door must be treated differently...
If you turn a brush door using the normal Dark Radiant rotate tool or the Transform Dialog (accessed via a shortcut key) then it only turns the brush relative' to the entity. So, because the entity origin is by default aligned with the world map then in most cases you can regard a brush door as rotating with respect to the world map if you wish. But there will be a problem when you come to rotations that are not around the main Y Z X axes of the map, for instance a drawbridge that lowers down to the south east. You might think you can combine Y Z X values to get the result you want - and this can be done (for south east use 45 45 90) but it is a bit of a kludge and the drawbridge twists eccentrically as it lowers (though it arrives correctly!) So for such cases you need to turn the entity itself so its start position is facing south east. You can then just use 0 0 90 to lower the drawbridge perfectly because its Y axis is now pointing south east. To turn the entity you must type or paste the rotation values in directly because using the Dark Radiant rotation tool or Transform Dialog will only turn the brush not the entity. The values are rather lengthy (south east is 0.707107 0.707107 0 -0.707107 0.707107 0 0 0 1) so probably the easiest way is to create a temporary model door, turn it how you want, then select its rotation property. If you now deselect and re-select your brush door then that property will still be in the entity inspector input box and you need only click the check(tick) box to add it to the brush door. NOTE: neither the entity nor the brush will show as turned in Dark Radiant. Only the rotation property in the entity inspector will indicate the orientation. Instead of a rotated construction, regard it as a rotation instruction for when the map is compiled.
These are the rotate property fields. Remember they are all with reference to the door's entity not the world map. Since there is no absolute frame of reference I indicate them here as if the entity is aligned with the world map axes...
- Positive Y = Open clockwise (Dark Radiant grid front view, looking north)
- Negative Y = Open anti-clockwise (Dark Radiant grid front view, looking north)
- Positive Z = Open anti-clockwise (Dark Radiant grid top view, looking down)
- Negative Z = Open clockwise (Dark Radiant grid top view, looking down)
- Positive X = Open anti-clockwise (Dark Radiant grid side view, looking west)
- Negative X = Open clockwise (Dark Radiant grid side view, looking west)
The values are in the range -179 to +180. Positive values give an anti-clockwise opening rotation (looking down from above) and negative values give a clockwise opening rotation. The value 180 is unique in that it continues in an anti-clockwise rotation when closing rather than returning clockwise so might be used if you can think of some object that might need such a motion when frobbed!
Edit the rotate value by selecting it and using the input box at the bottom and clicking the check(tick) button. That will change the angle the door will open to. Note that the line with the original default of 0 90 0 will still be there but your new entry will be added on a separate line and that is the one that will work in the game. CAUTION: when adjusting later make sure you have your new line selected and not the original! If you do it will appear to change but your first setting will remain unaltered.
Examples:
- 0 90 0 = Opens anti-clockwise round the entity's 'vertical' to 90 degrees - typical vertical door.
- 0 0 90 = Lowers a drawbridge from the entity 'vertical' to horizontal.
- 0 0 -45 = Opens clockwise by 45 degrees viewed from the east side. This might suit a skylight in a sloping roof.
Combinations can be used and also combined with slide motions (see Sliding (Translation) Directions) to produce exotic and useful motions. A door opening against an upward-sloping floor can thus have a lifting hinge and raise up slightly to clear the floor; a door can rotate towards you and slide back to one side very effectively.
Sliding (Translation) Amount and Direction
By default a Dark Mod do`or will rotate open. For most sliding doors you want to stop them rotating as well. You cannot delete (remove) the rotate property - you have to set the rotate property to 0 0 0 to stop a door rotating (see Rotate Direction and Open Angle.)
Now edit the translate property value by selecting it (remember to have inherited properties box checked) and using the input box at the bottom and clicking the check(tick) button. That will change the distance the door will slide to. Note that the line with the original default of 0 0 0 will still be there but your new entry will be added on a separate line and that is the one that will work in the game. CAUTION: when adjusting later make sure you have your new line selected and not the original! If you do it will appear to change but your first setting will remain unaltered.
Typically (but not always) you will want your sliding door to slide the width of the door. The three values in the translate property by default are 0 0 0 and are X Y Z absolute map values (irrespective of door orientation) where...
- Positive X = Slide East (Right side of Dark Radiant grid in top view)
- Negative X = Slide West (Left side of Dark Radiant grid in top view)
- Positive Y = Slide North (top of Dark Radiant grid in top view)
- Negative Y = Slide South (bottom of Dark Radiant grid in top view)
- Positive Z = Slide Up (Top of Dark Radiant grid in side views)
- Negative Z = Slide Down (Bottom of Dark Radiant grid in side views)
So for a 50 unit wide door you want to slide fully to the east you would use 50 0 0 for the translate property values. A 100 unit portcullis sliding vertically up would need 0 0 100 to be fully raised.
Sounds and Sound Propagation through Doors and Doorways
Sound propagation relies on visportals. For details study Sound Propagation: Part 1 and Sound Propagation: Part 2 as well as Visportals This tutorial will just cover the relevant sound and sound propagation properties of doors. If you set the show inherited properties box in the entity inspector you can see them as described here.
The sound of doors opening and closing is set in the snd_open and snd_close properties. You can silence them by setting the following properties as shown:
snd_open null
snd_close null
Don't just use a dash - as it seems to cause a sound of its own.
snd_locked
The sound played when a player tries to open a locked door.
snd_unlock string
The sound played when a player unlocks a door.
"loss_open"
Drop in sound volume in dB when going through an open door. (default 1dB)
"loss_closed"
Drop in sound volume in dB when going through a closed door. (default 15dB)
"loss_double_open"
Drop in sound volume in dB when going through double doors when only one is open. (default 1dB)
There are also various sound properties for lockpicking:
snd_lockpick_pin_1 through 14 and snd_lockpick_pin_success
Speed of Door Opening and Closing
Rotating Door Speed:
At the time of writing, the time a rotating door takes to open or close is set in the move_time property whatever its maximum open angle. So with rotation set at say 150 degrees the door just opens faster than at say 80 degrees. This is likely to be changed to a constant angular velocity so check to see if there a new property added if the following no longer works. The problem is that if the door is frobbed while in motion it stops; another frob will reverse the motion - so if the door is only open a crack it will still take the full time to close and vice versa.
To change the time a rotating door takes to open or close, make sure the door is selected then...
- Right click the entity inspector and check show inherited properties
- Scroll down, select move_time
- Edit the second line of the input box below the properties window to the time you want.
- The time is in seconds and decimal fractions can be used.
- The default is 1 second and if set to this then the door opens and closes in one second whatever the maximum open angle, great or small.
Sliding Door Speed:
The speed of a sliding door is set in the translate_speed property. To add this, make sure the door is selected then...
- Right click the entity inspector and check show inherited properties
- Scroll down, select translate_speed
- Edit the second line of the input box below the properties window to the speed you want.
- The speed is in Dark Radiant grid units per second.
- The default is 0 and if set to this then the door slides open in one second whatever the distance, great or small.
- CAUTION: If you later change the door back to a rotating door then delete the translate_speed property or ensure it is set to 0 as (at the time of writing but this will be fixed) a bug makes rotating doors open and close instantly.
Visportals and Doors
A visportal face surrounded by solid at its edges and in contact with a door is closed when the door is closed and enabled when the door is open. For full details see Visportals
Extra Notes
The property interruptable determines whether a door can be stopped by frobbing while it is opening or closing.
The property "editor_var master_open" is for if you have associated doors for opening then one should serve as master. Presumably for such as double doors opening and closing together. At the time of writing I have not found any further information on this and might not yet be implemented.
The property "editor_var master_lock" is like "associate_master_open above but for locks.
func_darkmod_door is no longer used (just in case you come across it in the Dark Mod forums or wiki.) The Doom func_door is still available but for Dark Mod, atdm:mover_door is the entity to use.