Hi there, there seems to be a garbage collection bug / issue with how this plugin works with a dedicated server multiplayer (not replication).
Find sample project here: Microsoft OneDrive - Access files anywhere. Create docs with free Office Online.
Steps to reproduce without sample project:
- Create game mode with a simple PING-PONG state machine that switches from ping to pong (etc) every 1s.
- Launch FSM in BeginPlay (note that it’s not intended to be a replicating FSM, just a local FSM to the server in the game mode)
- OnTick log out “FSM is running: {0} in State {1}”
- Launch dedicated server using a command (with your UE4 path and IP address) such as
"C:\Program Files\Epic Games\UE_4.20\Engine\Binaries\Win64\UE4Editor.exe" "%CD%\..\FSMTest.uproject" ThirdPersonExampleMap?listen -server -log -nosteam -port=1234
- Launch client to connect to server using a command such as
"C:\Program Files\Epic Games\UE_4.20\Engine\Binaries\Win64\UE4Editor.exe" "%CD%\..\FSMTest.uproject" 192.168.1.157:1234 -game -ResX=1280 -ResY=720 -WinX=0 -WinY=20 -log -nosteam -WINDOWED
After about 20 seconds the FSM context gets garbage collected and you see a transition in the server log that looks like:
[2018.08.11-19.45.33:584][807]LogBlueprintUserMessages: [ThirdPersonGameMode_C_0] FSM is running: 1 in State Ping
[2018.08.11-19.45.34:583][837]LogBlueprintUserMessages: [ThirdPersonGameMode_C_0] FSM is running: 1 in State Pong
[2018.08.11-19.45.34:627][838]LogGCFSM: Error: Object ThirdPersonGameMode_C_0 is not running FSMs
[2018.08.11-19.45.34:698][840]LogBlueprintUserMessages: [ThirdPersonGameMode_C_0] FSM is running: 0 in State
What you see above is that** GetContext() in the FSM is failing because the weak pointer starts pointing to NULL** about 20s after the first client connects.