Question about Tilemap object

Discussion and feedback on Construct 2

Post » Mon Feb 17, 2014 1:44 pm

Hi,

I'm developing this dungeon-mining game with randomly-generated levels - capx below. Arrow keys to move, WASD to mine.

https://dl.dropboxusercontent.com/u/106247621/Greed-test/ProcGenDungeon.capx

I've been reading up about the new Tilemap object, which sounds like it's perfect for this project - I'm currently generating upwards of 7,500 tile sprites individually, so am I right in thinking using Tilemap would make this a lot more efficient and framerate-friendly?

As you can see from the capx, there's a fairly lengthy map generation process before the game actually begins - would I still be able to transpose all those events to the Tilemap object if I used it? I don't mind doing that at all if it would make everything more efficient, but I wanted to ask before I start doing that - is it right for a project like this that has random levels?

If someone could take a quick look at the project and let me know what they think I'd be really grateful - even after reading all the posts on it, I'm still a bit confused about what Tilemap actually is...
B
15
S
4
G
1
Posts: 286
Reputation: 1,988

Post » Mon Feb 17, 2014 2:35 pm

Yeah it's possible
Take a look a this
on layout sized 8192x8192 in my setup i have less then 90 object.
You could get only one tilemap for all tiles.
ImageImageImageImage
B
157
S
65
G
41
Posts: 2,594
Reputation: 34,748

Post » Mon Feb 17, 2014 3:52 pm

Sounds ideal! (I'm planning to add corridors and tunnels to mine too, let me know if you find any good methods for generating them!)

So the tiles are still treated as individual objects with the Tilemap (ie I can assign different variables, etc to different types of tile), and the Tilemap's effectively like an array that contains them? Just trying to get my head around how it works!
B
15
S
4
G
1
Posts: 286
Reputation: 1,988

Post » Mon Feb 17, 2014 4:11 pm

To be honest with you, I'v been studying your previous file version about making rooms xD. I'm dumb as hell with procedural level generation hehe

For your question. Not really, Tilemap is one object and all tiles in it are just different parts of image - every part have own id number. So you can't set variables for each tile.

However your file is ready for tilemap with your current array setup.
In event nr 31 for Map| Value at (x,y) = X you just need to change "create object" to Tilemap | Set tile (x,y) to tile X and its done.
And then you can use array to store all values for tiles (like variables for sprites) and use this values when something is happening to specific tile.
ImageImageImageImage
B
157
S
65
G
41
Posts: 2,594
Reputation: 34,748

Post » Mon Feb 17, 2014 6:16 pm

Just trying some things out with it, looks good... so should I actually be using two tilemaps, and set one as a solid for the walls and the other not for the floors?
B
15
S
4
G
1
Posts: 286
Reputation: 1,988

Post » Mon Feb 17, 2014 6:17 pm

Yes
ImageImageImageImage
B
157
S
65
G
41
Posts: 2,594
Reputation: 34,748

Post » Mon Feb 17, 2014 11:13 pm

OK, there's one thing I'm having a really hard time with:

I need to test if a sprite's X and Y are over any filled tile on the Tilemap, but without using "Sprite is overlapping" as the detection isn't fine enough. I've tried all sorts of variations with PositionToTileX, TileToPositionX, SnapX etc and now my brain's just turning to mush... My Tilemap is 16x16 if that helps
B
15
S
4
G
1
Posts: 286
Reputation: 1,988

Post » Mon Feb 17, 2014 11:50 pm

ImageImageImageImage
B
157
S
65
G
41
Posts: 2,594
Reputation: 34,748

Post » Tue Feb 18, 2014 6:19 pm

Exactly! Ha, I was doing it backwards, trying to base the condition around the sprite. Thanks!
B
15
S
4
G
1
Posts: 286
Reputation: 1,988


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 3 guests