I have a very strange thing happening in a series of BP’s that I can only describe as “leaking logic”.
I’m working on a 2 player turn-based game and I’m working in the basic start game and turn loop.
I start with
- Event OnPostLogin
- Get Num Players
- If the Player Count == 2
– Get All Player Controllers
– Cache All Player Controllers
– Assign an Index to each Player Controller - Start the Game
After Start Game, I call “Start Player Phase on CLIENT”
Here’s where things go wonky.
(Exec pins leaving the screenshot go to Print String nodes)
The Start Player Phase on Client seems to fire BEFORE the Start of the Game has been called on one of the Player Controllers:
The floats are “Get Game Time In Seconds” in the Print String.
The first OnTPC (OnTurnPhaseChanged) fires at 0.020533 Game Seconds.
Player Index of 999 is a debug default value which means the Player Controller is being accessed BEFORE it’s been indexed in OnPostLogin.
This code should be inaccessible until Start Game, and all controllers should be indexed before Start Game happens.
(The only notable point, which adds to the confusion, is that the print screens which are time stamped at 0.020… print to screen AFTER all the content at 0.978… yet the 999 index corraborates the early time stamp…)
But wait, it get’s weirder.
If I Disable “Start Game” this issue doesn’t happen.
This means that the “Start Game” is somehow responsible for calling StartGame and still involved in leaking the logic or executiong early… but the node itself doesn’t fire!?
I can’t figure out why, when Start Game is active, but not being called, logic AFTER that node fires, but when I disable the node, it doesn’t.