I am trying to create a multiplayer game. I have a player class with both 1st and 3rd person meshes and they show up as intended. When I try to run the game, the two players can see each other move around just fine. But if I start a game using the sample level that has the stacked cubes and there and I move the cubes around, only the player that’s doing the moving sees the changes. The cubes don’t move for the other player. It seems each player is running his own copy of the server. But how is it that each player can see other and collide with each other?
So my question is what needs to be done to create a networked multiplayer game where there is a server and clients? The old quake games had seperate code for each and clearly defined hooks for receiving events like ‘player join’ and ‘player leave’. The client/server distinction seems pretty murky in UE4. Is there a roadmap somewhere for creating a multiplayer game in UE4?
Basically actors can be individually flagged for replication. In the example, the boxes are not flagged for replication while player pawns are by default.
Whammy, besides checking ‘Replicates’ did you also check ‘Replicate movement’?
I got some simple physics replication working in the First person template by creating a blueprint, checking ‘Replicates’ and ‘Replicate movement’ in the blueprint’s defaults and adding a Box component with ‘Simulate physics’ checked. When pushing the box around, the box will stay synchronized on multiple clients. However, when shooting the box from a client that is not the host, the client will desync. I think this is because projectiles are only spawned and physics simulated client-side.
Hey i had this same issue working on some physic dependent actors.
Two things first for a multiplayer game always spawn a item server sidee, and have it replicate to all clients.
For the physics that is out of sync located in the USceneComponent:: are.
SomeCompoent->SetMobility(EComponentMobility::Movable); // Makes physics in sync for all client(s) and/ or Server
Its worth to note that when running PiE it tends to be somewhat out of sync event then.
I think the problem is that the cubes in the example map are just plain old static meshes. I suppose that if I blueprinted them, it would allow more options.