Page 1 of 1

Joystick Support

Posted: Fri Oct 31, 2008 10:56 pm
by diki
Stop me if I'm being redundant, but is Joystick/Gamepad/HID Support already a consideration? It would be rather nice to have, and complete the trio of 'most popular input methods' out there :)

Posted: Sat Nov 01, 2008 7:17 pm
by Kjell
Hi diki,

I actually had a go at Joystick support some time ago and managed to get it to work. Though as there was no way to save ( configuration ) files back then, it would have been a crutch to use. But as file saving got implemented last week, I'll have another look at it.

K

Posted: Sun Nov 02, 2008 1:36 pm
by VilleK
Kjell, I wonder if you perhaps set you ambitions too high :)

Does every game with gamepad support really need a calibrate/configuration feature with save-support? Can't we have some sort of "simpler" gamepad support first?

Posted: Sun Nov 02, 2008 1:46 pm
by Kjell
Hej Ville,

Well, you're right. If you're just using one analog stick ( 2 axes ) and some of the first buttons you're pretty safe across the board. However, the second analog stick as well as shoulder triggers are different joystick to joystick, not to mention d-pads .. which can be POV, a set of buttons or 2 axes. Shoulder triggers can even have different ranges, sometimes -1..1, others 0..1, or even -1..0 for one and 0..1 for the other. This is just one of those things you have to deal with when it comes to PC / Mac / Linux gaming :wink:

Here are the most important input details of a couple of Joystick's I tried out ( 360 controller using USB, others using MagicBox interfaces ). You can see that differ quite a bit .. also, don't forget that axes that aren't used by the hardware return a value of -1.

K

Posted: Mon Nov 03, 2008 7:22 am
by VilleK
I see the complexities here... You've done good research Kjell :) . That Sega-controller brings back memories.
If you're just using one analog stick ( 2 axes ) and some of the first buttons you're pretty safe across the board
I think this would cover the needs for many games and would be sufficient as a first attempt at joystick-support in ZGE. What do you other guys think?

Posted: Mon Nov 03, 2008 1:02 pm
by Kjell
Hej Ville,

Don't underestimate the importance of button layout. For example, if one would be creating a game with a jump and shoot button for the 360 pad, I can imagine going for jump under 1 and shoot under 3. This combination will be very annoying on the Playstation and Saturn controllers.

Anyway, it's up to the creator to decide whether or not to let players configure their button layout. It was just the reason for not pushing through on the Joystick components, since I certainly will :)

K

Posted: Mon Nov 03, 2008 1:22 pm
by diki
VilleK wrote:
If you're just using one analog stick ( 2 axes ) and some of the first buttons you're pretty safe across the board
I think this would cover the needs for many games and would be sufficient as a first attempt at joystick-support in ZGE. What do you other guys think?
hm, i guess that if you split the component into e.g. JoystickAxis and JoystickButton (each with their own field to specify which joystick to use), it would be modular enough to accomodate for almost everything; you could read a simple file & apply the settings fit for the user and his specific hardware.
(that is, of course, from someone who has no idea about implementing such things ;)

Posted: Mon Nov 03, 2008 5:44 pm
by jph_wacheski
yeah that sounds good diki,. there are like 6 axii (x,y,z,r,u,v or some such,.) 10 or so buttons and the POV,. then you could set up for just about anything,. It would of course be nice to set it all up from an options menu in game, but if it is keep really simple some games could be done without too much fuss.
I am left handed so even on a keyboard for example I try to support a left and right handed layout WASD and ARROWS and often mirrored action keys,. and if you only have a couple buttons you can just remap them like 1,2 then 4,3, then 5,6, etc. so ppl can hoplfully find buttons that they can adjust to.

Posted: Mon Nov 03, 2008 11:19 pm
by Kjell
Hey jph,

Most modern platforms ( DirectX / Allegro ) support 16 joysticks with up to 8 axis, 32 buttons and 4 pov hats simultaneously. Should be plenty 8)

K

Posted: Wed Nov 05, 2008 3:00 pm
by VilleK
Kjell, your original design with JoystickButton and JoystickAxis components seems like a good start. I can try to throw something together using that design myself. Or do you have any code that you can send to me that I can work with? If you need time to work on it yourself then it can wait, just offering my help here.

Posted: Fri Feb 06, 2009 8:24 am
by VilleK
I'm working on joystick-support and I am considering the options of implementing them in ZGE.

Either we use the component alternative with JoystickAxis and JoystickButton components.

Or we introduce new scripting functions such as joyGetAxis(joyId,axisNr) and joyGetButton(joyId,buttonNr).

I'm sort of leaning towards the scripting alternative since we are going towards more advanced scripting and it would be nice to be able to read all joystick input in a single ZExpression. And I'd rather not do both alternatives, at least not right now. But maybe there are benefits of components that I'm forgetting. What do you guys think?

Posted: Fri Feb 06, 2009 2:30 pm
by jph_wacheski
that scripting solution sounds great to me,. no pressing reason to have an actual component comes to mind,. and yeah not having to have one seems more efficent in fact.

This feature will be a great addition,. as I have had lots of request for it with lockOn,. (oh, ville there is a video of that up on the ig site now,.)