[In this reprinted #altdevblogaday-opinion piece, Fishing Cactus developer Fabrice Lete offers first-person shooter developers a simple tip for making it easier for Belgian and French gamers to immediately play their titles.]
PC gamers in France and Belgium are used to the following routine:
The differences are not that big, only three letters are located differently (A, Z, M), but unfortunately two of these are right in the middle of the most standard keyboard control scheme of modern PC games.
Should you care? Honestly, probably not. As long as your game allows players to redefine their keys, us frog and snail eaters are usually* only a few tweaks away of enjoying the game. But that being said, correctly handling this problem in the default mapping is not that complicated either.
What the keyboard sends to the PC are key codes, which are "character agnostic". They directly represent the physical positions of the keys. The standard way of assigning key codes originated with the IBM PC XT: the Scan Code Set 1. Further enhancements have been named Scan Code Set 2 and Scan Code Set 3.
Nowadays, most keyboards use Scan Code Set 2 to send the data to the computer, but the codes are translated back to Scan Code Set 1 when received (historically because of backward compatibility concerns). So, everything dealing with scan codes on Windows can assume a Scan Code Set 1 numbering scheme.
Based on the scan code and the keyboard layout, Windows translates the key presses into Virtual Key codes. And this is where the physical positions are lost. You cannot assume that the key in the top left corner is labelled A, you have to go back to the scan codes.
The Scan Code Set 1 codes for the WASD keys are: 17, 30, 31, 32 (in that order). Notice how the values for ASD are consecutive. And to get the Virtual Key Codes most API require, you only have to call these functions:
- Start playing a brand new game.
- Strafe right and move backwards.
- Curse.
- Go to the options screen.
- Resume playing.

Only four lines of code to make millions of people happy, isn't that great? Don't forget to check this article from Keith Judge about input handling for PC games here: http://altdevblogaday.com/2011/04/25/input-for-modern-pc-games/ And here is some more complementary information:
forward = MapVirtualKey( 0x11, MAPVK_VSC_TO_VK ); strafe_left = MapVirtualKey( 0x1E, MAPVK_VSC_TO_VK ); backward = MapVirtualKey( 0x1F, MAPVK_VSC_TO_VK ); strafe_right = MapVirtualKey( 0x20, MAPVK_VSC_TO_VK );
- http://msdn.microsoft.com/en-us/library/ms646306(v=vs.85).aspx
- http://www.georgehernandez.com/h/xComputers/CharacterSets/ScanCodes.asp
- http://www.win.tue.nl/~aeb/linux/kbd/scancodes-10.html
- http://www.computer-engineering.org/ps2keyboard/
- http://msdn.microsoft.com/en-us/goglobal/bb964651.aspx
- http://seit.unsw.adfa.edu.au/staff/sites/hrp/personal/Sanskrit-External/Unicode-KbdsonWindows.pdf
- http://babbage.cs.qc.edu/courses/cs345/Manuals/ms_scancode.pdf