[ANN] Amelio Game Input Library (G.I.L) v0.9

calumr
Unregistered
 
Post: #1
(I posted this to the mac-games-dev list too, but I would like some more opinions on my work so far)

I am writing a Cocoa-based input library instead, as my 4th year Software Engineering project. This release is version 0.9, and is available under the BSD license (v1.0 will be too).

Until v1.0 I would like to get some opinions on what I have done so far. I do not intend for anyone to use this framework yet (do so at your own risk etc...).

It is similar to Input Sprocket, in that there are virtual elements etc., but it is object-oriented (and better Smile ). I won't go into too much detail as there is a readme in the disk image, but I will mention some of the important features:

- Configuration window (just like Input Sprocket)
- Hot-plugging
- Bundles containing device descriptions that can be downloaded from the internet (eg. localised button names and much more).
- Developer tools (for both application & hardware developers)

Currently there are only 4 (temporary) device descriptions available (it's all I have!):

1. Gravis Gamepad Pro
2. Apple USB puck mouse
3. PB G4 keyboard (no image for it yet)
4. PB G4 trackpad (no image either)

The archive I am releasing contains the code for the framework, a sample application, a tool for creating device descriptions, a tool for generating plist files similar in functionality to the old ISpNeed structures, and a more informative readme:

http://doomlegacy.idevgames.com/Amelio/Amelio.dmg

Documentation (generated by HeaderDoc) is also available:

http://doomlegacy.idevgames.com/Amelio/d...erTOC.html


Calum Robinson
Quote this message in a reply
Member
Posts: 304
Joined: 2002.04
Post: #2
Unfortunately I havent been able to run this yet since it needs the december dev tools and 10.2.3 (I ordered the dev tools which was supposed to have been sent out already - but it now looks like it will be delayed some weeks! feh)

But let me thank Calum for stepping up to the plate and starting a project that is needed and can benefit us all. Apple's HID manager really is insufficient. It is hard to program with (IMO), it doesnt have a standard gui, and worst of all device manufacturers dont set up their usb configuaration information correctly.

Manufacturers can get away with not setting up their configs properly - because they can fix it by writing device drivers that hook everything up correctly - which they write for Direct-Input on Windows but then dont bother providing drivers for Mac.

This is a big problem for the shareware developer. You have to work harder just to get a good input configuration (compared to InputSprockets) - and it still may not work for everyone's devices. I know my gamepad never works quite right with OS X.

What Calum is working on is a library that would let anyone write a 'driver'. That is a file that can translate from some device to the human understandable types of controls it offers.

So you would get your new Brand-X joystick and finding that it doesnt set-up properly - you go online and download a setup file that some other gamer has put together for that joystick. Or if nobody had written it yet - write one yourself and (hopefully) make it available to the next guy.

There is a lot of talk in mac-game-dev mailing list about this. But few people are actually writing code to solve it.

Of course Id rather Apple write this and make it the one 'standard' - but barring that I hope G.I.L. Amelio (great f**** library name right?) takes off.

The other project that is similiar is:
<http://www.zsculpt.com/website/appsutils...izard.html>

Now if only my dev. tools would hurry up and get here.

cheers,
Codemattic
Quote this message in a reply
calumr
Unregistered
 
Post: #3
Quote:Originally posted by codemattic
Unfortunately I havent been able to run this yet since it needs the december dev tools and 10.2.3 (I ordered the dev tools which was supposed to have been sent out already - but it now looks like it will be delayed some weeks! feh)


Yes - I only realised this after I released it. I will add something to the readme.

Quote:Originally posted by codemattic

So you would get your new Brand-X joystick and finding that it doesnt set-up properly - you go online and download a setup file that some other gamer has put together for that joystick. Or if nobody had written it yet - write one yourself and (hopefully) make it available to the next guy.


Actually, Amelio can automatically download the drivers for you!Grin

Quote:Originally posted by codemattic

The other project that is similiar is:
<http://www.zsculpt.com/website/appsutils...izard.html>


There was a apost by one of the developers of this library recently. Apparently, they are no longer pursuing it as there is no money in it for them. Many developers want an open-source library, which I hope Amelio can provide.
Quote this message in a reply
Moderator
Posts: 365
Joined: 2002.04
Post: #4
I'm very interested in this. I've only had a brief look at the test applications so far, but they seem promising to me. Just one question, though - will it be useable from Carbon (and C/C++) as well as Cocoa?

Neil Carter
Nether - Mac games and comic art
Quote this message in a reply
Member
Posts: 304
Joined: 2002.04
Post: #5
Calum-

Do you think you can post the built apps so I can see how they work - until I get December Dev Tools and can compile them for myself?

thanks,
Codemattic
Quote this message in a reply
calumr
Unregistered
 
Post: #6
Quote:Originally posted by NCarter
I'm very interested in this. I've only had a brief look at the test applications so far, but they seem promising to me. Just one question, though - will it be useable from Carbon (and C/C++) as well as Cocoa?


I plan to make the library available to C code in thenext version, using methods similar to CoreFoundation.

Here are the compiled apps:

http://doomlegacy.idevgames.com/built.tgz

[1.2MB]
Quote this message in a reply
gregorypierce
Unregistered
 
Post: #7
I'm interested in integrating this with an open source library I've been porting from Windows. What kinda license you have attached to this baby?
Quote this message in a reply
calumr
Unregistered
 
Post: #8
Quote:Originally posted by gregorypierce
I'm interested in integrating this with an open source library I've been porting from Windows. What kinda license you have attached to this baby?


BSD - I was going to go with LGPL but I'm really not worried about anyone using my source & not publishing their changes.
Quote this message in a reply
Member
Posts: 304
Joined: 2002.04
Post: #9
Calum-

Obviously any Amelio improvements Im able to make on my own I will send to you. Here are some thoughts on Amelio:

Amelio is very easy to add to a Cocoa project! Far far easier than Input Sprockets ever was.

Amelio axis seems to be in a range of -1.0 to 1.0 (with center being 0.0) where in Apple's 'HID Explorer' the range is 0 to 255 (with center being 127). When I move the joystick around in 'Amelio Test' which is set up to control the two sliders - the sliders only move across 1/2 of their range. And when I check 'reversed' then they move over the other half (in reverse direction as before - but still not what we want)

Amelio has a 'sensitivity' slider which is a good idea - but doesnt work right because of the issue above.

Using 'HID Explorer', the joystick I have doesnt center at 127, and its range is something like 0-200 (it centers at 90) which is why its useful to be able to set a range for each axis type control. Again check out Apple's 'HID Explorer'

It would be nice instead of "Button #1", "Button #2" etc it could have names like "Left Trigger Button"

It would also be nice if there was some feedback in the config dialog - that is if you chose "Button #1" and you in fact held that button down a control would light up so you could confirm that you had the right control (for an axis control you would have a slider-type control - which could also be used to set the range)

When the config dialog opens - it starts out small and resizes. Why? And why not make the config dialog resizeable?

Where do the device specifications go?

I cannot run the 'AmelioDeviceSpecificationBuilder'. When I build it and debug it in pb I get this:

#0 0x90844988 in _NSRaiseError
#1 0x90844810 in +[NSException raise:format:]
#2 0x907e36d8 in -[NSCFArray getObjects:range:]
#3 0x907e2dec in -[NSArray makeObjectsPerformSelector:withObject:]
#4 0x00007720 in -[EditDeviceConfigView reloadDeviceData] at EditDeviceConfigView.m:142
#5 0x00007654 in -[EditDeviceConfigView setDevice:] at EditDeviceConfigView.m:132
#6 0x00003e58 in -[DeviceSpecController reloadElementSettings] at DeviceSpecController.m:177
#7 0x00003034 in -[DeviceSpecController selectedDeviceDidChange:] at DeviceSpecController.m:58
#8 0x00006790 in -[DeviceSpecController awakeFromNib] at DeviceSpecController.m:528
#9 0x9081d348 in -[NSSet makeObjectsPerformSelector:]
#10 0x930acf98 in -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:]
#11 0x931b2cf0 in -[NSWindowController setWindowFrameAutosaveName:]
#12 0x930e9de0 in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:]
#13 0x93149098 in +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:]
#14 0x93148e58 in +[NSBundle(NSNibLoading) loadNibNamed:owner:]
#15 0x9315f65c in NSApplicationMain
#16 0x00006cf4 in main at main.m:5
#17 0x000029d4 in _start at crt.c:267
#18 0x00002854 in start

thanks,
Codemattic
Quote this message in a reply
Member
Posts: 304
Joined: 2002.04
Post: #10
Calum -

Another interesting thing. I noticed from your post that you have a Gravis Gamepad Pro. I have a Thrustmaster controller (dont know the product name). Its HID rom device name is "DA Leader" - is that the same as the Gravis? Can different devices use the same rom and come up as the same device?

The problem with the Thrustmaster 2-joystick controller that I have is the right joystick - its axis lists as 'Slider' and 'Z-Rotation' I cannot get this right joystick to work in Amelio (or any OS-X game). When I move the joystick Amelio sends many "Unknown element kind for calibration" message to the console.

I hope the Thrustmaster (it is old) is just one of the few badly HID-configured devices on the market.

cheers,
Codemattic
Quote this message in a reply
Member
Posts: 304
Joined: 2002.04
Post: #11
I just ran Amelio and I got a new set-up for the Apple puck mouse!! I guess it linked to you and updated itself. Very very cool. Although Id rather there was a button on the config dialog that started the update instead of it doing it automatically - you dont want your server to get hit every time anyone starts up a game that uses Amelio.

Cool!
Quote this message in a reply
calumr
Unregistered
 
Post: #12
Quote:Originally posted by codemattic
Obviously any Amelio improvements Im able to make on my own I will send to you. Here are some thoughts on Amelio:


Thanks!

Quote:
Amelio is very easy to add to a Cocoa project! Far far easier than Input Sprockets ever was.


Good - this is one of the things about Cocoa that I wanted to have in Amelio.

Quote:
Amelio axis seems to be in a range of -1.0 to 1.0 (with center being 0.0) where in Apple's 'HID Explorer' the range is 0 to 255 (with center being 127). When I move the joystick around in 'Amelio Test' which is set up to control the two sliders - the sliders only move across 1/2 of their range. And when I check 'reversed' then they move over the other half (in reverse direction as before - but still not what we want)

Amelio has a 'sensitivity' slider which is a good idea - but doesnt work right because of the issue above.

Using 'HID Explorer', the joystick I have doesnt center at 127, and its range is something like 0-200 (it centers at 90) which is why its useful to be able to set a range for each axis type control. Again check out Apple's 'HID Explorer'


Actually, Amelio tries to scale the values to between -1.0 and 1.0 using the minimum and maximum values reported by the HID device. Sometimes these are incorrect (manufacturers fault AFAIK) and so you need to run the device description builder tool to calibrate the device properly.

Perhaps what I could add is a 'Calibrate' button in the dialog, what do you think? It may help users, e.g. when their joysticks centre is slightly different to that of others.

Quote:
It would be nice instead of "Button #1", "Button #2" etc it could have names like "Left Trigger Button"


This is something that you can do with the device description builder tool, and even localise them (eg. for French or Japanese). The "Button #1" etc. titles are what the device reports by default.

Quote:
It would also be nice if there was some feedback in the config dialog - that is if you chose "Button #1" and you in fact held that button down a control would light up so you could confirm that you had the right control (for an axis control you would have a slider-type control - which could also be used to set the range)


This is something I am considering, after I create the C interface & a few other bits'n'pieces.

Quote:
When the config dialog opens - it starts out small and resizes. Why? And why not make the config dialog resizeable?


The dialog is not resizable because there isn't anything more that the user could see by making it bigger, and it's small enough to fit on a 640x480 screen anyway (so it doesn't need to be smaller).

Quote:
Where do the device specifications go?


~/Library/Application Support/Amelio/

Quote:
I cannot run the 'AmelioDeviceSpecificationBuilder'. When I build it and debug it in pb I get this:

#0 0x90844988 in _NSRaiseError
#1 0x90844810 in +[NSException raise:format:]
#2 0x907e36d8 in -[NSCFArray getObjects:range:]
#3 0x907e2dec in -[NSArray makeObjectsPerformSelector:withObject:]
#4 0x00007720 in -[EditDeviceConfigView reloadDeviceData] at EditDeviceConfigView.m:142
#5 0x00007654 in -[EditDeviceConfigView setDevice:] at EditDeviceConfigView.m:132
#6 0x00003e58 in -[DeviceSpecController reloadElementSettings] at DeviceSpecController.m:177
#7 0x00003034 in -[DeviceSpecController selectedDeviceDidChange:] at DeviceSpecController.m:58
#8 0x00006790 in -[DeviceSpecController awakeFromNib] at DeviceSpecController.m:528
#9 0x9081d348 in -[NSSet makeObjectsPerformSelector:]
#10 0x930acf98 in -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:]
#11 0x931b2cf0 in -[NSWindowController setWindowFrameAutosaveName:]
#12 0x930e9de0 in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:]
#13 0x93149098 in +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:]
#14 0x93148e58 in +[NSBundle(NSNibLoading) loadNibNamed:owner:]
#15 0x9315f65c in NSApplicationMain
#16 0x00006cf4 in main at main.m:5
#17 0x000029d4 in _start at crt.c:267
#18 0x00002854 in start


I'm guessing that the problem is line 143 in EditDeviceConfigView.m. Firstly, try trashing the preferences for AmelioDeviceSpecificationBuilder and and device descriptions you may have made, and see if the problem happens again. If it does, try putting an NSLog([self subviews]); before line 143 (it shouldn't be NULL, but it'd be good to check).

BTW I really appreciate this feedback. I haven't had much external input (no pun intended), so keep it up! Smile
Quote this message in a reply
calumr
Unregistered
 
Post: #13
Quote:Originally posted by codemattic
Calum -

Another interesting thing. I noticed from your post that you have a Gravis Gamepad Pro. I have a Thrustmaster controller (dont know the product name). Its HID rom device name is "DA Leader" - is that the same as the Gravis? Can different devices use the same rom and come up as the same device?


You could, but they would have to be identical. Where did you get the ROM info from?

Quote:
The problem with the Thrustmaster 2-joystick controller that I have is the right joystick - its axis lists as 'Slider' and 'Z-Rotation' I cannot get this right joystick to work in Amelio (or any OS-X game). When I move the joystick Amelio sends many "Unknown element kind for calibration" message to the console.


I just discovered this problem with the Gravis Eliminator Pro I bought the other day. I know how to fix it, but it isn't an insignificant amount of work.

Quote:
I hope the Thrustmaster (it is old) is just one of the few badly HID-configured devices on the market.


From what I've heard, there aren't any well configured HID devices available. They all have little nuances and bugs in the data they report (eg. their names, min & max values etc.).
Quote this message in a reply
calumr
Unregistered
 
Post: #14
Quote:Originally posted by codemattic
I just ran Amelio and I got a new set-up for the Apple puck mouse!! I guess it linked to you and updated itself. Very very cool. Although Id rather there was a button on the config dialog that started the update instead of it doing it automatically - you dont want your server to get hit every time anyone starts up a game that uses Amelio.

Cool!


Actually, look in ~/Library/Application Support/Amelio - the device description has been downloaded as a compressed archive and saved here - so Amelio will not have to download it from the server again.

Grin Grin Grin
Quote this message in a reply
Member
Posts: 304
Joined: 2002.04
Post: #15
Quote:Originally posted by calumr

I'm guessing that the problem is line 143 in EditDeviceConfigView.m. Firstly, try trashing the preferences for AmelioDeviceSpecificationBuilder and and device descriptions you may have made, and see if the problem happens again. If it does, try putting an NSLog([self subviews]); before line 143 (it shouldn't be NULL, but it'd be good to check).


looking in home/library/preferences/ I see a "AmelioConfigurationBuilder.plist" file - but nothing like "AmelioDeviceSpecificationBuilder.plist". So maybe AmelioDeviceSpecificationBuilder isnt even getting a chance to save its prefs?

when I change EditDeviceConfigView.m thusly:

Code:
- (void)reloadDeviceData
{
    NSArray *elements = [_device elements];
    int i;
    
    [self setImage:[_device image]];

        NSLog(@"start test");
        NSLog(@"%@",[self subviews]);
    
    [[self subviews] makeObjectsPerformSelector:@selector(removeFromSuperviewWithoutNeedingDisplay)];

        NSLog(@"end test");

        for (i=0; i<[elements count]; i++)
    {

I get:

2003-01-18 15:01:52.160 AmelioDeviceSpecificationBuilder[22968] start test
2003-01-18 15:01:52.195 AmelioDeviceSpecificationBuilder[22968] <CFArray 0x1c68f30 [0xa01303fc]>{type = immutable, count = 0, values = (
)}
2003-01-18 15:01:52.195 AmelioDeviceSpecificationBuilder[22968] end test
2003-01-18 15:01:52.267 AmelioDeviceSpecificationBuilder[22968] start test
2003-01-18 15:01:52.364 AmelioDeviceSpecificationBuilder[22968] <CFArray 0x1c83840 [0xa01303fc]>{type = mutable-small, count = 264, values = (
0 : <EditElementConfigView: 0x2e66b0>
1 : <EditElementConfigView: 0x1c838d0>
2 : <EditElementConfigView: 0x1c83a50>
3 : <EditElementConfigView: 0x1c83b40>

<-- long list of EditElementConfigViews snipped -->

261 : <EditElementConfigView: 0x1c7a990>
262 : <EditElementConfigView: 0x1c7aa80>
263 : <EditElementConfigView: 0x1c7ab70>
)}
2003-01-18 15:01:52.973 AmelioDeviceSpecificationBuilder[22968] An uncaught exception was raised
2003-01-18 15:01:52.973 AmelioDeviceSpecificationBuilder[22968] *** -[NSCFArray getObjects:range:]: index (255) beyond bounds (136)
2003-01-18 15:01:53.075 AmelioDeviceSpecificationBuilder[22968] *** Uncaught exception: <NSRangeException> *** -[NSCFArray getObjects:range:]: index (255) beyond bounds (136)

AmelioDeviceSpecificationBuilder has exited due to signal 5 (SIGTRAP).


cheers,
Codemattic
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Game input in Cocoa aegidian 8 6,025 Nov 4, 2003 03:47 PM
Last Post: aegidian