Grid Sage Forums

Grid Sage Forums

  • November 23, 2024, 05:57:28 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

LINKS: Website | Steam | Wiki

Author Topic: WASD movement in Cogmind  (Read 3084 times)

Shadowfury333

  • Derelict
  • **
  • Supported Cogmind Alpha Access 2015-2017 (Prime Tier)
  • Posts: 45
    • View Profile
WASD movement in Cogmind
« on: September 16, 2017, 08:53:23 PM »

I posted this on Reddit, but I figure I'd post here as well to get more feedback and testing.

I've been experimenting with AutoHotKey to use WASD (with chorded diagonals, so W+A moves northwest, S+D moves southeast, etc.) in several Roguelikes, including Cogmind. The code and compiled AHK script with example keybinds is on Github. Just put the commands.cfg in the appropriate folder with custom keybinds set up, run the AHK script, and it should work.

The only caveats are:
  • I think there is a minor issue where a key gets locked as "down". I can't find a way to reproduce it, it's only happened a couple of times within about 10 hours of testing, it only happened recently (after at least 50 hours of testing), and quite a few lines of code are dedicated to pre-empting that issue in the first place, but if it happens hitting the offending direction again will clear it up. Thankfully the natural instinct is to move in the opposite direction, which will keep the character in place while the player hits the correct key.
  • Running (Shift+WASD) and Mapshifting (Alt+WASD) only work diagonally, since Shift/Alt+Any Letter does their inventory function (ex. Shift+a will pop up the info window for the part labeled a, but Shift+a+s will move 10 spaces southwest). This is because there is no way to adjust how Cogmind handles inventory keyboard keys, and if a player wanted to find info for part 'd' they shouldn't be expected to use a mouse or else simultaneously move 10 spaces. I don't know if there is a solution to this besides a mode that forces inventory management to only use the mouse. Ctrl+Shift+WASD (force melee) works in all directions.
  • While the script handles pressing and releasing a wasd key quickly (within a frame or two), there is a bug where the modifier keys used are forgotten. My AHK knowledge isn't quite good enough to figure out why. For now, Modifier+wasd needs to be held down until the expected action occurs.
  • Currently the only way to configure the input keys and compatible games is by recompiling, though the relevant parameters to change are at the very top. If there's demand I'll set up an ini file for this, but for now the ini file only controls buffer timings.
  • Not so much a script caveat as a speed issue, but AFAIK Cogmind has no "shoot here immediately" mouse command (unlike DoomRL and ToME, which do this on right-click). This means it's often easier to use 'f' to fire even with the mouse always in one hand, especially since left-click will only target if an enemy is hovered over, otherwise it will make you move.

As for the rebinds, short version (anything not listed is unchanged):

    wasd - Movement/menu manipulation. Basically replaces numpad keys
    x - wait
    q - pick up item
    e - pick up and attach item
    c - look mode
    f - fire
    r - status
    z - item info (item under cursor (look mode)/player (otherwise))
    v - order ally
    Shift+Alt+1-4 - Coverage/Energy/Integrity/Matter modes
    Shift+Alt+g - Go naked
    Shift+Alt+f - Show volley range
    Shift+Alt+z - Intel toggle mode
    Shift+Alt+v - check ally orders
    Ctrl+PageUp/PageDown/End - Log manipulation (PageUp/PageDown/Home/End are used internally for diagonals)

Also, in case anyone is worried about accidental movement (it does use chorded diagonals, so s+d is southeast, for example. Meaning s -> s+d would be south -> southeast if not handled properly), there's a 67ms buffer where the script checks for a second key, so even sloppily going from one key to two keys will get the intended diagonal, though pianoing from one key to the next (i.e. releasing in between) will perform two cardinal movements. Going from chord to single key does seem to quickly shift from diagonal to cardinal, and I'm going to be testing that further to see if I can make sure release buffering works like press buffering can shift quickly from diagonal to cardinal, but it follows the same buffering rules as sloppily pressing two keys, so the issues should be rare. If issues come up, increase the amount of buffer frames in the ini file.
« Last Edit: January 30, 2018, 11:09:42 PM by Shadowfury333 »
Logged