Serialization of RPC functions

Hello, I’m completely new to UE4 (Came from unity). I’m trying to implement a generic replay/netcode system for RTS(or MOBA)-style games.

There are a few key differences from what (I perceive) the default UE4 netcode implementation to be.

  1. I want to run the entire game on reliable events calls. Events represent client inputs, or server side scripting.
  2. I want to be able to serialize and save the event stack in a file, which will allow me to replay the exact game session over again.

It seems that the UE4 RPC functionality already very efficiently serializes the RPC calls, and so it would seem to me that the best way to approach this problem will be to figure out a way to extend the RPC functionality to not only call the RPC functions, but also to save and serialize the event calls locally as well (then the serialization to file should be trivial).

To this end, I have two questions.

  1. Obviously UE4 is an extremely robust engine. Is there another way to implement this feature without directly fiddling with the source code?
  2. If not, is there a more intuitive approach that anyone can think of?

I’ll continue to fumble through the source code, but I would very much appreciate any help/advice anyone can give me!

I can’t help you much with RPC serialization, but since 4.6 there is a demo recording feature iirc. I’m not sure if you can record that demo to a file though, but you surely can use it to playback games, even when they were over the network. I have yet to try it out myself though.

Actually, it looks like the reflection provided by UClass will make this pretty straight forward.

Just looking at a few things, it seems like I can use CallFunctionByNameWithArguments to call a function that takes a string as parameters. Ideally I’d like to change this to a binary stream, but the basic idea is the same.

All that really needs to be done is write an encoding/decoding method. Anyone know if one already exists? (Ideally I’d like to go from a list of variably typed parameters (and possibly a list of their types) to a binary stream, and then back again (assuming the order of the types doesn’t change).

This is built into the engine and ready for use in 4.6 and later versions. Just do a search for “ue4 demo recording” and there’s a bunch of info out there on the topic