Differences between UEFN Live Mode and Published Islands

Hi Everyone,

I am close to publishing a game where players can score goals. After the goal, there is a short pause where the scoring player can run around and celebrate. When that period is over, all players should respawn.

It works fine in UEFN Edit/Live Sessions with the other contributor on my team and I testing. In the UEFN session, both players are eliminated prompting them to respawn at the same time and resume play.

However, when I publish the island (it is unlisted now), only the player that scores the goal is the one that respawns, and I cannot figure out why. I don’t think it will help, but the island code is: 4195-8467-3857. You’ll really need two players to see the bug. Note that once you get the ball, you’ll have to press what is likely your zoom button (right mouse click) to charge up a shot.

I have hundreds of hours into this at this point. I’ve debugged a LOT of stuff in my time. But when there’s different behaviors between dev and prod environments with no error codes, it really puts the developer in a bad spot. I simply have no idea what to do other than to beg for help.

Below is the relevant code. Note that for EliminateAllPlayers. Note I have tried versions of that function with suspend, without suspend. And I also have tried versions with Sleep functions sprinkled around to wait for the call stack to clear between instructions. Nothing seems to make a difference when published.

Thanks in advance!

# Handle post goal functions and setup up the next round
    PostGoal(Agent:agent, ScoringTeamIndex: int)<suspends>:void=
        # Print("PostGoal executed")
        DisableBallTrigger.Trigger()
        BallRespawnTimer.Reset()
        GameTimer.Pause()

        set IsCelebratingGoal = true

        # Stasis args
        NonScoringStasisArgs : stasis_args = stasis_args{ AllowTurning:= false, AllowEmotes:= false, AllowFalling:= true }
        ScoringStasisArgs : stasis_args = stasis_args{ AllowTurning:= true, AllowEmotes:= true, AllowFalling:= true }
        
        Players := GetPlayspace().GetPlayers()
        
        for(Player: Players, FC := Player.GetFortCharacter[]):
            if:
                ScoringAgent := PreviousPlayerWithBall?
                ScoringFC := ScoringAgent.GetFortCharacter[]
                ScoringAgent = FC.GetAgent[]
            then:
                ChangePlayerSpeed(Player, "normal")
            else:
                FC.PutInStasis(NonScoringStasisArgs)

        set PreviousPlayerWithBall = false
        set PlayerWithBall = false
        
        Sleep(10.0) # Celebration time
        spawn{EliminateAllPlayersAsync()}
        Sleep(6.0) # Sleep for 6 seconds (respawn timer)
        State.SetPlayerWithBall(false)

        RoundStart() # Start the round
    
    EliminateAllPlayers()<suspends>:void =
        Players := GetPlayspace().GetPlayers()
        for(Player: Players, FC := Player.GetFortCharacter[]):
            FC.SetVulnerability(true)
            FC.SetHealth(99.9)
            FC.Damage(99.9)

Okay, a bit of an update. After trying all sorts of random things, I found the issue. It seems that in the development environment, players do not have to be in stasis for the EliminatePlayers function to work, but live Islands, it does. So, I had to update the function to remove the player from stasis before setting vulnerability, setting the health, and damaging them.

Why it worked in UEFN but not a live island is beyond me. I don’t know if it was a race condition that only manifested in the live environment, or if it was an actual difference in execution.