• (nodebb)

    The number of games that have QWERTY baked in hard (i.e. no way to rebind your keys), but use the "after applying the layout" key codes is ... not zero.

    The result is that they are fixed on WASD(1) for movement, but on my AZERTY keyboard, W is on the bottom row, not the top.

    At least one of these games was on Steam for not-much money, and it got seriously reamed in the comments(2) for its inability to remap keys. It was interesting enough that I just installed QWERTY-US as a second layout, but the attitude of the developers was that adding key rebinding was not a priority(3). The game was just interesting enough that when I discovered this attitude, I kept on, but it was one of those ... long ... moments looking at the option to refund the game.(4)

    (1) I have a T-shirt with "I walk with WASD... and I sprint with Shift" on it. Curiously, I bought it at an event in France.

    (2) Lesson: read the reviews before buying games on Steam.

    (3) Dudes, if it's not a priority for you, then perhaps playing your game is not a priority for me. Sadly, in this case, it was just barely interesting enough.

    (4) I was in two minds about revealing this, but the game in question was Deliver Us The Moon. Not normally my thing, but it was RTX-compatible, so ...

  • Sole Purpose Of Visit (unregistered)

    Personally I find the solution in the OP elegant, rather than hacky.

    (And no, you don't get to look at any of my representative "elegant" code.)

  • Greg (unregistered)

    Queue Germans and Austrians knocking at the door with their QWERTZU keyboard layout in 3... 2... 1...

  • German (unregistered) in reply to Greg

    Klopf, Klopf

  • Martijn Lievaart (unregistered)

    Given that a proper fix is in the works, and this solves the immediate problem, this is not a WTF. At all.

  • (nodebb)

    I still don't understand why "key down" in many frameworks is raised repeatedly when a key is held pressed, per OS repeat settings. Isn't "key down" supposed to be "a key was pressed down" and should be raised exactly once? "Key press" should be raised repeatedly for the "virtual" effect of repetition.

  • Bépo (unregistered)

    Made me wonder if there was a list of "falsehoods programmers believe about keyboards", but found nothing on google :/

  • Hal (unregistered)

    To me this is an example of the compromise we are often forced to make. Solve the problem at the wrong layer, violate the model, or tamper with something you don't have ownership over, they each have their draw backs.

    Most of us have run into that query that would be easy if we could use something like COMPUTE BY but the ORM does not expose that functionality, or that geometry class that for some reason does not make the radius of octagons to a corner but not to the center of one of the sides etc...

    1. You code around the round the problem pulling various primitive properties off objects and procedurallu get to what you need. It will work but a-hole will come along and complain its ugly without offering a better solution.

    2. You can break the model. Get the data you need some other way, completely departing from how the rest of the program does things, but at least the solution around the specific problem will be clean unlike in 1).

    3. Change the lower layer/library or whatever. You get a nice solution but a whole lot more work and re-work everytime upstream changes because you did not stick to interfaces they considered public.

    There is no winning this one. You just have to evaluate the specifics and pick your poison.

  • (nodebb) in reply to Bépo

    "Cursor keys can be combined with letter keys".

    On many notebook keyboards, there are hard locks on how many and which combinations of keys can be detected at the same time. I've seen a few games, where this made things like sprinting + jumping or diagonal shooting impossible, or only selectively possible.

  • ooOOooGa (unregistered)

    Dvorak user here too.

    Unfortunately I also don't have spare time enough for testing a game that I don't play. Though playing Freespace has been on my bucket list for a while.

    On the other hand, I don't know how much testing would actually be needed before adding another layout mapping to this. The hard part is getting everything to use the mapping. Once that is done and two mappings are supported correctly, adding a third or ninth wouldn't be very high risk.

  • Moogle (unregistered)

    Can I compliment Naomi on the excellent comment? That is exactly the kind of comment that I want to see just before an awful hack. It puts me in the right mindset, explains what the circumstances are, and then we begin reading the code.

    And in the right mindset—similar to watching a horror movie and being alert for jump-scares—such code can actually be quite appealing. It's not great, sure, but when the jump-scare happens you are absolutely ready for it, you appreciate the ingenuity, you check to see whether the circumstances have changed, and you move on. All's right with the world!

  • scriptninja (github)

    Forcing WASD for movement is, or at least used to be, a pretty effective guarantee that I would not play your shooter (other kinds of games where movement and aiming were important, but fast-twitch movement and aiming weren't, were a maybe).

    You can blame the original Unreal Tournament's (and maybe the original Unreal's?) sideways-dodge mechanism (double-tap strafe) and any-way-you-want keybinding support for this one.

    Where most people apparently got used to WASD for forward, backward, and strafing, and left and right mouseclick for fire and alt-fire...I built my control layout around AERGH.

    With strafing assigned to the mouse buttons.

  • WTFGuy (unregistered)

    @Hal: Very well said. If only more folks understood that and clearly included evidence of that thinking in their code and comments. i.e. "We considered A, B, and C, but ultimately decided to do D because of X, Y, and Z.

    Within your taxonomy only work-around 1 is truly acceptable. Anything that takes a dependency on implementation details or that sidesteps the API/ORM is totally asking to get irretrievably screwed in their vNext. Don't ask how I know.

  • (author) in reply to scriptninja

    Play however you want to play, but just reading about your mappings made me go "AERGH".

  • (nodebb) in reply to Moogle

    this. Hacks might be necessary to ship a thing, but as long as there is an explanation, maybe a ticket to remove the hack or change it to use the proper solution, and the code isn't written just to make some statement of "look how I am clever", then it's what actually most developer should live with. The trade off between shipping a feature in time and making it perfect creates these (which are embellished and called "tech debts" when there is a decent process to manage those properly and avoiding the code becoming an unordinate mess of things jumbled together with no rationale) and sometimes there's really nothing to be ashamed of.

  • (nodebb)

    On my code this goes under that "UAH" (Ugly-a***d-Hack) and I have a fair number of them, wrapped with a TODO and full documentation why this was a good idea at the time.

    I rarely get back to the TODO though. But I do spend a lot of time engineering things early on so that UAH's are rarely needed. Unfortunately on that end I can spend so much time working on a more elegant solution and/or design patterns that it drags things on far longer than if I toss in a UAH more frequently. And those are the more pragmatic moments in SW. Do something that's pretty, or do something that's ugly, but gets the job done. I think Joel Spolsky would likely choose the latter, especially if it's blocking the rest of the team's efforts.

  • (nodebb) in reply to Remy Porter

    I find "5+ button mice" worse honestly.

    In terms of keybindings, my overall best experience was World of Warcraft. I usually had attacks on the far-right of the main skill bar bound to the mouse wheel, and zoom to something like Ctrl+Shift+Mouse Wheel (since its barely needed). Even the basic idea of binding "mouse look" to "hold right mouse button" puts the convenience way beyond many other games, that make camera controls awkward.

    And one particularly nifty trick of WOW: In mouse-look mode, "turn left / right" would automatically become "strafe left / right". Other games leave to with the option to put either strafing on A,D (bad when moving keyboard-only, e.g. when taking a sip of water), or turning on A,D (bad when in mouse-look mode).

  • MiserableOldGit (unregistered)

    yeah, in terms of the clear comment and the rationale I don't see a huge problem. The WTF is that the shortcoming was so heavily embedded in the code base leading to this ... dumb assumptions made about users and their setup. Wouldn't even rush to blame programmers, the times I've raised comments about these sorts of things early on, only be over-ruled by some dumb PM/architect (or even end-user) who says things like "just make it work like my iphone!"

    For a change i won't dis Remy for what he's said, it's a nice example that's relevant to the problems we face. I'm not sure there's a maintainability headache, though, comment makes clear what it is and the QWERTY/DVORAK/etc keyboard layouts aren't fundamentally changing on a regular basis ... weird space-saving quirks on laptop keyboards are big problem, and then we go back to allowing custom mappings as the only sensible solution.

  • xtal256 (unregistered)

    It's funny, I read this article shortly after watching a Computerphile video on the Enigma machine. Feels kind of relevant.

  • xtal256 (unregistered) in reply to Steve_The_Cynic

    Teardown is like that too. A lot of comments about not being able to remap keys.

    In this particular case I'm ok with that as it's in early access and they say they are eventually going to add it.

    But still, if that's not something you bake in to your game (or game engine) to begin with then you're just setting yourself up for pain later on when you really should support it but that would require re-writing a lot of code (including mods).

  • (nodebb)

    I was tricked by my nerves into switching to Dvorak. I thought the pain I was experiencing was RSI, so I bit the bullet and switched. Shortly thereafter I discovered it was a pinched nerve (and exactly even pinched one such that pain in both wrists was equal) in my neck. But it was too late.

  • löchleindeluxe (unregistered)

    TBH, we should count ourselves lucky (or ignorant) for only considering keyboards that look vaguely the sane, give or take a numpad. Some of the chord glove things probably make both hjkl and wasd a proper pain in the posterior. And hey, it's a LOL (labour of love) project. Unlike the MacOS login screen, which is literally impossible to use over a remote connection. No on-screen keyboard, no visible-text field, so you have no way of debugging how many times the intermediate software layers go through "map charcode to position" forwards, backwards or sideways.

  • davewilliams (unregistered) in reply to bradwood

    For me, it was migraines. I typed two-fingered and looking at the keyboard lots of the time. When the migraines started, looking down caused me so much nausea that I couldn't do it, for months.

    This forced me into making a move to touch typing, at which point I thought, "In for a penny, in for a pound" and went the Dvorak route.

  • (nodebb) in reply to bradwood

    I am suffering from a inflammatory disease of the joints and sinews, so I am particularly sensitive. What helped me with the mouse-hand was to wear sports armbands while using keyboards. As for keyboards themselves, I found those flat-key style keyboards that I first saw on MacBooks to be most favorable, and curiously only the builtin keyboards, never external ones, entirely at odds with common knowledge.

    As for "ergonomic keyboards": I tried, but they gave me the worst results. Same for mousepads with wrist cushions; If the supporting material can move relatively to the wrist, the friction worsens the inflammation. Hence the use of (tight) wristbands instead.

  • Actually (unregistered) in reply to Bépo

    https://tkainrad.dev/posts/why-keyboard-shortcuts-dont-work-on-non-us-keyboard-layouts-and-how-to-fix-it/ is one of them ... but there isn't a great list anywhere.

  • If it works, it ain't stupid (unregistered) in reply to Moogle

    I'd love your take on https://en.wikipedia.org/wiki/Fast_inverse_square_root#Overview_of_the_code

    Like... the comments definitely validate whatever feelings the reader might glean from the code. But the comments also don't explain anything at all. And honestly, I can't really fault the programmer for not writing a wikipedia article of a comment.

  • Worf (unregistered)

    I used to have killer carpal tunnel, but as of late, I haven't had to use an ergo keyboard. I managed to convince work when my last ergo died to upgrade to a mechanical and my wrists have never felt better.

    I think it also helped that I stopped using mush-boards - for laptops, a ThinkPad famed keyboard is nice, and the Dell XPS13 keyboard I'm using actually has a really nice feel with plenty of snap.

  • jay (unregistered)

    "Can I compliment Naomi on the excellent comment? " Something that drives me nuts is when a programmer writes some obscure, complex block of code with no comments to explain what he's doing or why ... and then he has a line line "x=x+1" and he thoughtfully adds the comment "add one to x". Just in case a future programmer looking at this code forgot what a plus sign does.

  • osong (unregistered)
    Comment held for moderation.
  • Topper (unregistered)

    we all find ourselves in positions where we write bad code to accomplish our goals. Speak for yourself Remy.

    unicycling is the hobby that makes me cool. I assure you, you are not cool XD

  • Mark (unregistered) in reply to Bépo

    Maybe search for "Keyboard myths"?

    Check this out: https://keyshorts.com/blogs/blog/41838657-31-weird-fun-facts-about-computer-keyboards-you-didnt-know-about

  • Royal Stitches (unregistered)
    Comment held for moderation.
  • nasch (unregistered)

    It seems weird to not support Dvorak because you don't have a user to test it. Why not test it yourself? If the worst that could happen is Dvorak doesn't work right, well that's the current situation anyway.

  • Amey Kelkar (unregistered)
    Comment held for moderation.
  • HHI Sofa (unregistered)
    Comment held for moderation.
  • Some Ed (unregistered) in reply to jay

    Most people I know who do useless comments like that got in that habit due to being taught by their TAs to do that. Grading TAs are instructed to require comments, and Lecture TAs are instructed to teach people to do them. However, comments don't really make sense outside of the context of having a real problem to solve. In the abstract environment of a computer programming class, things have frequently been abstracted to the point where there's no "why" to explain without having it feel very meta.

    /* Today's lecture is talking about data types, so we need to have a variety of variables.

    • Integers, floating points, and characters are the first types we will be talking about. */ int a; float b; char c;

    All of that said, I feel like the comments in programming classes should feel meta, because comments should be meta. Much like Naomi's comments.

  • Some Ed (unregistered) in reply to Mr. TA

    It depends on who is implementing key repeats. Once one keyboard vendor decided that they needed to be the ones implementing key repeats, others were doomed to follow, as users of the first vendor who then tried the second keyboard's products in contexts that didn't implement key repeats would report the lack as a problem.

    So long as you're implementing it at a context layer that does events for keys up and keys down, you have to implement key repeats as either additional keypress events or as a new key repeat event. To do the latter approach, you need all the software that will be receiving those events to support it. The only real question therefore is do you also do key up events, which sounds like something someone autistic would suggest, but would very quickly result in bug reports due to anything that triggers on key up events, because most of the ones I've seen do something incompatible with what someone holding down their key would want.

Leave a comment on “A Key to Success”

Log In or post as a guest

Replying to comment #:

« Return to Article