I have an actor which is set to replicate, net dormancy initial, and on server side some instances of this actor are spawned on the map, which are replicated fine on clients and are there too on the map.
Now inside the actor I have a static mesh component set to “Component replicates” / “False” that I want to change the size of it by calling a method on server and on clients, without it using replication because the size is being changed theoretically every 1ms for a smother size change.
I what to do something like calling a method set run on server, and inside of that I loop though all the controllers and call another method set to run on owning client that will do the change.
The problem that I have is that even if on server side I call the change on a normal method that it isn’t replicated, the size change is still replicated to clients.
Do you use additional replicated variables for scale or animation control? How/what RPCs do you use?
In my test blueprint, where replication is enabled only for it, but not for the component - the scale changes only where the function was called.
You eventually need to store the scale in a replicated variable, otherwise players who missed the RPC (joined the server later) will see the default scale.
No. Inside that actor I have a Box Collision that after some time any player enters it, on server side I’m calling a method that is not set to replicated, which inside it has a Set Timer by Event that changes the size every 10 ms, by checking if the new value of component size is equal or greater then the value I want it to reach, and the added value is a static one. When it is equal or greater then it clears that timer. The change is done by using “get world scale” and “set world scale 3D”.
The static mesh component has collision to ignore everything, as it is just for effect and not actually affect anything physically.
That is not a problem in my case, as players can’t join later, they all start the actual map all at the same time, and changes are done after this. Think how Fall Guys work, it is similar to that flow.
Has Autority - does not always mean server. It’s better to use the “Is Server” function, which explicitly returns where we are.
If I’m not mistaken, you can also connect to the match there, which started recently, so there is still a chance to miss something. Not to mention that the RPC event may simply not work due to connection errors.
There were instances where Switch Has Authority wasn’t available and had do make some changes to get the same effect, meaning be sure it ran on server only. I really thought that Switch Has Authority meant that true server, false client, as that is what I saw in a video or some post, can’t remember, it was a long time ago, and since then I used it with that in mind…
Now Is Server is a lot better, as that is available in those situations were Switch Has Authority isn’t and makes those situations (in my case) a lot easier, I can simplify the code/nodes.
Maybe the node Is Server wasn’t available then (it’s been like 3 years since I started playing with UE, and 1.5 since I actually started working on my game, a new fresh project), or maybe the one that posted didn’t knew that well what they were talking about?! I really don’t know. But if I’m to believe Gemini/ChatGPT that node was added in 2016/2017, so it might just be the latter.
So yeah, thanks for that observation, it will really be useful!
Don’t worry, I understood you, and I do have some situations where I have variables for replication were users can connect later (like lobby elements for example). I only wanted to explain that in my case, inside the maps that players actually have the action and dynamic elements (and everything truly matters), that is not an issue.
Yeah, from a professional standpoint I should do it right, but I’m the sole developer of the game, so some elements are going to be more “relaxed”.