Tutorial: Setting up custom controls

Everything around the Descent level editor

Moderators: Frustikus, Aus-RED-5

Sirius
Posts: 1987
Joined: Tue Sep 25, 2007 10:29 pm
Location: Bellevue, WA
Contact:

Tutorial: Setting up custom controls

Postby Sirius » Wed Aug 16, 2017 3:46 pm

Version 1.12.28 of DLE (http://www.descent2.de/files/dle-1.12.28.7z) introduces configurable camera movement controls. Since these cannot currently be configured through the UI (yet; I'll look at it but it's a lot of UI work) I figured I should write a how-to so you can actually make use of this feature.

The default mouse controls are as follows:
  • Pan camera: Ctrl + move mouse
  • Rotate camera: Ctrl + Shift + move mouse
  • Zoom: Ctrl + left/right click + move mouse (can also just left/right click without moving the mouse to zoom in/out one step)
  • Select: Shift + move mouse (most people, myself included, select things just by clicking; the advantage of this is it lets you select sides that are connected to other sides without an additional step)
These controls all work in both first- and third-person modes, though the behavior of rotation/zooming is somewhat different between the two. In third-person, zooming moves you closer to the "focal point"; in first-person, this point is you, so zooming just moves the camera forward/backward instead.
There are also some default keyboard controls, though they may be lesser-known:
  • A: Pan in (forward)
  • Y/Z: Pan out (backward)
  • Numpad /: Zoom out
  • Numpad *: Zoom in
  • Shift + down arrow: Pan down
  • Ctrl + down arrow: Rotate up
  • Alt + down arrow: Pan out (backward)
  • Shift + left arrow: Pan left
  • Ctrl + left arrow: Rotate right
  • Alt + left arrow: Rotate clockwise (bank right)
  • Shift + right arrow: Pan right
  • Ctrl + right arrow: Rotate left
  • Alt + right arrow: Rotate counterclockwise (bank left)
  • Shift + up arrow: Pan up
  • Ctrl + up arrow: Rotate down
  • Alt + up arrow: Pan in (forward)
Note the above mappings apply to third-person; things like Alt + left at least make sense that way because it appears to rotate the level left even if the camera is going the other direction. Controls like these are flipped for first-person because they don't make sense in that case.

1.12.28 also adds the concept of an "input lock". This is a toggle you can use to make DLE capture the mouse and use all movement to rotate the camera; it displays a crosshair at the center of the display while in this mode. If that's too abstract, it's intended to allow you to temporarily enter "Descent movement mode", where you can move around kind of like you're actually in the game. You can switch back by toggling the input lock again.

Configuration for all this stuff is done through dle.ini. There are four relevant generic settings that configure input handling:

Code: Select all

MovementMode=0
MoveSpeed=50.000
TurnSpeed=1.000
ForceFirstPersonOnInputLock=1

MovementMode can be set to either 0 ("stepped") or 1 ("continuous"). Stepped is the default; pressing a pan/rotate/etc key will move the camera in the corresponding direction in one step, and if you hold it down it will repeat in more steps kind of like you're holding down the "a" key in a text box. Continuous causes the input handler to use frame-time to move the camera, more like you would see in the actual game; when you press the key, the camera starts moving at a constant rate, and stops immediately when you release it.
Note that continuous movement mode only applies to keys you've set up binding for. The default keys I listed are handled separately (through the Windows "accelerator key" system) and don't get the benefit of this - though you can re-bind the same keys to the same commands through dle.ini if you want. (This is an area I might improve later. :))
Although 0 is the default for now, I strongly recommend switching this to 1 if you intend to use the input lock - it feels more natural that way.
MoveSpeed controls how fast the camera moves in response to a move/pan keyboard binding. 50 is the default.
TurnSpeed controls how fast the camera turns in response to a rotate keyboard binding. 1 is the default.
ForceFirstPersonOnInputLock determines whether switching on the input lock will automatically enter first-person mode even if DLE is configured to use third-person mode by default. It will switch back when you leave input lock. Default is 1 (enabled); I recommend leaving it this way since third-person input lock is kinda weird.

The actual keyboard bindings go under a separate section in dle.ini which starts with the "[DLE.Bindings]" heading. Here is a list:
Mouse state bindings

Code: Select all

PanButton
PanModifiers
PanInvertX
PanInvertY
RotateButton
RotateModifiers
RotateInvertX
RotateInvertY
ZoomButton
ZoomModifiers
ZoomInvertX
ZoomInvertY
ZoomInButton
ZoomInModifiers
ZoomOutButton
ZoomOutModifiers
ButtonDownButton
ButtonDownModifiers
QuickSelectButton
QuickSelectModifiers
AdvSelectButton
AdvSelectModifiers
ApplyAdvSelectButton
ApplyAdvSelectModifiers
MarkButton
MarkModifiers
UnmarkButton
UnmarkModifiers
QuickMarkButton
QuickMarkModifiers
ContextMenuButton
ContextMenuModifiers

Each state has up to four settings.
Button controls what button enters that state. The valid values are MK_LBUTTON (left click), MK_RBUTTON (right click), MK_MBUTTON (middle click), MK_XBUTTON1 (side button 1) and MK_XBUTTON2 (side button 2). You can leave this blank if you want the state to be entered without clicking a button (probably only sensible in conjunction with modifier keys). You can also add multiple buttons (e.g. "MK_LBUTTON,MK_RBUTTON") if you want any of those buttons to enter this state.
Modifiers controls what "modifier" keys need to be held down to enter that state, along with the mouse button(s) above. The valid values are VK_SHIFT (Shift key), VK_CONTROL (Ctrl key) and VK_MENU (Alt key). You can combine values (e.g. "VK_SHIFT,VK_CONTROL") if you want to have to hold both keys to enter the state; or leave it blank to allow the state to be entered without holding any modifier keys. (Again, you will typically want to have at least one of a button or modifier key configured if you want to be able to control DLE in any meaningful way. ;))
InvertX flips horizontal movement of the mouse in that state. 1 for flipped, 0 for default.
InvertY flips vertical movement of the mouse in that state. 1 for flipped, 0 for default.

These are the states:
Pan moves the camera left, right, up and down. By default, the Ctrl modifier is required but no button press.
Rotate rotates the camera left, right, up and down. The direction is flipped in third-person. By default, the Shift and Ctrl modifiers are required but no button press.
Zoom zooms the camera in and out in third-person; it moves the camera forward and back in first-person. By default, the Ctrl modifier is required, and either the left or right mouse button.
ZoomIn zooms the camera in one step in third-person; it moves the camera forward one step in first-person. By default this is Ctrl + left mouse button.
ZoomOut zooms the camera out one step in third-person; it moves the camera backward one step in first-person. By default this is Ctrl + right mouse button.
ButtonDown is a transitional state used to check whether most of the following states are allowed - I don't recommend changing it unless you need to allow additional buttons for the following commands (middle/x buttons). By default either left or right mouse button will enter this state.
QuickSelect is used to select items (it is entered from the button down state). By default this is the left mouse button.
AdvSelect is used to enter the "select" mode I described at the beginning of this article. By default this is the Shift key, no mouse button.
ApplyAdvSelect is used to select an item once already in the "select" mode. By default this is the left mouse button.
Mark is used to bulk-select cubes and vertices (by clicking and dragging). By default this is either the left or right mouse button.
Unmark is used to bulk-deselect cubes and vertices (by clicking and dragging). By default this is the Shift key plus the left or right mouse button.
QuickMark is used to mark cubes/sides in a single step. By default this is Shift + left click.
ContextMenu is used to show the mine view context menu. By default this is Shift + right click.

Keyboard state bindings

Code: Select all

MoveForwardKey
MoveForwardModifiers
MoveForwardInputLock
MoveBackwardKey
MoveBackwardModifiers
MoveBackwardInputLock
MoveLeftKey
MoveLeftModifiers
MoveLeftInputLock
MoveRightKey
MoveRightModifiers
MoveRightInputLock
MoveUpKey
MoveUpModifiers
MoveUpInputLock
MoveDownKey
MoveDownModifiers
MoveDownInputLock
RotateUpKey
RotateUpModifiers
RotateUpInputLock
RotateDownKey
RotateDownModifiers
RotateDownInputLock
RotateLeftKey
RotateLeftModifiers
RotateLeftInputLock
RotateRightKey
RotateRightModifiers
RotateRightInputLock
BankLeftKey
BankLeftModifiers
BankLeftInputLock
BankRightKey
BankRightModifiers
BankRightInputLock
ZoomInKey
ZoomInModifiers
ZoomInInputLock
ZoomOutKey
ZoomOutModifiers
ZoomOutInputLock
InputLockKey
InputLockModifiers
InputLockInputLock

Each state has three settings:
Key controls what key performs that action. Valid values are any of the alphanumeric keys ("A" to "Z", "0" to "9"), plus most special keys if you have the right code (VK_SPACE, VK_SHIFT, VK_CONTROL, VK_MENU, etc). You can look these up on the following page: https://msdn.microsoft.com/en-us/library/dd375731.aspx
(this is why a UI would be nice :))
Modifiers controls what "modifier" keys need to be held down to perform that action, along with the key above. The valid values are VK_SHIFT (Shift key), VK_CONTROL (Ctrl key) and VK_MENU (Alt key). You can combine values (e.g. "VK_SHIFT,VK_CONTROL") if you want to have to hold both keys, or leave it blank if you don't want to require any modifier keys.
InputLock determines whether the key binding will only be used under input lock; 1 to require input lock, 0 (or leave this line out of the .ini) otherwise. This is useful if the keyboard command conflicts with some DLE keyboard accelerator, as most do; while in input lock, these bindings will be processed first and any conflicting commands will be ignored. Don't enable this for the input lock binding though or you won't be able to use it. ;)

For completeness, these are the key bindings that can currently be set. Input lock was explained earlier; the rest hopefully should need no explanation.
MoveForward
MoveBackward
MoveLeft
MoveRight
MoveUp
MoveDown
RotateUp
RotateDown
RotateLeft
RotateRight
BankLeft
BankRight
ZoomIn
ZoomOut
InputLock

Finally, since all of that is pretty complicated, here's a sample section you can add to your dle.ini if you just want to enable a fairly basic WASD config that you can switch in/out of using the Shift+Space hotkey.

Code: Select all

MovementMode=1
[DLE.Bindings]
InputLockKey=VK_SPACE
InputLockModifiers=VK_SHIFT
MoveForwardKeyW
MoveForwardInputLock=1
MoveBackwardKey=S
MoveBackwardInputLock=1
MoveLeftKey=A
MoveLeftInputLock=1
MoveRightKey=D
MoveRightInputLock=1
MoveUpKey=VK_SPACE
MoveUpInputLock=1
MoveDownKey=VK_CONTROL
MoveDownInputLock=1
BankLeftKey=Q
BankLeftInputLock=1
BankRightKey=E
BankRightInputLock=1

Return to “DLE-XP Help”

Who is online

Users browsing this forum: No registered users and 0 guests