I’m working on a system to record the player’s original input (movement, rotation and jumps) in order to replicate it to another bot that should do the exact same actions, fail if there’s any new obstacle in their path or succeed a previous action that wasn’t possible at the time of the record.
So far, I’ve tried some different solutions, as calculating the distance and direction it should be moved according to how long the input was hold and interpolating it through a Timeline, but it starts to fail when I walk up a slope or fall down.
Another solution was to actually feed the inputs to the bot through Tick or Timeline, but the final result wasn’t as accurate as needed (both characters have the same properties).
What are other solutions that could work on this? I’ve looked a bit on the in-built Replay System, but does it store Inputs rather than the raw position?
The issue with this solution is that it can’t fail in a sense of the player keeps pressing the Forward Input that is not available right NOW due to an obstacle, but it may be available later if that obstacle is not there anymore.
Something akin to the game Echoshift, where the playback character will try do to the action regardless.
By saving the inputs and replaying them in the character (which would be the perfect option), the final result is not as accurate as the original character did, I think that’s due the unreliability of using Tick to reproduce these things.
And by saving the inputs and instead trying to calculate the final positions, ramps and falls become a problem for the playback character. I think the reason for this problem maybe related to the character’s velocity, that is not the same as the original character was when falling or walking up.
A proper system needs to store the original locations and rotations, read them back maybe 3 ahead, and do the math over what it needs to do to achieve said goal.
You could store input pressed + the transform. That way you have some idea of what action was being performed (or rather starting) at the time.
But still, if you want exact behaviour, you may want to essentially record the animation that took place.
Sequencer does that at the editor level.
You may be able to use that as part of gameplay.
If not, then you can draw inspiration and extract code from it.
Each frame should record the transform of each bone making it possible to play back the exact same motion.
Actually, im sure this is part of the gameplay. Look up how to do rewind time systems. I believe its the same thing in practice.
Yeah, I’m storing the Transforms at the time it was recorded AND the Inputs + how long it was pressed, I guess the issue then is lying on math solving.
The velocity might be one of the stuff I’m missing, actually. I’ll tinker with it for a bit, thanks!
I agree recording the whole animation and playing it back would be easier to solve, but the main mechanic is to be able to fail or succeed when it it wasn’t previously
Physical animation component could allow you to do both things.
Play back an animation, have it respond to the environment around it. Including tripping over stuff potentially - it wont fall thoguh unless you detect the tripping and issue a “stop following and simulate” of some sort.
Using the physical animation component, if the original character wasn’t able to physically move forward BUT was pressing the input to try and go further, would the playback be able to if that obstacle wasn’t there anymore?
make player controller that reads all inputs, and calculates correct movement. Make event dispatcher in it with calculated movement
Make AI controller that has custom event (and assign it to dispatcher) that can be triggered from player controller (with those calculated moves from player controller)
make player pawn that is camera only
now player controller calculates movement response to player input, sends it over to AI controller. And AI controller moves all AI pawns.
No, in that case your pre-recoded stuff was already stuck so it wouldnt move any furhter.
To do something like that, you would need an extensive blackboard ai setup that emulates the old key presses or behaviour anyway.
Its much less doable since its not “just play back what happened” but “come up with new stuff to happen based on old input pressed”.