Verse runtime error after an hour of playtime

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Stability

Summary

Ranked hud verse code causes a runtime error after an hour of playtime. The code used was shared in a server and no one else seems to have the problem but me. Every attempt to stop this error from happening failed.

Steps to Reproduce

Play the server anywhere from an hour to an hour and 40 minutes to see the error occur. I think having more players speeds up the process. The map timer might stop the error from happening sometimes.

Expected Result

Very laggy gameplay after a verse runtime error popup asking players to leave.

Observed Result

unplayble laggy mess.

Platform(s)

All platforms

Island Code

1981-7346-4028

Additional Notes

Am willing to show the entire verse code since its a public one.

Can you share the code? I’m noting similar issues on very different situations.

its two codes that work together.

#Made by Oleszyk
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /Verse.org/Random }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/UI }
using { /Fortnite.com/UI }
using { /UnrealEngine.com/Temporary/SpatialMath}
using { /Verse.org/Colors }
using { /Verse.org/Colors/NamedColors }
using { /Verse.org/Simulation/Tags }
using { /Verse.org/Assets }

RankProgressBar := class():
ProgressBarColorBase : color_block = color_block{
DefaultColor := MakeColorFromHex(“000000”)
DefaultDesiredSize := vector2{X:= 202.0, Y := 43.0}}

var ProgressBarColorTop<private> : color_block = color_block{}  
var Overlay<private> : overlay = overlay{}
    
PBarTitleTextBlock<private> : text_block = text_block{DefaultTextColor := MakeColorFromHex("FFFFFF")}

HPTitleText<private><localizes>(HPText : string) : message = "{HPText}"

Init(Current : int, Goal : int):void=
    PBarTitleTextBlock.SetText(HPTitleText("{Current}/{Goal}"))


UpdateWidthAndText(iCurrent : int, Goal : int):void=
    var NewCurrent : float = iCurrent * 1.0
    var NewGoal : float = Goal * 1.0

    RankPercentage := NewCurrent / NewGoal
    BarSize := ProgressBarColorBase.DefaultDesiredSize
    NewHealthBarWidth := BarSize.X * RankPercentage
    if (Current := float[NewGoal], Total := float[NewGoal]):
        PBarTitleTextBlock.SetText(HPTitleText("{iCurrent}/{Goal}"))

    UpdateHealthBar(NewHealthBarWidth)

ShowUIForPlayer(Player : player):void=
    if (PlayerUI := GetPlayerUI[Player]):
        if (Fortchar := Player.GetFortCharacter[]):
            if (Instigator : agent = Fortchar.GetAgent[]):
                PlayerUI.AddWidget(CreateUI(Instigator))

UpdateHealthBar(NewWidth : float):void=
    Overlay.RemoveWidget(PBarTitleTextBlock)
    Overlay.RemoveWidget(ProgressBarColorTop)
    set ProgressBarColorTop = CreateTopHealthBar(NewWidth)

    Overlay.AddWidget(CreateOverlaySlot(ProgressBarColorTop, horizontal_alignment.Left))
    Overlay.AddWidget(CreateOverlaySlot(PBarTitleTextBlock,horizontal_alignment.Center))
    
CreateOverlaySlot<private>(TheWidget : widget, HAlignment : horizontal_alignment):overlay_slot=  
    overlay_slot:
        Widget := TheWidget 
        HorizontalAlignment := HAlignment

CreateTopHealthBar<private>(Width: float):color_block=
    ColorBlock := color_block{
        DefaultColor := MakeColorFromHex("00eeff")
        DefaultDesiredSize := vector2{X:= Width, Y := 43.0}} 
    
    set ProgressBarColorTop = ColorBlock
    

CreateOverlay<private>(Agent : agent) : overlay=
    TheOverlay := overlay:
        Slots := array:
            overlay_slot:
                Widget := ProgressBarColorBase
            overlay_slot:
                Widget := CreateTopHealthBar(1200.0)
            overlay_slot:
                Widget := PBarTitleTextBlock
    set Overlay = TheOverlay


CreateUI<private>(Agent : agent) : canvas=
    TheCanvas : canvas = canvas:
        Slots := array:
            canvas_slot:
                Anchors := anchors{Minimum := vector2{X := 0.175149, Y := 0.833333}, Maximum := vector2{X := 0.175149, Y := 0.833333}}
                Offsets := margin{Top := -20.0, Left := -96.0, Right := 0.0, Bottom := 0.0}
                Alignment := vector2{X := 0.0, Y := 0.0}
                Widget := stack_box:
                    Orientation := orientation.Vertical
                    Slots := array:
                        stack_box_slot:
                            Widget := CreateOverlay(Agent)
                        
                                                            
    return TheCanvas

AllSpawners := class(tag){}

RankSystem := class(creative_device):

var PlayerMap : [agent]PlayerVariable = map{}

#Change names to your texture ones

@editable EliminationTracker : tracker_device = tracker_device{}

Unreanked : texture = ImagesRankj.Unranked

Bronze1 : texture = ImagesRankj.Bronze_1

Bronze2 : texture = ImagesRankj.Bronze_2

Bronze3 : texture = ImagesRankj.Bronze_3

Silver1 : texture = ImagesRankj.Silver_1

Silver2 : texture = ImagesRankj.Silver_2

Silver3 : texture = ImagesRankj.Silver_3

Gold1 : texture = ImagesRankj.Gold_1

Gold2 : texture = ImagesRankj.Gold_2

Gold3 : texture = ImagesRankj.Gold_3

Plat1 : texture = ImagesRankj.Platinum_1

Plat2 : texture = ImagesRankj.Platinum_2

Plat3 : texture = ImagesRankj.Platinum_3

Diamond1 : texture = ImagesRankj.Diamond_1

Diamond2 : texture = ImagesRankj.Diamond_2

Diamond3 : texture = ImagesRankj.Diamond_3

Elite : texture = ImagesRankj.ELITE_1

Champion : texture = ImagesRankj.Champ_1

Unreal : texture = ImagesRankj.Unreal_1




InitSpawners():void=
    Spawners := GetCreativeObjectsWithTag(AllSpawners{})
    for (Obj : Spawners):
        if (Spawner := player_spawner_device[Obj]):
            Spawner.SpawnedEvent.Subscribe(OnPlayerAdded)

# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=

    # TODO: Replace this with your code
    InitSpawners()
    GetPlayspace().PlayerRemovedEvent().Subscribe(OnPlayerRemoved)
    Sleep(0.3)
    AlllPlayers := GetPlayspace().GetPlayers()
    for(Player : AlllPlayers):
        OnPlayerAdded(Player)

OnPlayerAdded(Agent : agent):void=
   if (PlayerObj := player[Agent]):
        if (PlayerExists := PlayerMap[Agent]):

        else:
            PV : PlayerVariable = PlayerVariable{AgentOB := Agent}

            PV.RankBar.Init(PV.GetCurrentValue(), PV.GetCurrentGoal())

            PV.RankBar.ShowUIForPlayer(PlayerObj)

            spawn{MakeCurrentValue(Agent)}


            spawn{RankedLoopHudMessage(Agent, PlayerObj)}

            
        
            option:
                set PlayerMap[Agent] = PV





MakeCurrentValue(Agent : agent)<suspends>:void=
    loop:
        Sleep(0.01)
        if (PV : PlayerVariable = PlayerMap[Agent]):
            PV.SetCurrentValue(EliminationTracker.GetValue(Agent))
            PV.RankBar.UpdateWidthAndText(PV.GetCurrentValue(), PV.GetCurrentGoal())


RankedLoopHudMessage(Agent : agent, Player : player)<suspends>:void =

    RankTextureBlock : texture_block = texture_block{DefaultImage := Unreanked, DefaultDesiredSize := vector2{X := 390.0, Y := 130.0}}

    loop:
        Sleep(0.01)
        if (EliminationTracker.GetValue(Agent) >0 ):
            if (PV : PlayerVariable = PlayerMap[Agent]):
                PV.SetCurrentGoal(10)
                RankTextureBlock.SetImage(Unreanked)
                NewCanvas : canvas = canvas:
                    Slots := array:
                        canvas_slot:
                            Widget := RankTextureBlock
                            Anchors := anchors{Minimum := vector2{X := 0.15, Y := 0.8}, Maximum := vector2{X := 0.15, Y := 0.8}}
                            Offsets := margin{Top := -60.0,Left := -212.0, Right :=0.0, Bottom :=0.0}
                            Alignment := vector2{X := 0.0, Y := 0.0}           
                if (PlayerUI := GetPlayerUI[Player]):
                    PlayerUI.AddWidget(NewCanvas)
                break
    loop:
        Sleep(0.01)
        if (EliminationTracker.GetValue(Agent) >= 10):
            if (PV : PlayerVariable = PlayerMap[Agent]):
                PV.SetCurrentGoal(20)   
                RankTextureBlock.SetImage(Bronze1) 
                break
    loop:
        Sleep(0.01)
        if (EliminationTracker.GetValue(Agent) >= 20 ):
            if (PV : PlayerVariable = PlayerMap[Agent]):
                PV.SetCurrentGoal(30)   
                RankTextureBlock.SetImage(Bronze2) 
                break
    loop:
        Sleep(0.01)
        if (EliminationTracker.GetValue(Agent) >= 30 ):
            if (PV : PlayerVariable = PlayerMap[Agent]):
                PV.SetCurrentGoal(50)   
                RankTextureBlock.SetImage(Bronze3) 
                break
    loop:
        Sleep(0.01)
        if (EliminationTracker.GetValue(Agent) >= 50):
            if (PV : PlayerVariable = PlayerMap[Agent]):
                PV.SetCurrentGoal(70)   
                RankTextureBlock.SetImage(Silver1) 
                break
    loop:
        Sleep(0.01)
        if (EliminationTracker.GetValue(Agent) >= 70 ):
            if (PV : PlayerVariable = PlayerMap[Agent]):
                PV.SetCurrentGoal(90)   
                RankTextureBlock.SetImage(Silver2) 
                break
    loop:
        Sleep(0.01)
        if (EliminationTracker.GetValue(Agent) >= 90):
            if (PV : PlayerVariable = PlayerMap[Agent]):
                PV.SetCurrentGoal(120)   
                RankTextureBlock.SetImage(Silver3)
                break
    loop:
        Sleep(0.01)
        if (EliminationTracker.GetValue(Agent) >= 120):
            if (PV : PlayerVariable = PlayerMap[Agent]):
                PV.SetCurrentGoal(150)   
                RankTextureBlock.SetImage(Gold1)
                break
    loop:
        Sleep(0.01)
        if (EliminationTracker.GetValue(Agent) >= 150):
            if (PV : PlayerVariable = PlayerMap[Agent]):
                PV.SetCurrentGoal(180)   
                RankTextureBlock.SetImage(Gold2)
                break
    loop:
        Sleep(0.01)
        if (EliminationTracker.GetValue(Agent) >= 180):
            if (PV : PlayerVariable = PlayerMap[Agent]):
                PV.SetCurrentGoal(220)   
                RankTextureBlock.SetImage(Gold3)
                break
    loop:
        Sleep(0.01)
        if (EliminationTracker.GetValue(Agent) >= 220):
            if (PV : PlayerVariable = PlayerMap[Agent]):
                PV.SetCurrentGoal(260)   
                RankTextureBlock.SetImage(Plat1)
                break
    loop:
        Sleep(0.01)
        if (EliminationTracker.GetValue(Agent) >= 260):
            if (PV : PlayerVariable = PlayerMap[Agent]):
                PV.SetCurrentGoal(300)   
                RankTextureBlock.SetImage(Plat2)
                break
    loop:
        Sleep(0.01)
        if (EliminationTracker.GetValue(Agent) >= 300):
            if (CP : PlayerVariable = PlayerMap[Agent]):
                CP.SetCurrentGoal(350)   
                RankTextureBlock.SetImage(Plat3)
                break
    loop:
        Sleep(0.01)
        if (EliminationTracker.GetValue(Agent) >= 350):
            if (PV : PlayerVariable = PlayerMap[Agent]):
                PV.SetCurrentGoal(400)   
                RankTextureBlock.SetImage(Diamond1)
                break
    loop:
        Sleep(0.01)
        if (EliminationTracker.GetValue(Agent) >= 400):
            if (PV : PlayerVariable = PlayerMap[Agent]):
                PV.SetCurrentGoal(450)   
                RankTextureBlock.SetImage(Diamond2)
                break
    loop:
        Sleep(0.01)
        if (EliminationTracker.GetValue(Agent) >= 450):
            if (PV : PlayerVariable = PlayerMap[Agent]):
                PV.SetCurrentGoal(510)   
                RankTextureBlock.SetImage(Diamond3)
                break
    loop:
        Sleep(0.01)
        if (EliminationTracker.GetValue(Agent) >= 510):
            if (PV : PlayerVariable = PlayerMap[Agent]):
                PV.SetCurrentGoal(570)   
                RankTextureBlock.SetImage(Elite)
                break
    loop:
        Sleep(0.01)
        if (EliminationTracker.GetValue(Agent) >= 570):
            if (PV : PlayerVariable = PlayerMap[Agent]):
                PV.SetCurrentGoal(640)   
                RankTextureBlock.SetImage(Champion)
                break
    loop:
        Sleep(0.01)
        if (EliminationTracker.GetValue(Agent) >= 640):
            if (PV : PlayerVariable = PlayerMap[Agent]):   
                RankTextureBlock.SetImage(Unreal)
                break



OnPlayerRemoved(PlayerLeft : agent):void =
    if (Agent := agent[PlayerLeft]):
        if (ActualPlayer := PlayerMap[Agent]):
            var TempAllPlayersMap : [agent]PlayerVariable = map{}
            for (Key -> Value : PlayerMap, Key <> Agent):
                set TempAllPlayersMap = ConcatenateMaps(TempAllPlayersMap, map{Key => Value})
            
            set PlayerMap = TempAllPlayersMap

Second code

#Made by Oleszyk
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Fortnite.com/Characters }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /UnrealEngine.com/Temporary/UI }
using { /Verse.org/Assets }

PlayerVariable := class():
AgentOB : agent

RankBar : RankProgressBar = RankProgressBar{}

var CurrentGoal : int = 10

var CurrentValue : int = 0

GetCurrentGoal() : int =
    return CurrentGoal

SetCurrentGoal(Change : int) : int =
    set CurrentGoal = Change

GetCurrentValue() : int =
    return CurrentValue

SetCurrentValue(Change : int) : int =
    set CurrentValue = Change

In the four error images, this is how many times they have occured.

top left: 21 times
bottom left: 5 times
top right: 4 times
bottom right: 1 time

Every error is verse overflow

Error players get

I’m having the exact same issues on a few of my codes. I believe the issue is in the API/backend, maybe when trying to attach the agent to the variable… Have you found a fix? I believe we need to wait for an update to fix it :confused:

I ended up completely removing the rank code I used since an updated version came out that didn’t have that issue.