Joystick Support
Moderator: Moderators
Joystick Support
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 :)
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
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
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
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
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

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
- Attachments
-
- Joystick.jpg (75.03 KiB) Viewed 14836 times
I see the complexities here... You've done good research Kjell
. That Sega-controller brings back memories.

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?If you're just using one analog stick ( 2 axes ) and some of the first buttons you're pretty safe across the board
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
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
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.VilleK wrote: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?If you're just using one analog stick ( 2 axes ) and some of the first buttons you're pretty safe across the board
(that is, of course, from someone who has no idea about implementing such things ;)
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
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.
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.
iterationGAMES.com
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.
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?
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?
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
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,.)
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,.)
iterationGAMES.com