-
Notifications
You must be signed in to change notification settings - Fork 450
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
Rudimentary Gamepad Recording and Loading Support for FlxReplay #3330
base: dev
Are you sure you want to change the base?
Conversation
Could you share a little test state that would allow me to verify its accuracy? Perhaps we can add Gampad controls to the Replay demo?
Could we get this to behave like keyboard? where zero values are ignored? |
I've been testing this on my own game with a bit more bloat, but here's a small video showing the system (the player marked in red is using a gamepad): 2025-01-05.19-54-42.mp4The debug text on the right has a "Input" section showing the exact input from the gamepad/demo, as some are ignored
I realize I can just clear the axis array ever frame and leave out zero-d inputs from being saved, I'll try to make something now to get this working |
if (recording) | ||
{ | ||
if (AxisID < 0 || AxisID >= axis.length) | ||
{ | ||
return 0; | ||
} | ||
return axis[AxisID]; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you talk about why this is needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm editing the axis list upon playback (i'm not entirely sure if there's a better way to edit the axises of a gamepad, that's just what i was able to find) but if i don't specify the gamepad has to find it's axis from there, the gamepad will pull it directly from the input device. Along with this, the recording could double-up the axis flip as getAxisValue() flips it once during playback and could flip it again if called raw when recording. I wasn't sure if making a new variable inside FlxGamepad or making a new class overriding this was the better choice
Also can you post an example of the string data? |
Adds support for recording and loading gamepad inputs inside FlxReplay-s, so far only support button and analog inputs.
Analog Inputs are always recorded even when 0 which may cause a small jump in replay file size when having multiple gamepad inputs connected. There are a few areas where I touch FlxGamepad and FlxGamepadManager that could seem a bit sketchy, but i'm not aware of any other ways to get this to work. Tested on CPP and HTML5