How exactly do game controllers work?


#1

when developing a game. How are exteral devices like a joystick or game controller implemented into a game engine? Is there anyway i can hook up a joy stick or pc controller into Maya?
Is there any documentation out there on how external devices speak with computers?

Thanks for any input!


#2

It’s a work by script programing…


#3

This is not an easy question, as you did not specify which platform you’re talking about. As far as computers go, everything is handled by DirectInput, which is part of DirectX. The hardware gets plugged in, is recognized by the driver, and sends data to the computer which is read by the driver and sent over to DirectInput, which allows the game to read input in a standardized way. From there, the engine, will read this input and act upon it as defined by the program.

You can’t just plug in a joystick and have it work in maya, no. Maya would need to support joysticks first, which I do not believe it does.


#4

Yes, I understand that Maya does not for example take information from a joystick. I am looking for information on how to make this possible. I know that Maya has a device editor, what I would like to know is, what needs to be done to build a driver for Maya for external devices?

Thanks.


#5

Maybe MSDN has something on this rather then having to resort to DirectX. I would think to make a plug-in for maya to take in commands from a joystick or controller, you would need the Maya sdk and figure out how to use a HID (human interface devices) with it. You would probably do the same for video games.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/altinputdevices.asp


#6

thanks for the link Ace, I’ll look into it are report what I find. :slight_smile:


#7

A script won’t be enough. The only way I can imagine this working is a C/C++ DLL. DirectInput would make things easy because, well that’s its job. But you can do it without DirectInput too.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_multimedia_joystick_functions.asp

Those are joystick functions for Win32, no DirectX needed at all. When you make the plug-in DLL, you’ll also need to link against Winmm.lib and perhaps other Win32 libs as well.


#8

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.