@hplus0603
I will clarify the objectives that I'm trying to achieve:
I have 2 main requirements that the AI needs to follow through:
- Support root animations between client and server - relatively “easy” to achieve will expand on that later
- Support bot spawning at different maps without the host player along with its “server” component present at said scene - the reason this is currently an issue, is due to the existing code relying on unity's navigation system which in turn requires the Agent to exist in the scene so that it could navigate (which is in absolute contrast to the requirement)
I have thought of 2 options, neither seem to me to be better, so I hope to hear more opinions on the matter:
Option 1#:
The bot instances that are created will be entirely handled by the server - all decisions will take place there, and the results like will be sent to remote clients, similar to the way that player's inputs are handled by the server.
The server bot instance will also play animations/root animations during this time the clients that receive an input will not sync there movement - but play the animation as well and after the animation ends the position sync will be turned on. (I tested it on a few clients and this strategy seem to wok well without much effort)
Pros
- relatively easy to build
- the server bot instance will have better sync with root animations done by the client
- Authoritative
- No network required between a client and server for the decision making part of the AI
Cons
- the server will have visual awareness (animations)
- will make the 2nd requirement very hard to implement
Option 2#:
The 1st client to enter a scene will be the “owner” of said scene, meaning decision making will take place at client side, and the results will be sent to the server. (when that client leaves, 1 of the other clients in that scene will take it's place as the owner of said scene)
Pros
- point 2# won't be as hard to implement
- the server won't be aware of visual related data (animations)
- Easier load on the host player
Cons
- will require each scene owner, to send more traffic to the server
- scene owner lags will affect everyone in that scene
- recovery when a client lags, or exists the map will be hard to implement