I'd like to have my character's energy bar to slowly drain while a certain ability is active. I know I can use the delta time on the tick to get a smooth drain, but since it is a multiplayer game and that variable is replicated, wouldn't this cause some traffic issues? Is there a 'right' way to do something like this?
Announcement
Collapse
No announcement yet.
Energy Drain over a network
Collapse
X
-
Having the energy drain in a Function would enable you to use a Timer on it so that it is tracked more accurately.
Set Timer, put the EnergyDrain Function on it, set it to a time you want. Stop/Pause/Clear Timer to stop it when you don't want it to drain anymore.
The engine will automatically tick it off at the set intervals, leaving your code to do other things with its Time.
-
Network traffic which stated in UE as 'Replication' is not working that way. You can drain your energy millions of time per frame and make it replicate(update) once every second. This is will be heavy on server-side CPU,as it will do many calculations every frame,but will be relatively lighter on network,as server sending a few numbers every second.
In reverse;you can set your drain happens (let's just say) 1 point every hour but make it replicate 1000 times every second. This will be virtually weightless on CPU but will hurt your network transfer capacity.
Comment
-
Originally posted by Ariakus View PostNetwork traffic which stated in UE as 'Replication' is not working that way. You can drain your energy millions of time per frame and make it replicate(update) once every second. This is will be heavy on server-side CPU,as it will do many calculations every frame,but will be relatively lighter on network,as server sending a few numbers every second.
In reverse;you can set your drain happens (let's just say) 1 point every hour but make it replicate 1000 times every second. This will be virtually weightless on CPU but will hurt your network transfer capacity.
Comment
-
Originally posted by _cDub View PostOkay, I see now. So variables aren't updated on the client each time it changes? It works more on an interval, and between those intervals anything can happen that the clients aren't necesarily guaranteed to know about?Marketplace Assets
Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support ThreadMultiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support ThreadMinesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread
Comment
-
Yes,clients can miss information in certain circumstances. If someone dies and if it doesn't replicate on client,that client will see that person is still alive. However client will not be able to do damage or etc. So dead person will stay look alive forever. There is a 'RepNotify' function for this. Jamen's idea is a very good one. Try it out. Also you should check Epic's Official Tutorials about networking on Youtube. They will allow you to grip the basics.
Comment
Comment