MAJOR Pushing verse changes crashes verse when using weak_map

Please select what you are reporting on:

Unreal Editor for Fortnite

What Type of Bug are you experiencing?

Verse

Summary

It seems weak_map does not allow to save things containing a class. It yields this error LogVerse: Error: VerseRuntimeErrors: Internal error encountered. This happens when pushing verse changes, and not when pushing all changes. The problem happens when I try to acces the Team in playerdata as it prints “a” but never “b” see video. For now I would have to use a workaround that does not use the playerdata class but rather a build in datatype like int, to save my team

Steps to Reproduce

  1. Use this code in a verse file:
using { /Verse.org/Simulation }
playerdata := class():
    var Team:int = -1

var<public> PlayerData:weak_map(session,[agent]playerdata) = map{}
UpdateTeam(Agent:agent,Team:int):void={
    if (var Current:[agent]playerdata = PlayerData[GetSession()]):
        Print("a")
        if(set Current[Agent].Team = Team){
            Print("b")}
        else:
            Print("c")
            if(set Current[Agent] = playerdata{Team:=Team}){}

        if(set PlayerData[GetSession()] = Current){}
    else:
        if(set PlayerData[GetSession()] = map{Agent => playerdata{Team:=Team}}){}
}
  1. Create a verse device with this code:
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

testdevice := class(creative_device):
    OnBegin<override>()<suspends>:void=
        Print("           ")
        Print(" NEW ROUND ")
        Print("           ")
        for(Agent:Self.GetPlayspace().GetPlayers()):
            Print("Attempt update team")
            UpdateTeam(Agent,2)
            Print("Updated team")

  1. Link a button to end the round via round settings device
  2. In island settings change round limit to anything higher than 1, for example 2.
  3. Push changes and go in live edit
  4. Build verse code and PUSH VERSE CHANGES
  5. Start game
  6. End the round via button
  7. In the new round verse crashes at this part: if(set Current[Agent].Team = Team)

Expected Result

Verse does not crash

Observed Result

Verse crashes

Platform(s)

PC

Additional Notes

There were no compile errors or anything
image
Repro:

Please look into this, took me half a day to find what was wrong and make this bug report

This has been fixed in 26.10.

2 Likes

Thanks Lambda :scream_cat:

weak_map is completely broken, it no longer saves in between rounds, rendering them useless. In the next round all weak_maps are empty again. is this a known issue? It even happens in public games too

3 Likes

I can confirm this, weak_map no longer works and this is a game breaking bug for already uploaded, and presumably live, games.

1 Like
1 Like