Hero6
Hero6 copied to clipboard
[Engine] Improved room loading
MonoGame supports extending the Pipeline Content importer tool with custom data types and such. We should consider looking into improving our Room loader, the room loads walk maps, region maps, etc. with a lot of double storage to achieve this. A lot of this is because the maps are stored and imported as images/textures, however textures are loaded into GPU, and has to be loaded back to code, resulting in double storage. If we extend the Pipeline tool we can implement direct loading of these data maps, and also get a clean logical separation of code.
public override sealed void Load()
{
this.background = this.Content.LoadTexture2D(this.backgroundID);
this.walkAreaMask = this.Content.LoadTexture2D(this.walkAreaID);
this.walkAreaBuffer = CopyTextureData(this.walkAreaMask);
this.walkAreaNodes = this.CreateWalkNodes();
foreach (Node walkAreaNode in this.walkAreaNodes)
{
walkAreaNode.Children = this.FindNeighbors(walkAreaNode);
}
this.hotspotsMask = this.Content.LoadTexture2D(this.hotSpotMaskID);
this.hotspotMaskBuffer = this.FindHotspots(this.hotspotsMask);
this.InitializeEvents();
}