Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gamepad buttons #2

Closed
ilinas opened this issue Aug 30, 2018 · 18 comments
Closed

Add gamepad buttons #2

ilinas opened this issue Aug 30, 2018 · 18 comments
Labels
help wanted Extra attention is needed

Comments

@ilinas
Copy link

ilinas commented Aug 30, 2018

This is a very cool concept! However to be usable in vast majority of games, one would need at least A, B, X, Y buttons. Best of luck with the project. :)

@rmst
Copy link
Owner

rmst commented Aug 30, 2018

Definitely! But we might have to add a TCP connection to transmit button events because the current UDP connection might drop the event and that might be frustrating to a user.

@kozec
Copy link

kozec commented Sep 2, 2018

How about transmitting entire state all the time? Then even if packet is dropped, next one will contain missing info.

If you can use binary protocol, it should be possible to fit one axis or all buttons into 2 bytes, so entire state should fit into 16B, if I'm counting it correctly.

@rmst
Copy link
Owner

rmst commented Sep 3, 2018

Yes, that would be straight forward to implement. We are already transmitting the full state. The problem is if there is packet loss, a fast button press might be completely missed. But maybe that's not actually a big problem in practice.

@rmst rmst added the help wanted Extra attention is needed label Sep 16, 2018
@pzmarzly
Copy link
Collaborator

Well, there is one way to find out - implement it.

It would be nice to have option to configure a button as a toggle button (press once to "press down", press once more to stop "pressing down").

I think transmitting full state with UDP is fine. If someone needs almost-frame-perfect button hits or is fast enough to do them, they won't be using WiFi connection in the first place.

@kozec
Copy link

kozec commented Dec 28, 2018

Hey, I've already forgot that I'm following this :)

I've recently implemented support for "Remote RetroPad" in my application, protocol that is used by Retroarch on Android for exactly this. It sends only changes in UDP packet that basically contains 4 numbers and I have yet to see single "lost input" :)

@rmst
Copy link
Owner

rmst commented Jan 5, 2019

If someone makes a html/javascript version of a controller interface with two joysticks and buttons I'd be very happy to merge this via implementing #17 .

@kozec
Copy link

kozec commented Jan 5, 2019

I have gamepads as svgs here, but I'm not sure if it's possible to use js with SVG images.

@pzmarzly
Copy link
Collaborator

pzmarzly commented Jan 5, 2019

It is. SVG elements can have HTML id, class or onclick attributes. https://stackoverflow.com/q/2296097/5108318

@rmst
Copy link
Owner

rmst commented Jan 10, 2019

Interesting! The main thing would be to do (re-)implement the ontouch (down, move, up) lifecycle. Basically replicating in javascript what has been done in https://github.com/rmst/yoke-android/blob/master/app/src/main/java/com/simonramstedt/yoke/JoystickView.java . Here is a tutorial on how this works in javascript https://seb.ly/2011/04/multi-touch-game-controller-in-javascripthtml5-for-ipad/ .

@pzmarzly
Copy link
Collaborator

I'll try implementing it

@pzmarzly
Copy link
Collaborator

I hate Javascript and Samsung OS is garbage, but there you go https://github.com/pzmarzly/html-touch-joystick.

With right config (see consts in base.js) it will output current status to console, which you can grab.

It was made with user in mind - by editing CSS, user can easily change layout and behavior (animation-name: locking; for locking behavior - on video I set it for left joystick). I also added 4 buttons.

I added 32 buttons in code, but user can disable any unwanted button in UI settings

@rmst
Copy link
Owner

rmst commented Jan 11, 2019

Awesome, thanks! I'm going to try to incorporate it in the app statically first and then dynamically as proposed in #17 .

EDIT: @pzmarzly if you like you could open a pull request in this repo so you receive proper credit. I think the files could perhaps go in a folder called assets/joypad.

@pzmarzly
Copy link
Collaborator

Done in #19 . Thanks

@rmst
Copy link
Owner

rmst commented Jan 15, 2019

Basically #17 is implemented in master now and serves the html/javascript client that @pzmarzly built. The android app (experimental version in this repo under devel/) loads the html/javascript into a webview. I also made some minimal changes to the client, to get it to work. The buttons should be working now. The next step would be to test the client on windows and to make it a bit nicer. The goal is to keep the same quality when switching to webview in the official app.

@rgarrigue
Copy link

Hi ! Seems yoke is exactly what I was looking for, except for this "almost available" feature. Seems only windows is yet to be finished, can I use the RC for linux ? F-Droid release is 7 months old, I guess that's not it.

@pzmarzly
Copy link
Collaborator

pzmarzly commented May 5, 2019

RC is a redesign, you are welcome to test it (works fine for us, but since it uses Android Webview results may vary depending on the device). Here's the latest APK. You can clone the repo and run pip3 install .. Button configuration can be tweaked in yoke/yoke/assets/joypad/*.css. I'm not sure if Windows build works

@rgarrigue
Copy link

Thanks @pzmarzly. Tried it. Honestly it's too raw for me. I found an alternative meanwhile, controlloid, which fit my needs.

@medape
Copy link
Contributor

medape commented Jul 31, 2019

@rmst: Could you close this issue and #17? They're not needed anymore (and arbitrary controllers are being discussed on #33 anyways).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants