You are not logged in.

#1 2012-12-25 20:21:45

ezzetabi
Member
Registered: 2006-08-27
Posts: 947

Emulating a joystick with keyboard?

It is possible to emulate a joystick using the keyboard?

Offline

#2 2012-12-25 21:07:27

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,504
Website

Re: Emulating a joystick with keyboard?

Sure.  But to get a more complete answer, it would help to have a more complete question.

Is this in X for games/programs that run as X clients?  If so, do you have an example joystick you and test with xev to see what events it generates?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2012-12-26 08:20:17

ezzetabi
Member
Registered: 2006-08-27
Posts: 947

Re: Emulating a joystick with keyboard?

I bought POD (an old car game) from GOG and it allows two-player playing in split screen. Unfortunately it only allows to use different controls for different players. Now I have n-key rollover keyboard and I would like to play with it.
So I was wondering if I can emulate a simple arcade-like on-off 8 directions, few buttons joystick with keyboard.

About your second question, I do have a joystick. But it manages the whole range of the directions. So I am not sure it helps as it would be different.

Offline

#4 2012-12-26 12:37:45

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,504
Website

Re: Emulating a joystick with keyboard?

I still don't know if this would run in X or not - I'm not familiar with the game.

But looking into this, I see many options for using a joystick is to have the joystick generate keyboard events that are then interpreted by the game.  Then your question would be irrelevant as you don't need to emulate a joystick with the keyboard as the joystick itself is emulating a keyboard.

I have a tool that simulates mouse events from the keyboard.  If you can get me any information on what signals or events the game needs from the joystick, I could consider adding that as well.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2012-12-26 12:59:16

ezzetabi
Member
Registered: 2006-08-27
Posts: 947

Re: Emulating a joystick with keyboard?

Using the joystick as keyboard is fairly well supported. Even in the AUR there are at least two programs to do that: joy2key and qjoypad.

But I would need the opposite, a joystick-like device (/dev/input/js0) that sends joystick-like signals when pressing keyboard keys.
This program seems related. I compiled it (just change python to python2 in the build.sh file), but I cannot understand how it works. For starters the example.py file imports a python module module that is not there (vjoy)...

Last edited by ezzetabi (2012-12-26 13:00:14)

Offline

#6 2012-12-26 13:15:39

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,504
Website

Re: Emulating a joystick with keyboard?

I understand what you are looking for, but given that many people seem to convert joystick events into keyboard events so they can be used, it seems that many games that would use a joystick actually do so through receiving keyboard events.

Your game, as I must infer the answer to my earlier question, does not use X11 event, rather it interacts with the device directly.

This would still be doable if we knew what "joystick-like signals" were.  But it sounds like tracking down the vjoy python module may be the best way to go.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#7 2012-12-26 14:48:37

ezzetabi
Member
Registered: 2006-08-27
Posts: 947

Re: Emulating a joystick with keyboard?

Sorry for missing the point. The game needs wine and X to work. What is required to make POD believe I am using a joystick instead of the keyboard depends on wine.

Offline

#8 2021-04-28 10:22:32

dreieck
Member
Registered: 2012-10-08
Posts: 76

Re: Emulating a joystick with keyboard?

ezzetabi wrote:

It is possible to emulate a joystick using the keyboard?

Just for anyone who finds this old thread looking for an answer:

wejoy (there is an AUR package of it) seems to allow this.

If this solves this question, I suggest even to prepend to the title of this thread a "[SOLVED]", for the occassional person coming by this question via search engine.

Offline

#9 2021-04-28 16:27:37

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,337

Re: Emulating a joystick with keyboard?

Thanks for sharing, but as it's unlikely that ezzetabi still searches for a solution here, I'll close this thread.

Closing.

Offline

Board footer

Powered by FluxBB