Hello!
I wrote a simple script that syncs AI Birds over TNet in my game. However I've noticed when there are about 20 or so birds flying in the air, the host stutters and drops frames once every 5 - 10 seconds. Profiler is pointing at the update() function that is causing the stutter, most likely the messages that get sent?
However, as I'm new to TNet and AI in general, I don't really know what is causing it. It seems I've gone about syncing up the position and rotation of the bird wrong OR TNet does not support a high number (20 or so) of objects that send messages.
Here is the script:
I understand if I decrease nextActionTime the more messages I send (which syncs up the objects faster). If I increase this number the fewer messages I'm sending. I understand the more messages I send leads to lag. However, I don't know if this is a good way of syncing up position and rotation and why TNet is stuttering on 20 or so objects OR if it's TNet not supporting that number?
Have I gone wrong about syncing up position and rotation on this script? What is the best way of handling something like this?
Thanks for your time!