One wheel to drive them all

As soon as I had FLARToolKit+Unity3D test done, another idea stuck in my head: why not use original ARToolKit and some WinAPI magic together to control every game on the desktop. While that is perfectly possible, my C skills are too rusty to do that in 1 day, but – lo and behold – it is, nevertheless, done:

You can see here me using the same paper steering wheel and webcam to play Quake2, Midtown Madness and Tanki Online. Well, Quake2 was overreacting, Midtown Madness was laggy as hell, and in Tanki Online I was stuck into wall every minute or so, but I consider this test successful (for a PoC :)

How the f…

Instead of messing with C, I used little-known Windows technology that turns your average HTML page into powerful desktop application. This allowed me to use my existing SWF and HTML script to read steering wheel input. The only remaining thing was to send virtual arrow keystrokes to game window.

My 1st attempt was to use Windows Script Host SendKeys method:

var wsh = new ActiveXObject ("WScript.Shell");
// presses and immediately releases UP key
wsh.SendKeys ("{UP}");

however, this failed miserably because each and every game out there needs the keys to be held down, and SendKeys cannot do that. So, after a bit of searching, I ended up installing and using AutoIt3 component, that required minimal changes to SendKeys-based code:

var ai3 = new ActiveXObject ("AutoItX3.Control");
// presses and holds UP key
ai3.Send ("{UP down}");

If you want to try this yourself, download AutoIt3 component and register it. Follow instructions in previous post to make steering wheel, download SWF and HTA to the same folder, and run HTA. Once the webcam is enabled, switch to game window, and you’re ready to play.


1 Response to “One wheel to drive them all”

  1. 1 Taras Kuba December 26, 2009 at 09:50

    Это очень круто. Надеюсь кто-нибудь еще из разработчиков подхватит эту идею.

Ask a Question

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Old stuff

December 2009
« Nov   Jan »

Oh, btw…


%d bloggers like this: