I am trying to implement multiplayer from a Basic Code template, but I came across a few problems.
I have already successfully made multiple spawns with C++ code and player locations are already in-sync.
However, the EditorCubes that come default in the First Person Template are not syncing locations to the clients.
Here’s what happens:
When the host client (hosting the listening server) moves a cube, it doesn’t update the position of the cube to the other connected clients. Although the newly moved cube hasn’t updated location to the connected clients, they can still collide with the cube and move it (as shown on the host client’s screen), but it just looks like they’re colliding with nothing.
There is yet no official documentation of how networking works in UE4, so I’ve been taking random guesses to try to get it to work. Unfortunately, nothing seems to work. Any help would be greatly appreciated.
I was wondering if it is possible to change the replicate flags somewhere outside the constructor. (Like in the ConstructionScript)
Use-Case:
I have an Actor that has a flag: bIsPreview and I want to use this flag to change the replication flags. I know this parameter bIsPreview before construction so I hope I just have to find the correct hook. OnConstruction() does not seem to work here.
Edit:
Stupid me saw the SetReplicates method today and if I’m using the method to turn on replication in OnConstruction() then everything works.