I am an intern at a game company, and I’ve been working with the Unreal Editor for two and a half months now and I have created a mechanic for a game that has this function:
- Saves the player location per frame. (Per EventTick)
- Whenever I press the key bound to the function, “reverses back time”, meaning, it reads the previous locations of the character stored in an Array, and blends a transform between said array index.
- I can only reverse back time if i have enough of a pickup (there’s a pickup that gives me energy to use this function, whenever it hits 0, I cannot use this function anymore.)
I have however hit a wall with the following problem:
- Once it starts saving the positions, my frame drops (at least 30fps) and keeps dropping as length of playtime keeps ticking away.
What have I tried to do to fix my problem?
Put a float variable to a branch (A>0) and on false will not keep on saving locations)
Set a limit to my Array using the Array Resize function.(Only works whenever the total Length of the Array hits 200 (I have done this because, when I have a full progressbar in my hud with the energy to reverse the time, it’s enough to reverse 200 frames)
Tried to bind an Array clear on EventBeginPlay
Measure various information (ArrayLength, FrameCounters, Succesful clears, etc.) none of this information made me wiser, or able to fix it.
- Checked the Session Profiler for other things that could possibly cause a problem with the performance.
I would gladly accept any knowledge, workaround, or feedback on this piece of code in my blueprint, and I’ll be happy to share more information if needed.