AE 2.9 Gamecontroller

Previous topic - Next topic

MrPlow

Hi All

Has anyone been able to get AE 2.9 to work with Gamecontroller / Gamepad?
I tried the default code but didn't seem to work for me...
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

im do not support older AE. Im remember im did a Little rewrite. also Gamepad support is quite limited to few known gamepads models (gamepads is not somewhere standard at all on Android and its a hell to support it). You might require to add a remapping feature to support your gamepad in your game. Its should Works. But remapping code do take some times to code in, but its is important, if you want to support dual Sticks.

So since im dont know the model, im can do nothing, but please not im wont support older AE versions.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

No probs SF,

Just wanted a small snippet to confirm I am using correctly. :)

Android.init
<button remapping>

Loop
Android.Gamecontroller("Update")
etc...

Its been long since I tried the gamecontroller stuff, but cant seem to find old code on here.

I have a lot of gamepads here and xbox pad too.
I will try a few more compiles and see if I can get the remapping working.

:)


Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

Android.Gamecontroller() is depreacted and will not work anymore at all. Its was too compliced to updates, so that is old.

You should update GameInput to newest version.

you should use the GameInput.gbas instead and using GameInput.update() instead.

Howover you also might require to use AE 3.X, since im does not support AE 2.X at all.

Alternative you can do your own using KEY() and doing a remap feature for that, and checks input from 1-300. You can not use analoge movements throught. Also be beware some buttons might send two inputs.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

Thanks SF!

This looks perfect!
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

Also game input api currently support ios, and Android, Windows and Pandora. On Windows a Xbox controller is recommended, but most mapping here is pretty same.

Hence I'm dropped Android.gamecontroller.().
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

#6
In end I did not update to AE 3 and my AE 2.9 does not have Android.Scancode()
So I made do with a KEY() version which is okay for basic gamepads but Key() does not like xbox controllers and some pads only directions work.

But it'll do me for now until I can update to AE 3. Reason I dont is fear of admob breaking. :)

if anyone wants to test my test with their gamepad?
https://goo.gl/2D8QAY


Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

#7
Xbox controller does not follow google input standard very well, so you cant except that to work 100% on android, without remapping. Im have followed the standard input im got from the google doc document. But either Sony or Microsoft does follow that, and they even conflict together on some inputs. Most of time its the right stick and both analoge triggers that can cause issues.

But if you do your own using android.scancode() (which returns a float) and as well KEY() (only returns a 0 or 1 value on all sticks), you should check inputs from 2 to 320 (not sure how high im have mapped the analoge sticks) under remapping, not just from 1 to 255. KEY(1) is howover allways the back button. Im did that to avoid eventuelly conflict issues. You should could copy the function without issues, if you use a newer version of glbasic as well.

Also some buttons might send twice value, you should only use the later one (check from up to down, rather than down to up).

Im do means ads still works with 3.x, but im do not 100% sure here well. But ads with glbasic does not works generally so well as excepted and could crash on some systems. This could been why im dropped that, but im did not remove the ads code yet as im remember.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

So, are you saying, I could add the scancode() separately?

For key() checking I should something like, instead of 2 to 320:

for i = 320 to 2 step -1
...check for keypress
next

I noticed some pads the button stays in the keypressed state. Press a button and 96 is showing as pressed for entire game.
probably nothing I can do on this...

I think my workaround might be fine for simple left right shoot controls.

Admob is very important for me. :)


Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

ads shall still works with AE3.0, but howover im do not sure. its does detect if a ads service is used or not. Google Service part is removed if ads service is not detected.

Also im will not garentee anything works when using older versions. Sadly and im will not tryout to do that.

Im remember changed quite a part with GameController support with AE3.0 to get KEY() integrated correctly and needed a another function to sdl_main.cpp to release the button.

Ads code is still in AE3.0, but might have changed, but not sure about that yet. Im property changed it, so more ads service could been supported, and even remove that if not used.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

Thanks SF

I might do some testing on it with a current admob id, before I consider moving to AE 3.0


Comp:
Speccy-48k, Speccy-128k, Amigas, PCs