Hi guys. My game, which is mostly C++, uses CharacterMovementComponent. I also have some additional movement stuff in the game for doing a dash in a specified direction. Up until now, I’ve been performing the dash by replicating an event from client to server which then causes CharacterMovementComponent to temporarily enter a custom movement mode. In this custom movement mode, the dashing movement occurs. After enough time has passed, the movement mode returns to MOVE_Falling.
It works fine in single player, and it almost works OK in multiplayer in a low latency environment. However, it doesn’t work well at all under high latency or with packet loss/reordering, because there is no proper prediction/rollback/replay occuring. I can easily see this by setting p.netshowcorrections 1 and looking at the mispredictions and corrections whenever a remote player dashes. Of course, it’s also visible due to the messed up character movement. This is what I would expect it to do, because there is no way I’ve provided enough information to the engine about how to apply inputs when doing prediction/prediction/replay.
I’m at the point now where I can’t continue using this hack, and I need to implement proper prediction for the dash movement.
I first looked at the API documentation, but it seems like there is not any documentation about how to do this. I also looked at some of the example projects, but none of them had network-aware customized movement. Finally, I looked at the UnrealTournament source, and its implementation of customized dodging and etc. movement. I was able to see parts of what to do – subclass UCharacterMovementComponent, FSavedMove_Character, etc. However, there are not many comments in this code explaining the big picture or how it fits together. Also, it seems there is overridden + copy-pasted code from the base engine with just a few tweaks for what UT needs to support (due to lack of base engine supporting certain things), so it’s hard to tell what I need to change for my own game and what I don’t.
I spent a bit of time on it and couldn’t figure out what needs to be done. I realize every game with customized movement is going to be somewhat of a specialized scenario with its own individual needs, but I was hoping someone with more experience in this area of UE could help me get an overview of what needs to be done to add customized movement to CharacterMovementComponent that has proper network prediction. It doesn’t need to be perfect – just enough to get me started and a general idea of what to do in the context of UE. Thanks!