Hello,
I need some guidance on this.
I am working on a multiplayer.
Player host (server) and client are working just fine, both can spawn things, change things and what one do the other sees, is all good there.
After both do changes on position of things (example move an apple to other place on the map) I save the game data, close the game.
If I restart it with the host and client on the map and then run my function to reload the game data
everything comes correct, that apple will be on the right place, for both host and client.
Now if only host is on the map and load the data the host will see all correct but when the client joins later the things will be there but most in the wrong place, some will be floating, some no where to be found, the server sees all correct at the same time.
All save, load, spawn is done only on the server side.
If I look the blueprint debugger and that apple will be there for both players and if I look the root component they have the same transform values, then I do not know how the apple on the client will be in a complete different place.
Do I need to have some routine for the client to request the server information on the items after he joins? I was thinking the replication would take care of that.
Anyone has some idea on where should I look.
Thank you for any guide.
Adding some more information.
The position of the items for the client are correct relative to each other, they are just shifted from the original position, is like the 0,0,0 coordinate of the map for the client is different for these items.
Thank you for the answer.
No, I just multicast things like playing a playsound or so.
If I undestand the transform of a bp that is set to replicate has no place on the bp to say that is a repnotify, you can just say is replicated, the movement is replicated, there is no place to say is repnotify.
I am probably missing something on the transform of the item that I need to do.
When the client joins that transform location is correct but the item spawn on other place for the client.
I have the transform of the items printed on screen, they show the same location but even the transform location for the client shows the same as the server on the map that item is in a different place for the client. If I go look to the item on the client side and ask for the location it shows the same as the server, but still is not on the same place.
I just found that when the client connects the server character is also on the wrong place for the client. I got a picture of that. Then is something with where the client sees the server when connects.
Well, I did go to every replication setting on the parent class of the items that do not appear on the correct place and changed one by one.
When I changed the option ‘Replicate Using Registered Sub Object List’ to checked all kind started to work.
The items now appear on the correct position on the map but still floating in the air, like 50 centimeters.
I will look what the ‘Replicate Using Registered Sub Object List’ exactly does.
Funny other items from other classes do not need that option check to work.
Replicate Using Registered Sub Object List shouldnt be required, but we’d need to see some code to do more than guess.
another fail point is begin play, begin play can fire before things are loaded/ready
another thing to look into is relevance, maybe the item hasnt updated because its not relevant to the client yet
Sorry to say after playing around more the Replicate Using Registered Sub Object List is not the solution either.
What happen was when changing these parameter on replication by mistake I disable the Component Replication of the mesh of these items. That is what fixed the problem.
When a client logs late will have all the items in the correct position, but that create a problem, with that off the movement replication stopped to work, if server put an item on the ground the client sees it spawn but the movement will not be the same the server item may go one way and the client other way.
If I put the component replication back on the mesh the movement works again but I get back the wrong position of items when a client connects late.
Does anyone have any clue why that is?
Auran,
If you look my post just after yours what create the problem is the component mesh being set as replicate. I have no idea why, if I remove that the items show on the right place but the movement sync stops working.
Do you know anything about that?
I played with always relevant and nothing helped there.
Hello,
If I have something and drop it is all done on server side.
The item just have a BP/DefaultSceneRoot/PickupObject(Static Mesh)
When you say just the root component only needs the replicate is the BP right? That has that.
But still if I remove the Component Replicates from the static mesh component the movement sync stops.
I will make a backup and try that.
Now, if a drop something the server spawn the item and apply a small force to it just to look like a drop on the ground.
What happens on the client side? That could be the mesh needs to be replicated? Should I delay apply the force to allow the client to have that spawned?
I cannot replace the DefaultScene with the Static Mesh, the DefaultScente is on the parent, if I go on the parent the DefaultScene cannot be deleted. On the child I cannot move it up above it.
Still, why in the world if I have that static mesh component to replicate the items show all on the wrong place for the client when he spawn after all items are already in game?
If I look the blueprint debugger the items on server and client have the same transform values, but they are not in the same place on the map. They are all in correct position relative to each other, they just shifted on the client.