I’m running into a problem with my A.I character set up where currently I’m having it detect a player via the sight perception stimulus and then focusing on that player with the SetFocus node and having the blackboard key actor being the target as shown here:
It has no issues on server side when checking with the debug tools, but the perception debugger trails behind on the client side. The A.I can still shoot and deal damage to the client player even though it looks like it’s not hitting them. The top video shows the server side and the bottom shows the client side:
I’ve checked that the A.I character BP is replicated and there’s no extra custom movement happening on the player that might cause a delay. I’ve checked the forums and documentation and other resources for a fix and haven’t come across anything. If there’s anything else I can provide to help figure out the problem let me know.
Character class uses CMC which has client-side prediction. This means clients are always ahead of the server with movement. AI is using what the server currently has, then replicating its action down to you.
Clients are 16ms + 50% ping ahead of the server… minimum.
Your view of the servers actions (AI etc) is server tick + 50% ping behind the server.
For AI shooting you want them to lead the shot based on the targets current velocity. Basically where are they going to be next server tick “if” they maintain current forward vector and velocity.
For the visual aspect on clients you can do an Multicast to have the AI sim do a fakey shot at the local clients real current position. Each sim copy of the AI will shoot at the targets current position in each simulation. The servers shot will handle damage and multicasting hit locations for FX.
I hope that I’m understanding what you wanted me to try, if there’s anything else that I need to change let me know.
I think the only thing I’m having a hard time understanding is how the client can be ahead of the server if the server is authoritative even if CMC provides client-side prediction. This is definitely the next big step in figuring out how to really grasp server-client structures so if there’s further resources that best help me understand that I’d love to know what I can look through!