Alright so ill start this off by saying i have been working on this game for about 4 weeks now and have come to a huge problem! Me and another guy have tried to fix this. My replication for my game is not working right! I have searched high and low and found nothing that works. My client wont replicate to the server but the server replicates to the client. More detail: I have a marble(Blueprint actor) that you can drag and drop around the board, if you move it on the server side it moves on the client side but if you move it on the client side it stays where it is on the server side. No idea why it wont replicate, me and the other guy have tried everything in our knowledge and what i could find on google. This is the marble BP. Let me know if you see any thing wrong and also if you need to see other things.
I have to say I’m not the best at replication yet however, I have replicated all of my game so far. Including the replicating picking up Physics objects for both client and server. Basic things to check are…
In your MarbleBP properties have you got Replication box ticked? And Replicate Movement ticked? Also you mention a Drag and drop feature? Is this in the CharacterBP? If so have you added Custom events to run this logic on the server?
It might help if you post your characterBP for your ‘Drag and Drop’ feature.
My drag and drop BP is here: Begin Object Class=K2Node_Event Name="K2Node_Event_16" Begin Object Class=Ed - Pastebin.com
Its all done inside the marble BP its self. The marble is a simple static mesh with a sphere collision on it. I have the replicates box ticked and replicates movement ticked
@ - In the future, instead of using pastebin for your BP’s, try using http://blueprintue.com/. It makes it much faster for others to look at your code. Sadly I don’t know enough about replication to help you though.
For anyone else, his paste can be found here: 1rhCOYSW posted by anonymous | blueprintUE | PasteBin For Unreal Engine
Thanks for even bothering to help! Thank you for the site, i remember seeing it but forget the url
This is a lot different from how I imagined, I thought you picked up the marble as if it was a physics actor, like your Character would pick it up. In which case I thought it would be in your CharacterBP.
Okay lets try something, Someone may come along and say I’m wrong however that is the process of Learning.
If this was me I would be be adding in Custom Events that replicate on the server. I see you are using ‘SetActorLocation’ node. Just before that I would add a Custom Event that replicates and executes on server but adding a Vector Pin to the Custom event, for the NewLocation calculation you’re passing to the ‘SetActorLocation’.
In my head what this is doing is on each tick you’re letting the client calculate the NewLocation then you’re passing that Vector result through the server (Custom Event) and Setting the ActorLocation on the server. Try doing this for all your SetActorLocation nodes and see if anything changes for you.
Like I say I am guessing now with the what I think is logically, I could be wrong but, it’s worth trying.
Let me know how you get on.
Are you sure this will work? A few days ago, I had a simple chest that I wanted to open/close from any player (client or server), and I tried everything possible with custom events, but nothing worked from the client side :\
Yeah that’s what we should try next, Because in the picture you can see the NewLocation Vector is coming straight from the Channel Trace there is no Variable to RepNotify. That could be the next step is to create a vector variable and set it to Rep Notify.
I also can see get Player Controller and the Index is 0. This might cause issues as 2 player controllers will be in play not just the one.
Let’s see what OP comes back with. I’d learn a lot from it.
Alright, I hope it’s alright for me to step into this thread here, but about the player controller index, is there a way to just ‘Get current player controller’? I have a lot of these, but for index 0 which might be causing issues for my projects as well.
I’m not at home right now and, not tried this before however I imagine you can ‘GetControlledPawn’ (I think this is a node) and connect the node to ‘GetPlayerController’. Try that.
If someone who knows more comes along please correct me if I am wrong. As mentioned I am not the best at Replication.