Skip to content

[Engine] Improved room loading #129

Open
@persn

Description

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();
      }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions