| world - a world loaded with LoadWorldAsync |
|
Returns why a loaded world has no network fingerprint, or "" if nothing went wrong. A world can load perfectly well for a single-player game and still be unfit for Shared World - for example when an optional model was missing, or a glTF buffer's URI cannot be fingerprinted. This tells you which, so you can fix the content. Returns "" when the fingerprint was made, while the world is loading, and for a world made with CreateWorld, which has no fingerprint. For a world that failed to load, read WorldLoadError instead. An invalid world handle is a runtime error. The answer is kept from loading and never retried: correct the content and load the world again to get a fingerprint. See also: WorldNetworkFingerprint, WorldLoadError, WorldReady, LoadWorldAsync. |
; WorldNetworkFingerprint Example
; -------------------------------
Graphics3D 640,480,0,2
SetBuffer BackBuffer()
; Three worlds: two loaded from files, and one made in code
playground=LoadWorldAsync("../../../samples/shared-world/playground.world")
marker=LoadWorldAsync("../../../samples/worlds/help-marker.world")
While WorldReady(playground)=0 Or WorldReady(marker)=0
If WorldLoadState(playground)=WORLD_LOAD_FAILED Then RuntimeError WorldLoadError(playground)
If WorldLoadState(marker)=WORLD_LOAD_FAILED Then RuntimeError WorldLoadError(marker)
UpdateAsyncLoads 2
Wend
made=CreateWorld()
shown=playground
name$="playground.world"
While Not KeyDown(1)
; 1 / 2 / 3 choose whose fingerprint to show
If KeyHit(2) Then
shown=playground
name="playground.world"
EndIf
If KeyHit(3) Then
shown=marker
name="help-marker.world"
EndIf
If KeyHit(4) Then
shown=made
name="a world from CreateWorld"
EndIf
; Both are kept from loading, so asking costs nothing
fingerprint$=WorldNetworkFingerprint(shown)
problem$=WorldNetworkFingerprintError(shown)
Cls
Text 0,0,"1 / 2 / 3: choose a world Esc: exit"
Text 0,20,"WorldNetworkFingerprint of "+name+":"
If fingerprint="" Then
Text 0,40," empty: this world cannot be shared"
Else
Text 0,40," "+Left(fingerprint,32)
Text 0,60," "+Mid(fingerprint,33)
EndIf
Text 0,80,"WorldNetworkFingerprintError: "+Chr(34)+problem+Chr(34)
Text 0,100,"Shared World players must load worlds with the same fingerprint"
Flip
Wend
FreeWorld made
FreeWorld marker
FreeWorld playground
End