Announcement

Collapse
No announcement yet.

[Fixed] Persistent level doesn't exists

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [Fixed] Persistent level doesn't exists

    Hello,

    I'm experiencing an issue with level grid volumes

    Log: World exists but PersistentLevel doesn't for LevelGridVolume_1_00x00y, most likely caused by reference to world of unloaded level and GC setting reference to NULL while keeping world object
    Log:
    Log: World LevelGridVolume_1_00x00y.TheWorld is not referenced
    Log: Shortest reachability from root to World LevelGridVolume_1_00x00y.TheWorld:
    Log: World LevelGridVolume_1_00x00y.TheWorld [target]
    Log: Wall Grid32x32.TheWorld:PersistentLevel.Wall_0 (ObjectProperty basalt.Entity:VisualConfiguration.MIC)
    Log:
    Log:
    Log: World LevelGridVolume_1_00x00y.TheWorld [target]
    Wall Grid32x32.TheWorld:PersistentLevel.Wall_0 (ObjectProperty basalt.Entity:VisualConfiguration.MIC)

    This doesn't make the game crash, but it makes the game lag to death.
    It happens pretty much often. My map is a simple 2*2 grid levels.

    I found really weird that a streamed level can't retrieve an actor from the persistent level.
    Is there a way to catch the unloading event so I might try to clean up those reference ?

    What further information would you need to see where this can come from ?

    Thanks.

    #2
    This is issue isn't related only to LevelGridVolume : (

    It is related to streaming. Even with regular StreamingVolume:

    Code:
    Log: World exists but PersistentLevel doesn't for c5, most likely caused by reference to world of unloaded level and GC setting reference to NULL while keeping world object
    Log: 
    Log: World c5.TheWorld is not referenced
    Log: Shortest reachability from root to World c5.TheWorld:
    Log:    World c5.TheWorld [target]
    Log:    Wall Grid64x64.TheWorld:PersistentLevel.Wall_863  (ObjectProperty basalt.Entity:VisualConfiguration.MIC)
    Log: 
    Log: 
    Log:    World c5.TheWorld [target]
       Wall Grid64x64.TheWorld:PersistentLevel.Wall_863  (ObjectProperty basalt.Entity:VisualConfiguration.MIC)

    I'm spawning actors on the persistent level, without meshes (invisible).
    And on the non persistent levels, Actors (visual) in there will attach to the corresponding cell actor.

    They do the attach in the prebeginplay (the same issue happen with postbeginplay)
    Code:
    //Register to the map
    //And attach it's role to itself
    function PreBeginPlay()
    {
    	local Entity e;
    	//Here tile become visible
    
    	if(map==none)
    		map=BasaltGame(WorldInfo.Game).getMap();
    
    	ID = map.Id(Location.X/`TileSize,Location.Y/`TileSize);
    	if(ID>-1){
    		map.meshMap[ID] = self;
    		//`log(self$" become visible at loc:"$location);
    		e = map.getEntityId(ID);
    		if(e!=none){
    			e.attachTile(self);
    		}
    	}
    }
    This is clearly a bug I can't solve. I've been monkeying a lot to find a workaround, but could not.
    Is there anyway to let my actors in non persistent level find back a link to the persistent level ??

    Comment


      #3
      I've pinpointed where the issue come from more precisely, but still I have no fix.

      Code:
      Log: World exists but PersistentLevel doesn't for 32x32_1, most likely caused by reference to world of unloaded level and GC setting reference to NULL while keeping world object
      Log: 
      Log: World 32x32_1.TheWorld is not referenced
      Log: Shortest reachability from root to World 32x32_1.TheWorld:
      Log:    World 32x32_1.TheWorld [target]
      Log:    Wall Map32x32.TheWorld:PersistentLevel.Wall_0  (ObjectProperty Basalt.Tiles:VisualConfiguration.MIC)
      Log: 
      Log: 
      Log:    World 32x32_1.TheWorld [target]
         Wall Map32x32.TheWorld:PersistentLevel.Wall_0  (ObjectProperty Basalt.Tiles:VisualConfiguration.MIC)

      The persistents 'cell actors' maintain a struct:
      Code:
      struct VisualConfiguration
      {
      	var StaticMesh SM;
      	var Material Mat;
      	var int neighborConfiguration;
      	var rotator unrealRotation;
      
      	var MaterialInstanceConstant mic;
      	var bool micInitiated;
      	structdefaultproperties
          {
            neighborConfiguration=-1
          }
      
      };
      var VisualConfiguration VC;
      So persistent actors can still updated themself without the meshes from the non persistent worlds. It works pretty good. However the previous mentioned bug is triggered because of the material instance constant in this structure.
      When a non persistent mesh actor wake up, it attach its cell actor to itself, calling attach:
      Non_persistant_actor::PrebeginPlay call persitent_actor::attachTile(reference to the non persistent actor)

      Code:
      //TileMesh management
      //===============================================
      function attachTile(TileMeshActor t)
      {
      	local actor crash;
      	myTile = t;
      	t.job = self;
      	VC.micInitiated=false;
      	updateTile();
      }
      function updateTile()
      {
      	local vector translation;
      	if(myTile==none)
      		return;
      
      	translation.Z=upperLayer?256:0;
      	myTile.myMesh.SetStaticMesh(VC.SM,true);
      	myTile.myMesh.SetMaterial(0,VC.Mat);
      	UpdateMaterialInstance();
      	myTile.myMesh.SetRotation(VC.unrealRotation);
      	myTile.myMesh.SetTranslation(translation);
      }
      
      function detachTile()
      {
      }
      
      // Material management
      //===============================================
      function UpdateMaterialInstance()
      {	
         if(!VC.micInitiated)
      		InitMaterialInstance();
         VC.mic.SetScalarParameterValue('selected',selected?1:0);
       }
      
      function InitMaterialInstance()
      {
      	if(myTile!=none){
      		VC.micInitiated = true;
      		VC.mic=myTile.myMesh.CreateAndSetMaterialInstanceConstant(0);
      	}
      }

      The issue is triggered by the line : VC.mic=myTile.myMesh.CreateAndSetMaterialInstanceC onstant(0);

      If I comment this line, my game runs fine with level streaming. But of course, I need it so non persistent actors do not lose their materials setup.

      Weirdest fact ever:
      If I comment the line, my breakpoints (placed previous to this line) in VS work fine. However if not, I get the game cycling with the error log and my breakpoints are never triggered (While I'm 100% sure the issue come from this line).

      Comment


        #4
        Seems fixed, by manualy deleting the reference each time it update.

        Code:
        function UpdateMaterialInstance()
        {	
           if(!VC.micInitiated)
        		InitMaterialInstance();
           VC.mic.SetScalarParameterValue('selected',selected?1:0);
           VC.mic=none;
           VC.micInitiated=false;
         }
        But it is absolutely not performant

        Comment

        Working...
        X