The correct way to replicate a building
I am a bit puzzled and would just like some feedback on witch method is correct. my character can place a building and this replicates the placed building across the network. after executing on the server
now my question: if the building is already replicated what would be the best method for the following (both work).
Building one is a battery (collects power- has variable (currentpower and maxpower)) Building 2 is a generator it stores +1 power every second into the battery.
Method 1: no additional replication the generator is running the +1 power every event tick. and stores it successfully.
Method 2: generator calls an event on the battery to increase storage by +1 every second, this runs on the server and replicates to clients (using replicated variables (currentpower and maxpower)).
what would be considered the correct approach? as it feels like i am replicating twice: first when built and then on updates, but my understanding of networking is still a bit unclear hence the question
Thank you :)
asked Jun 07 '16 at 03:32 PM in Blueprint Scripting
spawn a building on server, call multicast to spawn on clients.
add +1 power on a timer in both client and server machines, (No replication)
when power fills up or gets used, do that on the server, and multicast to clients. if power fills up on client, stop adding +1 to power, but don't trigger any "fully powered" events until the server version is filled.
so the server does all the important stuff, but the client adds their own power over time, just as a visual effect that estimates what is going on in the server. when an actor does this kind of client side estimation, it is known as a simulated proxy.
Follow this question
Once you sign in you will be able to subscribe for any updates here