Visually represent a 100x100 Array without 10,000 Sprites

Discussion and feedback on Construct 2

Post » Mon Dec 15, 2014 12:52 pm

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!
B
4
Posts: 15
Reputation: 232

Post » Mon Dec 15, 2014 2:19 pm

Use a Tilemap.
ImageImageImage
B
71
S
22
G
240
Posts: 3,734
Reputation: 133,994

Post » Mon Dec 15, 2014 2:57 pm

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.
B
6
S
2
Posts: 21
Reputation: 494

Post » Mon Dec 15, 2014 4:26 pm

You could try the canvas plugin and draw the required info.
B
48
S
16
G
9
Posts: 1,098
Reputation: 11,197

Post » Mon Dec 15, 2014 5:36 pm

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.
B
4
Posts: 15
Reputation: 232

Post » Fri Dec 19, 2014 1:48 pm

Tilemap was the definite solution... much more straight forward since the tilemap works with xy co-ordinates.
B
4
Posts: 15
Reputation: 232


Return to Construct 2 General

Who is online

Users browsing this forum: Domino3057, faulknermano and 9 guests