LuLima
(LuLima)
March 14, 2018, 2:36am
16
Richard_Hinckley:
Yes, that’s basically it. In my code here, you could probably just set the ActiveGravityCurve to nullptr or your fall curve whenever you’re off-ground and the jump button has been released and that would be the most basic part.
To finish it out, you need to know that you’re officially in the hold-to-gain-height part of your jump, so I’d say to set a timer when you start jumping, and then if you release the jump button in the air, you check the timer. If the timer is still running, you start your special fall sequence and deactivate the timer. You also deactivate the time if anything changes that takes away your height control, e.g. you land unexpectedly, you take damage and get knocked back, anything like that. FTimerHandle is pretty versatile…and now I want to do a stream about it. (No promises!)
Working on it right now! I have to redo the multi-jump feature that I coded live, and then I’ll have a link for you. Should be pretty soon.
EDIT: https://epicgames.box.com/s/x4rk68es…52ouvxl0rxsexl
The short answer is “it will work exactly as well as everything else related to netplay.” But we can go into more detail:
To address your mention of a movement component and something that was said in chat during the stream, yes, this Pawn code I wrote would be really good to put in a movement component. I only kept it in Pawn because I wanted a quick and dirty thing so I could stay focused on curves. So you absolutely could take this code concept and put it into a Character Movement Component or Pawn Movement Component if you like using them, and in many cases, that would be the best practice. There should be no new issues with networking because the curves exist as data assets that all the clients (and the server) will have. All machines in the game should be able to predict movement just as accurately with a (known) curve as with a mathematical formula, and server correction should only happen in cases where it would have happened anyway. What messes up net games (aside from unavoidable realities like packet loss) is when a machine does something that other machines have no way of knowing about. However, in this case, as long as they know you’re jumping, they should know what your jump curve is because they have everything they need to figure it out or look it up on their own.
Of course, I didn’t write this code properly for networking since I was just trying to demonstrate what curves can help you accomplish, but if you have decent networked play already working and simply swap curves in for mathematical formulas, it will work exactly the same with regard to net play.
Thanks for the answer [USER=“2247”]Richard Hinckley[/USER] :). I have a few concerns still. I’ll try to keep it short and not make to many more questions:
Where would be the best place inside the Character Movement component for me to Read from the curve and change the velocity?
I would need to store a timestamp of when an action started in the saved moves right? In case of a server correction occurs and i need this information to sync everyone back up?
The Character Movement Component is really lacking some documentation on how to expand on it. Do you know where i can find additional details other than the Unreal Tournament Source Code?