Visually represent a 100x100 Array without 10,000 Sprites

  • Hello!

    I am working on a game using an Array as the "map" of sorts. The Array stores data for each "sector" (xy position) if it's been visited, or generates a procedural "room" at that co-ordinate if it has not been visited before.

    I'm trying to figure out an efficient way to visually represent this array as a map. At present I am creating 10,000 sprites and setting each sprite's frame to represent the visited/unvisited/currently at state of that position in the array. This is wildly inefficient and I am having a bit of trouble thinking of a better way to visually represent the array.

    I thought about using a Tilemap. Would that be more efficient when it comes to load times? Right now the game hitches up when I hit the map button, for about half a second, then loads the sprites.

    I'd love suggestions if anyone has them!

    Thanks!

  • Use a Tilemap.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • A tile map may be your best bet. Another thing you could look into is having one big map image and having 1 sprite instanced as needed. It'd contain a basic frame to represent the information you want to show. Like maybe a translucent black overlay to show as visited.

  • You could try the canvas plugin and draw the required info.

  • I'm going to give the Tilemap a shot. Hopefully it will work... I am using instance variables on the "map square" sprites at the moment to ensure the data is arranged properly. For some reason when I was purely relying on the Array.Cur(X/Y/etc...) it was putting x1y1 in the position of x1y99 and other weird configurations.

  • Tilemap was the definite solution... much more straight forward since the tilemap works with xy co-ordinates.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)