I was able to find a workaround for our map (reduced cooking to just 2 minutes).
The idea is inspired by this comment: Session Launching is taking extremely long - #5 by Rory_REDGamesCo.
It seems that default values assigned to device fields are indeed related to the problem. The delay somehow scales with number of device references, especially between our complex custom devices.
Since in our project we are using @editable
, it was not possible to use something like var MyDevice : ?my_device_device = false
(as mentioned in above comment). @editable
does not support option
types (?...
).
I ended up writing is a helper like this:
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
GetDeviceFromRef<internal>(Ref: []t, TypeName: string, Stub: tuple() -> t where t:type): t =
if (Device := Ref[0]):
return Device
Print("{TypeName}_ref was not initialized")
return Stub()
my_custom_device_ref := class<concrete><final>:
@editable Ref: []my_custom_device = array{}
Device(): my_custom_device =
return GetDeviceFromRef(Ref, "my_custom_device", Stub)
Stub(): my_custom_device = my_custom_device {}
my_other_custom_device_ref := class<concrete><final>:
@editable Ref: []my_other_custom_device = array{}
Device(): my_other_custom_device =
return GetDeviceFromRef(Ref, "my_other_custom_device", Stub)
Stub(): my_other_custom_device = my_other_custom_device {}
... # repeat for each device type, fortunately it isn't much to copy
Then when managing references between devices, instead of
@editable MyDevice: my_custom_device = my_custom_device {}
...
MyDevice.DoSomething()
We changed to
@editable MyDeviceRef: my_custom_device_ref = my_custom_device_ref {}
...
MyDeviceRef.Device().DoSomething()
Internally, Ref uses an array, so it can still be selected in editor.
Just not as convenient as you need to expand it:
Why a single-item array?
- It is supported by
@editable
, - The default value is an empty array and not a default device, which is faster and seems to solve the device creation issues
Of course this is a bit complex/inconvenient, but for now I’ll take it over 20 mins waits/timeouts.