I understand how the replication works but I don’t know what I should do and not do.
For example, I use the nav. system to determinate how someone should move. That has to be called on the server/authority but then what should I send to the clients ? Navigation path ? Next tick location of characters ? Buffer of locations for the X next ticks ?
My issues comes with things that theoretically only need inputs at creation and then could be calculated by each clients until being destroyed. Projectiles, movement (nav. system), level timer or pseudo-random events determined with a seed.
Should I do everything on the clients
and send only the strict necessary
from the server and hope for the best
Should I do the above but every X
ticks I check if everyone is up to
Should I not do any computing
of those things on clients at all ?
I don’t expect a perfect answer but a “things to not do” and “be careful of” would be great
You shouldn’t do something on each tick server wise and client, do it on each update, it would be really bad optimization if you do a tick hook. As you said, only necessary bits needed to be extracted to the client from server, so you send too many packets over server. So yea be careful with doing something each tick, but instead do it when something updates. For example with the player movement and navigation, when something happens with the navigation path or player movement, do a hook to control new values and such. I don’t know if this helps mate, but I just talk from experience, if you do like you say it would be a bad thing
And should I try to compute everything on the client ? Or compute on the server and send the result to the clients ?
For example if I throw a projectile I only need starting location, direction, speed and who thrown it. Should I only give those and let the clients compute OR should I compute on the server every update and send the results. The clients would just update the projectile.
Yea exactly, if something needs to be showed to the client for instance the projectile. The server controls where it is and sends it to the client to synchronize them together. Never trust the client and keep it server sided Update on server and send values that controls the visuals to the client. Glad I could help I just started using the UE4 Answerhub and it seems like a good community.