Virtual gamepad

Show off your games, demos and other (playable) creations.
glitchapp
Party member
Posts: 231
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Virtual gamepad

Post by glitchapp »

Hi, I'm working on a virtual gamepad with the goal of making some games playable on mobile devices without an external controller.
screenshot.gif
screenshot.gif (104.15 KiB) Viewed 1204 times
So far it works fine but there are some issues with the touch controls.

Here is the source of the library in case anyone wants to test it: https://codeberg.org/glitchapp/virtual-gamepad

I also released a mobile version of a forked pacman clone which can be download and tested on mobiles: https://codeberg.org/glitchapp/pacpac/releases

If anyone has the time to test it on mobiles and provide feedback that would be very useful.

Thanks!
Attachments
TouchControls.love
(76.57 KiB) Downloaded 47 times
SugarRayLua
Prole
Posts: 46
Joined: Sat Dec 03, 2022 7:52 pm

Re: Virtual gamepad

Post by SugarRayLua »

Hi, @glitchapp-- I like the idea and thanks for consideration for the mobile user!

I just tested it on iPad; here's some feedback:

Nice design: I especially like the characters and Pacman looks tough!
Overall the game pad seems quite functional

Recommended improvements:
Virtual joystick is a little jerky in its movements: perhaps could smooth out a little more?

Pacman type game:
Screen dimensions aren't correct on iPad; side-Loaded Love app displays your project horizontal but with the bottom cut off (can't see Pacman starting position). On App Store Love-2D studio, project is displayed vertical which also cuts off some of screen

Perhaps Pacman shouldn't work-out so much: he seems bigger them some of the corridors in the maze and seems to get stuck at times and just spins in place for a while when I try to move him until he gets un-stuck.

Please let me know if you would like me to send some screen video.
User avatar
darkfrei
Party member
Posts: 1155
Joined: Sat Feb 08, 2020 11:09 pm

Re: Virtual gamepad

Post by darkfrei »

Samsung M53
1. Not fullscreen
2. Pressed buttons are still pressed
3. Left stick has gap near the middle and don't goes to the center without tap.
4. Right stick was not moved, but lest stick is directed to the right stick position.
Attachments
Screenshot_20240206_084039.jpg
Screenshot_20240206_084039.jpg (82.89 KiB) Viewed 1055 times
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
glitchapp
Party member
Posts: 231
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Virtual gamepad

Post by glitchapp »

Hi SugarRayLua,

Thanks for the feedback, I'm glad to know that it works on Ipad.

I know the character get stucked and the problem has nothing to do with the size of the asset ( I can make it smaller but that doesn't affect the logic).

The reason why it get's stucked and movement is a little "jerky" is because the release function for touch controls is disabled because it makes the game crash on my mobile, I need to find out why. You can test this by playing the game with mouse and you'll see that the touch controls work as expected.

Just to clarify pacpac is not my game as it is stated in the repository, I forked it and added new assets, gamepad and touch support.

I only have one type of touch device to test games and is a mobile phone with Sailfish Os, in that phone pacpac renders relatively right, however, love2d does not change orientation on sailfish Os.

Since I can not test on Ipads ( I don't have any) it would be a lot easier if you freely tweak the resolution and screen parameters inside the game, if you manage to make it render properly you can send me the changes and I could maybe create a specific release for Ipads...

I added the touch library to 3 more games just in case you want to test them, you can find them on the list which has links to the repository of each game: https://codeberg.org/glitchapp/virtual-gamepad

The 3 games to which I added touch support are: fish fillets mini, Snak (another fork), and Nova Pinball.

I hope it helps!
SugarRayLua wrote: Tue Feb 06, 2024 3:30 am Hi, @glitchapp-- I like the idea and thanks for consideration for the mobile user!

I just tested it on iPad; here's some feedback:

Nice design: I especially like the characters and Pacman looks tough!
Overall the game pad seems quite functional

Recommended improvements:
Virtual joystick is a little jerky in its movements: perhaps could smooth out a little more?

Pacman type game:
Screen dimensions aren't correct on iPad; side-Loaded Love app displays your project horizontal but with the bottom cut off (can't see Pacman starting position). On App Store Love-2D studio, project is displayed vertical which also cuts off some of screen

Perhaps Pacman shouldn't work-out so much: he seems bigger them some of the corridors in the maze and seems to get stuck at times and just spins in place for a while when I try to move him until he gets un-stuck.

Please let me know if you would like me to send some screen video.
Last edited by glitchapp on Tue Feb 06, 2024 11:29 am, edited 2 times in total.
glitchapp
Party member
Posts: 231
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Virtual gamepad

Post by glitchapp »

Hi darkfrei thanks for the feedback, I could not test the game on android yet.

1. The gamepad file I shared is only for testing purposes, the real games using the library are listed on the repository of the virtual gamepad, you can find it here: https://codeberg.org/glitchapp/virtual-gamepad
2. I know, the reason for this problem is that I don't manage to use the touch release function without making the game crash on my mobile, I need to find out why.
3. The reason why the thumbstick doesn't return to its center without tap is because the touch release function is disabled, I don't know how to make it work yet...
4. I think all of the problems you discovered are all related to the touch release function, I believe that If I make it work all of the problems will solve... I will provide more info once I find out...

darkfrei wrote: Tue Feb 06, 2024 7:45 am Samsung M53
1. Not fullscreen
2. Pressed buttons are still pressed
3. Left stick has gap near the middle and don't goes to the center without tap.
4. Right stick was not moved, but lest stick is directed to the right stick position.
glitchapp
Party member
Posts: 231
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Virtual gamepad

Post by glitchapp »

I managed to create a touch release function that do not crashes the game.
I tested it on my mobile and there are some improvements:
The left thumbstick returns to its center on release.
The right thumbstick do not return on release and needs to tap (needs to be solved).

The buttons do not keep pressed anymore.

There are still an issue with the right thumbstick but there are some improvements in this version. I updated fish fillets mini and pacpac with the new version of the library, feel free to test it.
Attachments
TouchControls-0.1.love
(76.79 KiB) Downloaded 28 times
SugarRayLua
Prole
Posts: 46
Joined: Sat Dec 03, 2022 7:52 pm

Re: Virtual gamepad

Post by SugarRayLua »

Thanks, @glitchapp, for those clarifications and helping to make more Love2D games mobile accessible.

I'll try out your newer release and determine what resolutions work on the iPad and try out the other projects you mentioned that you are trying to make more touch-friendly. 😊👍
SugarRayLua
Prole
Posts: 46
Joined: Sat Dec 03, 2022 7:52 pm

Re: Virtual gamepad

Post by SugarRayLua »

P.S, @glitchapp,

Have you also tried the paddy library:

https://github.com/Jigoku/paddy ?

I found that works pretty well also on mobile iOS

Fyi
glitchapp
Party member
Posts: 231
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Virtual gamepad

Post by glitchapp »

SugarRayLua wrote: Wed Feb 07, 2024 5:28 am P.S, @glitchapp,

Have you also tried the paddy library:

https://github.com/Jigoku/paddy ?

I found that works pretty well also on mobile iOS

Fyi
No, I did not checked that library and it looks very interesting. I think I could combine the functions I created for the thumbstick with that library, thanks for the tip!
glitchapp
Party member
Posts: 231
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Virtual gamepad

Post by glitchapp »

Hi, I started a project to port some games I selected for mobile devices. Details and the list can be found here:

https://cryptpad.fr/pad/#/2/pad/view/b2 ... PDbojas/p/
(password: "love2dtouch")

Porting and making game "mobile friendly" is more challenging than I initially though, and adapting it for touch controls is just one of the challenges:
- Shaders that works on PC usually do not work without porting them to mobiles
- Performance issues happens if the game is heavy and was not developed thinking on mobiles limitations
- Stretching and adapting the size, layout and resolution is a lot of work

Besides that some of the project listed above are unmaintained and need a lot of work to use the last Löve API which is a must if you take the work of making LÖVE games work on mobiles seriously.

Just in case anyone is interested on testing and / or helping make those and more games work on mobiles, I created that list and guidelines with the hope that the work moves forward.

Even if this is posted on my touch controls thread on the forum, I'm open to implement any other solution if it fits the game, so there's no need to implement my touch library, the only thing I really prefer is some kind of "thumbstick emulation" since most modern games are playable with thumbstick.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests