Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Handle different gamepads?

Author
Message
Fluorescent
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 1st Aug 2005
Location: Stockholm, Sweden
Posted: 19th Aug 2015 14:53
This is not really serious but I am curious how you manage different gamepads as input for your games?

I, mostly as a joke, bought a retro USB nes controller that works fine. However it's mapped to buttons two and three in AppGameKit, there the 360 controller starts at button one if I remember correctly. So how would you handle this in your game?
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 19th Aug 2015 15:55
With EatDrinkSlay, it supports the 360 control pad, keyboard, and also virtual controls as buttons. I just have a different setup file for each control type, so it's fairly easy to add control types, I just make a setup file - say I wanted to support a PC joystick controller as well, that would mean a new control setup file. The user simply chooses the control method - although if it does detect a 360 controller connected, it will default to that - just because it's the best way to play the game and is assumed that's the intention - the keyboard still works for controls when a 360 controller is connected.

But, that doesn't really help when you might have an endless variation of controllers. For example I have 2 USB SNES controllers, they'd probably work fairly well for the game as well, so I'd make a control setup file for those - but I'm probably the only person who'd ever use them, likewise for your NES controller.

It's not so bad when you just need direction and 1 or 2 buttons, you'd probably not need anything specific for that - but if you want to support any controller, you need to make a control setup screen where you can specify which buttons do what, maybe even allow analogue axis controls or hat controls; digital controllers might not use standard joystick X and Y variables. Take iCade controllers for example, like those mini arcade cabinets for iPad - they have a mind-numbing control method where pushing right for example mimics a single key press, and releasing right mimics a different keypress - so you have to use control states which can be tricky and would certainly require specific programming and data handling. It can be a minefield when you want to support the more obscure controllers. Personally I'd try and support iCade any chance I get, because they're cool and I have one - I mean playing Super Crate Box on an iCade is the best way to play... and dare I say it, iCade and other controllers have their users out there searching just for games that support it, and will buy a game based on that, disregarding even the worst review scores.

I think it's worth gathering as many USB controllers as you can and testing them, you'll soon work out what the common properties are, and what has to be specified by the user.

Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 19th Aug 2015 16:37
Quote: " if you want to support any controller, you need to make a control setup screen where you can specify which buttons do what, maybe even allow analogue axis controls or hat controls; digital controllers might not use standard joystick X and Y variables. "

Configuration screen is the best method for widest range of support.

Quote: "I think it's worth gathering as many USB controllers as you can and testing them, you'll soon work out what the common properties are, and what has to be specified by the user."

I like the configuration screen idea better.
That way, you don't have to own any of those controllers to support all of them.
Let your program and the user do all the work for you.
There are only 9 possible inputs for the joystick/gamepad anyway, being the Joystick directions (4 way) and 5 buttons.
So, the code necessary should not be long or complex.

Quote: "digital controllers might not use standard joystick X and Y variables. Take iCade controllers for example, like those mini arcade cabinets for iPad - they have a mind-numbing control method where pushing right for example mimics a single key press, and releasing right mimics a different keypress - so you have to use control states which can be tricky and would certainly require specific programming and data handling."

Detecting key presses is easy.

Quote: "... and dare I say it, iCade and other controllers have their users out there searching just for games that support it, and will buy a game based on that, disregarding even the worst review scores."

I was unaware of this, because I have never used iCade.
This is very interesting, and warrants further investigation, because this could offer a solid selling point.


Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
Fluorescent
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 1st Aug 2005
Location: Stockholm, Sweden
Posted: 19th Aug 2015 18:26
Quote: "There are only 9 possible inputs for the joystick/gamepad anyway, being the Joystick directions (4 way) and 5 buttons."

That's not 100% true is it? Because by using GetRawJoystickButton you can get input from more than five buttons if I understand correctly.
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 20th Aug 2015 02:09 Edited at: 20th Aug 2015 02:21
Oops, I didn't realize the raw can do up to 32.
Good one, thanks for pointing that out!

I was going by what the GetButtonPressed() command says and I got confused...
Quote: "
If a real joystick is found then the first 5 buttons from that will be used for the AppGameKit button commands. Otherwise the AppGameKit looks for a fullsize keyboard and if found will use the following keys in the following order Space, E, R, Q, Control, to represent buttons 1 to 5 respectively."


Now that you mention it, the RAW can handle 4 joysticks!
I was thinking we were limited to only 1.


Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
Fluorescent
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 1st Aug 2005
Location: Stockholm, Sweden
Posted: 20th Aug 2015 08:28
Yes, it took a while to figure out that the NES controller had mapped the start and select buttons to 10 and 11. And I couldn't get those with getbuttonpressed.
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 20th Aug 2015 18:16 Edited at: 22nd Aug 2015 03:24
Too bad I didn't know this before I did my keyboard hack, as it would have saved me a lot of time.
Oh well, now we know, and my Arcade Machines will be a lot easier to build now.
I owe you one!


Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1

Login to post a reply

Server time is: 2024-11-25 19:57:04
Your offset time is: 2024-11-25 19:57:04