# Twin stick shooting with keyboard

In a top down shooting game, what alternatives are there for input if I want the direction of movement to be independent from the direction I'm shooting at? I'd like to avoid shooting with the mouse as it's much too precise, but alternatives that make it harder to aim could also work.

• Arrows for movement and WASD for shooting. The Binding of Isaac does this and it has two problems. It only allows for shooting in four directions, where I'd prefer at least eight; and most keyboards start ignoring some key presses if you press more than 2 keys at one, making it impossible to move in a diagonal while shooting.

• Arrows or WASD for movement, shooting direction becomes fixed in the direction you are facing when you start shooting. I don't remember where I saw this. This allows for shooting on any direction, but you have to stay still for a moment to change shooting direction, and it just doesn't feel very dynamic.

• This doesn't seem to be asking a concrete answerable question, as specified in the FAQ; it seems like you just want to start a discussion, which would be more appropriate in chat, or on a forum. Dec 28, 2012 at 18:01
• shrug seems like a pretty concrete question to me. I would say this falls under "constructive subjective question." So answers are subjective, but you can give specific reasons for your answers (ie. it's not just total opinion). gamedev.stackexchange.com/faq#what-about-subjective-questions Dec 28, 2012 at 20:26
• You can make shooting with the mouse less precise by adding some kind of rotational velocity cap on the player's avatar. Dec 28, 2012 at 21:02
• As long as you don't pit players from different devices against each other in multiplayer, it's best to use what is standard for the device (e.g. mouse and keyboard for PC) as default and provide optional configuration for other input devices (e.g. trackballs, joysticks, gamepads, datagloves, e.t.c.). Mar 18, 2013 at 9:56
• "Arrows for movement and WASD for shooting. The Binding of Isaac does this..." Not true, you have it backwards. It matters as usually left hand is move and right hand is shoot by default. (Unless things were different 8 years ago.) gaming.stackexchange.com/questions/34356/… Nov 30, 2021 at 1:44

If, in your question, "twin-stick" is a misnomer and you just mean top-down shooter, that's different... My answer is going to assume you do mean "twin-stick."

<sidenote>In the Binding of Isaac, only shooting in 4 directions was a specific design decision. (I can't find a source for that, but I recall Edmund saying it was intentional.) It's worth noting the game does let you curve shots by shooting while you're moving.</sidenote>

If you're targeting a controller as the preferred method and supporting keyboard input, you're going to need to emulate that behavior as much as possible (or write two completely different control schemes into your game and design for both ways of playing).

Two controller sticks is rather precise already. I'm not sure what you don't like about mouse to shoot but I'd reconsider avoiding it. I'd argue that it's less precise than two joysticks since you have to move the mouse to different sides of your character, as opposed to just switching the direction of the mouse. Are you limiting the angles you can shoot in if you're using a controller? If you're not, that's potentially going to suck for keyboard players.

If you must depart from it, consider:

• Allow movement with WASD and shooting in 8 directions with IJKL. Worst (realistic) case is 4 simultaneous letter keys. I don't think that should be a problem for most keyboards.
• It gives you 8 discrete directions to move and shoot separately. It doesn't give you the finer control but is very usable if the game design accounts for it.
• Back in the day, I played the crap out of Robotron on the Apple][ which used a similar scheme (ESDX and IJKM). It was quite playable.
• Allow movement with WASD and lock shooting in the direction that the player was facing when he started shooting. Like Hyper Princess Pitch and Voxatron do.
• If you're moving down and hold shoot, you start shooting down and stay facing/shooting that way regardless of where you move until you let go of shoot.
• Like you mentioned, it does have the disadvantage of having to move toward what you want to shoot for long enough to face that direction and start shooting. It makes running away from a large mob tricker.
• I don't like this scheme myself but in the games I linked above, it does work.
• Allow movement with the mouse and use WASD (or similar) to shoot, like one of the control schemes in Echoes.
• It's a little weird, but it's a possibility. Making the player follow the mouse gives you fine control over your movement while keyboard input still limits your shots to less precise angles.
• Viable if your game is reliant on fine grained movement and less so on shooting.
• Mouse only. (Yeah, we're departing from twin-stick shooter-dom here.) Something like Click-to-move, Shift-click-to-shoot
• It works in Diablo and Torchlight.
• The already suggested forward/backward, strafe, rotate, shoot scheme. But, I'd suggest revising it to not have an extra button to toggle strafe v rotate; add two extra buttons so you can strafe and rotate at the same time. The top-down levels of Contra 3 on SNES did it that way and it was pretty effective.
• Suggested scheme
• WS to move forward/backward, AD to strafe, QE to rotate
• This would also let you translate your controller input the same way (LT and RT to rotate), avoiding significant disparity between your input methods.

Really, it all boils down to how responsive and orthogonal you want your two actions (moving and shooting) to be.

• This is very helpful. I will implement some of these and see what feels better. Dec 28, 2012 at 23:17
• +1 for mentioning Contra. 'Nother +1 for a relatively unbiased listing of different solutions. Mar 18, 2013 at 9:57

Essentially you have yourself the challenge of overcoming deep rooted control schemes. Attempting to apply the style of device A to device B doesn't work well. If it did, there wouldn't be much of a reason for device A.

I think any choice of keys will be kind of strange. There's a reason twin stick shooting isn't very natural on the keyboard. It doesn't have twin sticks.

Anyway you slice it, it's going to be difficult to limit to two keys maximum and keep a natural feel. Since running diagonally is taking two, you'd be unable to shoot. The two key limit does depend on the hardware, and that's something you'll need to warn your users about.

I'd have the option available for using just the keyboard, but support mouse aiming and gaming controllers. The mouse aiming would be discrete as well, only allowing the eight directions the keyboard or gaming controller does.

If you're worried about it feeling natural, require a gaming controller. Otherwise just pick your own controls and hope the user is able to adapt. Other options could be:

• WASD for movement. Numpad for shooting.
• WASD for movement. UIOJLM> for shooting.
• I plan on making a controller the preferred input method, but since I'm building for PC and not all players have or like controllers, I'd like to have a decent alternative scheme. Dec 28, 2012 at 16:51
• Numpad for shooting could work, although that does require a numpad and I think that's a more serious restriction than limiting the simultaneous keys (eg. most laptops don't have a numpad). Dec 28, 2012 at 19:38

I would do WASD for movement and mouse for shooting, with the aim restricted to 8 directions. So in other words instead of pointing directly at the mouse cursor you point in whichever of the 8 directions is closest to the mouse cursor. I don't know off the top of my head the code to do this but I'm pretty sure it'll be something simple involving atan2()

I remember a game, back in the old days, where left and right would rotate you, until you held down shift, then left and right would strafe instead. Forward and back would move you in the direction your character was facing.

Using this approach you could get shooting in a full 360 degree circle, yet still have a 'fine adjustment' mode, strafing to get the perfect shot off.

It also allows for greater control of a character, able to shoot in any direction you want and still able move at the same time.

The game as I remember was very fast paced and sometimes it would be better to strafe out the way of a bullet than turn 90 degrees and walk forward. It would also very easy to get two players on the keyboard for this control mechanism.

Otherwise you could always add some random deviation to the angle of the shots if you were using a mouse. Simulating a bullet spray, rather than an accurate 'click to kill'.

• The first on is certainly interesting and I will test it. I tried bullet spread and I'm not happy with the result. Dec 28, 2012 at 16:49
• This control scheme could be good for a game designed for it but this would be terrible as an alternative control scheme for a twin-stick shooter because the pacing/balance would be all off. Twin-stick shooters rely on the player being able to move and aim in any direction instantly, whereas here you have to wait for the player to turn. Anyway this control scheme doesn't really address the OP's needs, since he specifically doesn't want to shoot in a full 360 degree circle. Dec 28, 2012 at 19:36