Our UE 4.27 project uses the Gameplay Ability System. In our project, the player can swap between controlling different pawns in a similar fashion to a game like Dragon Age: Origins. When the player swaps, an AI Controller takes over management of the other pawns, firing off abilities automatically during combat.
The problem with this is that it fails to work in a networked environment. The behavior we see is that when Player 2 swaps from controlling Character A to controlling Character B, Player 1 can see the abilities that the AI controlling Character A is firing, but Player 2 cannot. In other words, the abilities fired by the AI on Character A don’t replicate to Player 2 but do replicate to other clients. The most visible result is that montages do not play on the client for Player 2, or you get the error Can't activate LocalOnly or LocalPredicted ability
.
After lots of debugging, it appears that this is because the AbilityActorInfo
is stale on Player 2’s client – from Player 2’s machine, the ASC in Character A still thinks that Player 2’s PC is controlling Character A even though it’s not. This is because OnRep_Controller
is never invoked on Character A when its controller is changed to null
before being changed over to the AI Controller, so Player 2’s client never refreshes the ability actor info.
I believe that UE-78453 is the bug that would have fixed this, but it was marked as a “Won’t Fix”. Why? Why can’t the engine replicate a null
controller back to a client that is losing network authority for a pawn?