Doors

From The DarkMod Wiki
Jump to navigationJump to search

Written by Fidcal

For the impatient

Quick way to get an unlocked door in your map:

  • Create a model from any of the available door models
  • Change it from func_static to atdm:mover_door
  • Create a door handle
  • Change it from func_static to atdm:mover_door_handle
  • Add the door_handle property to the door and give it the name of the handle
  • To open clockwise, change the rotate property from 0 90 0 to 0 -90 0

Introduction

This tutorial explains how to put doors into your map using Dark Radiant, as well as adjust them and their properties.

The rest of this tutorial assumes that you have a basic understanding of using DarkRadiant. If you haven't done so, please go read the Dark Radiant Must Know Basic Intro article first.

Additionally:

  • 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, 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 (under models/darkmod/architecture/doors) 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 making 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.

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 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 below the properties window.
    • Edit func_static to atdm:mover_door
    • Click or press ENTER

In both instances, you now have a working door with default properties.

To add a handle and other adjustments, see #Customising and Adjusting Door Properties below.

Creating a Textured Brush Door

Tip: If unsure of size then you might insert a temporary human AI first to get a sense of height.

The simplest brush door:

  • 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 center.

To move the rotation point to the door edge and other adjustments, see #Customising and Adjusting Door Properties below.

Multi-brush doors:

More complex multi-brush doors can be created using the Clipper tool, CSG, etc. - this is not covered in this tutorial. Then assign atdm:mover_door for that whole brush structure. Also you can collect various brushes positioned 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):

  • Create a door and a handle (the order does not matter).
  • 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.
  • Note down the generated name for the handle entity, or give a useful name like MyHandle.
  • Select the door the handle should be attached to, add a new property door_handle and use the name of the handle as its value.
    • Click or press ENTER

You now have a working door handle with default properties.

To add a brush to a brush door:

  • Select the new brush and the brush door all together; the entity must be selected last.
  • Use Edit -> Reparent primitives. 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+Click the left mouse button on new item(s) then SHIFT+Click the left mouse button on main entity. Once they are all selected, use the Edit -> Reparent primitives.

To add model static items: knockers, hinges, static handles etc. to a Model Door:

  • Select item
  • Right click in orthoview and select Create Entity then entity func_static
  • Position it where you wish on your door.
  • To synchronize this with your particular door you need to add the property bind 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.
    • Copy the name
    • Deselect the door with ESC
    • Select the brush entity
    • Add a property "bind" to it.
    • Change the value of the property by pasting in the door name
    • Click or press ENTER

To add brush static items: knockers, hinges, static handles to a Model Door:

  • This method is not ideal but it seems to work OK.
  • 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_handle on the door, and give as the value the name of the brush you just created.

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 working handle (as in the section above To add a working model door handle... and it must be added LAST.)

If you don't want too see a real working handle added maybe try another tiny brush with the handle function and hide it inside the door?

Locking Doors

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.


Keys

Assigning specific keys to specific doors is simple.

  • The key is just a func_static model or brush.
  • Make sure it has the properties:
useable 1 [so it can be used by the door]
frobable 1
inv_name <unique name>
inv_category Keys
inv_target player1
inv_icon guis/assets/hud/inventory_icons/<icon name>
inv_stackable 0 or 1 where 1 can be used on all copies of the same key so they show as one entry in the inventory with a total.

Add to the door the property used_by with the key as the value. Multiple keys can open the same door using the semi-colon as a separator, e.g.:

used_by
doorkey_1;doorkey_2


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...

Lockpicks

lock_pins property (WIP - UPDATE LATER) 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.

Already Open Rotating Door:

  • Select the door.
  • Select the entity inspector
  • Check show inherited properties
  • Select the open property
  • Edit the value to 1 in the input box below and tick the check button
  • The door will now be fully open at game start.
  • If you want it only partly open:
  • Make sure its open property is set to 1 as above.
  • 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 Click the OK button
  • 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 that has 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.
  • In a similar way add the property first_frob_open".
  • Set it to 1 and a partly open door should then open fully on the first frob.
  • Set it to 0 and a partly open door should close on the first frob.


Already Open Sliding Door:

  • Select the door.
  • Select the entity inspector
  • Check show inherited properties
  • Select the open property
  • Edit the value to 1 in the input box below and click or press ENTER
  • 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
  • Make sure its open property is set to 1
  • 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 that has 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.
  • In a similar way add the property first_frob_open".
  • Set it to 1 and a partly open door should then open fully on the first frob.
  • Set it to 0 and a partly open door should close on the first frob.


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 be 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.)

Moving the entity origin (centre of rotation) relative to a brush door:

  • Select the brush door
  • Select Vertices mode (default shortcut key is V or button on top toolbar 'Select Vertices')
  • Drag the door's entity origin to 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....

  • 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 property with the 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 default 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 door will rotate open. For most sliding doors you want to stop them rotating as well as make them slide. 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) You would want to set this very high to block all sound with a thick door but very low for a barred gate for example.

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 an interruptable (see Extra Notes) door is frobbed while in motion it stops; another frob will reverse the motion - so even 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. (Note: you can still mix sliding with rotating but check - this bug might only be if translate is set to 0 0 0)

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. In most cases you will place a visportal in contact with a working door unless you can see through the door (such as a true glass door or barred gate.) For full details see Visportals.

Auto-Closing Doors

Note that auto-closing doors and AI closing doors behind them, is very much work in progress at the time of writing, so for now, this is another method that works. Check first if true AI closing of doors is working yet before bothering with this!

I have one door that I particularly want the AI to close as there is a bit of frame lag inside if not. So I set this up and it works good as an auto-closing door - not as good as a true AI closing door as it will auto close when the player goes through as well but it does look very effective to see AI going through and closing the door behind them. Not tested exhaustively so I don't know if there could be any downside. Here's what to do....

First a quick summary to make it more clear:

A trigger_relay is used both as a relay AND carries a stim. We put the trigger_relay with its stim in the path of the open door. The door has a response property. When it opens and contacts the stim its response is to send a signal back to the relay. The relay pauses then closes the door...

  • First, optionally give your door a suitable name like autodoor1, whatever.
  • Copy that name to the clipboard.

Next we need a relay with a delay:

  • Create entity > darkmod > trigger_relay
  • Place it roughly at the position the door will be at when open and to be on the safe side 3/4th of the way to the far end of the door (not the hinge end) to give max distance from the close door.
  • Add the property 'target' and paste in the door name you just copied.
  • Give the relay itself a name, eg, autoDoor_relay_1, and copy that name to the clipboard, you'll need that too in a bit.
  • Add the property delay and the value 3 - this is the delay in seconds before the door will close; 3 seems about right but 2 might be worth a try because to that 3 is added a random value between 0 to 0.5 seconds from the Time Interval we entered for the stim firings.
  • Add the property 'wait' and the value 3. This is the time before it can work again in seconds. If you set it too low then in theory the door might trigger again but in this situation I don't think it's possible. Too long, eg, one minute, and it won't work if the AI goes back through the door before then. If this value is -1 then the whole thing will only work ONCE so might be used for an AI who goes through once, closes it behind him, but you don't want it to be an autodoor thereafter.


That's the relay, now we add a stim to it:

  • Custom stim tab.
  • Click Add stim type, select the new custom stim type you just made at the bottom of the list and type in eg, autoDoorStim at top right in the input box.
  • Click the stim tab and the little drop down arrow against the 'type' selector at bottom left and you should see your new custom stim name. Select it.
  • Select the new autoDoorStim in the list and on the right you need only type in the radius box 15.0 There is quite a lot of room for error. I had it working on 10 and also on 25. The value should be less than the distance to the closed door else it will trigger open! But no so small that the door might not reach it.
  • Select the check box for Time Interval and enter 500 (millisecs.) This is so it doesn't keep firing more frequently than is necessary. This stim will be firing all through your mission whether the door is used or not so if you had dozens of these then maybe it would affect performance. Too big a number and there may be a long delay before the door shuts - but it will be random depending on the next time the stim happens to fire. We'll control the delay we want more precisely later.
  • Click Click the OK button to confirm it.


That's the stim set up, now for the response to it which is put on the door....

  • Click the little drop down arrow against the 'type' selector at bottom left and you should see your new custom stim name. Select it.
  • Right click in the big Response Effects box on the bottom right of the panel.
  • Add New Effect and you should get a default 'Activate Response' response added to the list. Double click it.
  • In the Effect selector at the stop select 'Trigger'
  • in the Target box, paste in the name of the relay you copied or you can select it from the list at the little arrow.
  • Leave the Activator box empty.
  • Click and then Click the OK button on the main S & R panel bottom right.

It should now work. No need to wait for an AI, just frob the door and watch it close itself. If not, check the position of the stim brush is close to where the door stops when open.

Doors as Triggers

by Ishtvan

Doors (or any binary frob mover, buttons, levers, etc) now have the option to trigger their target on closing or opening. (For definition purposes, a button is defined as "closed" in the state when it starts out and "open" in the state you press it down to. I know that's a little non-intuitive, but it came from deriving from doors).

New spawnargs on frob movers:

"trigger_on_open" If set to 1, this binary mover will trigger its targets when it starts out completely closed and is opened. Default is 1 (trigger)

"trigger_on_close" If set to 1, this binary mover will trigger its targets when it completely closes after being open. Default is 0 (do not trigger)

Extra Notes

The property interruptable determines whether a door can be stopped by frobbing while it is opening or closing. So by frobbing then frobbing again, the player can open a door to any position, eg, slightly ajar to peek through.

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, but atdm:mover_door is the entity to use.