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

Axis values support for network diffs #342

Closed
paul-hansen opened this issue Apr 11, 2023 · 4 comments · Fixed by #422
Closed

Axis values support for network diffs #342

paul-hansen opened this issue Apr 11, 2023 · 4 comments · Fixed by #422
Labels
enhancement New feature or request

Comments

@paul-hansen
Copy link
Collaborator

paul-hansen commented Apr 11, 2023

We used the network diffing functionality of this library for our game jam game: https://prawl.itch.io/stellar-squeezebox which overall turned out great and it was really helpful for getting something off the ground quick!

Unfortunately, gamepad support was really lacking when diffing actions with a couple major issues:

A. There is no support for axis data for ActionDiff
B. If you use an axis as a button (e.g. turn left) you can't set a deadzone or it stops being recognized on the server. Example:
SingleAxis::negative_only(GamepadAxisType::LeftStickX, 0.1).with_deadzone(deadzone)
Was user error. See comment

I'd like to contribute towards this, so if you have any thoughts about how you want this to work let me know. (I'll probably taking a few days to relax now that the jam is over, so might be a bit)

@paul-hansen paul-hansen added the enhancement New feature or request label Apr 11, 2023
@alice-i-cecile
Copy link
Contributor

Oh awesome, I'm really glad this worked out! I'm leaning towards "refactor to use traits and split apart axes and button more clearly" (#321) first: ultimately I think our data model is flawed in messy ways that come out here.

Would be very happy to pair on that though if you're up for it.

@paul-hansen
Copy link
Collaborator Author

Discovered that problem B was mostly user error. .with_deadzone() shouldn't be used with SingleAxis::negative_only instead I should have been adjusting the threshold value passed to SingleAxis::negative_only which needed to be negative. I think this would have caused issues under non-networked use too. I should have made a minimal repo to test and would have caught this, was just lazy after cramming for the jam.
Gamepads are working for our game now! Just have to treat everything as a button since there isn't axis data in actiondiffs.

@paul-hansen paul-hansen changed the title Gamepad support for network diffs Axis values support for network diffs Apr 16, 2023
@TimJentzsch
Copy link
Collaborator

Discovered that problem B was mostly user error. .with_deadzone() shouldn't be used with SingleAxis::negative_only instead I should have been adjusting the threshold value passed to SingleAxis::negative_only which needed to be negative. I think this would have caused issues under non-networked use too. I should have made a minimal repo to test and would have caught this, was just lazy after cramming for the jam. Gamepads are working for our game now! Just have to treat everything as a button since there isn't axis data in actiondiffs.

Is this behavior documented properly?
Might be worth it to open up a doc issue for this in case that others might run into the same problem :)

@paul-hansen
Copy link
Collaborator Author

It kind of is, but you have to think about what it's saying and already understand what the values on SingleAxis mean.

Creates a SingleAxis with the axis_type and negative_low set to threshold.

Positive values will not trigger the input.

Source

Could probably be improved to help avoid it being a footgun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants