• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - IDE Make asset layer tillable

Chaser

Member
hi everyone,

With the disappointment of not being able to change the tilesets during run time, it has been suggested to use asset layers instead. I’m struggling to figure out what I need to do and assign a sprite to an asset layer.
When in the room I select “new asset layer”, but then I’m presented with “no tile layer selected”. I’ve looked through the resources and cannot see one for create asset layer within the sprite and tileset resources so I’m doing something wrong somewhere.

Create sprite/create tileset/assign sprite to tileset this is simple enough.
Create sprite/ then what exactly?
Create asset layer / no tile layer selected?

There is plenty of code for use with asset layers but that’s of no use to me when I’m trying to set up in the room editor.

Help or point me in the right direction would be a appreciated. :)
 

Chaser

Member
Ok I get it now, I have to drag a sprite in there. Still not what I want to do though for my project. :(
 

Chaser

Member
Right I may get on my soap box here only coz I’m frustrated, sorry.

I just would like to say that GMS2 new tile system is fantastic, with the animation and how it works etc, I can see yoyo have put in a lot of effort into it, so I thank you guys for doing it, however it’s current structure is too robust. I have read many posts about it and I can see how you guys get very defensive about it with regards to how we cannot change it’s propertys at runtime, and it’s for performances and stuff and what feedback you have got over the years and you have no intentions of changing it. I get that.

But there are some of us that do want to change Our tile sets during runtime for what ever reason, and not having any control over that is a pain for us.we have so much control and can manipulate everything else with our projects that it seems strange not to be able to with this. But I understand why we can’t.

Here’s my example.

I currently have 20 levels that are 3000 x 3000, using a tile set which is 16x16. Now at some point I need to have snow. At the state it is in now I would have to recreate those 20 levels all again this time using a new tileset, now that’s a lot of work, but if I could just change the tile set with a function to change the tile set sprite I’m using to the other sprite, as it’s already been mapped out by the first tile set used it would save so much time, and I wouldn’t need more tilesets. I’m not that bothered about doing it again 20 times if I have to but it means using more resources which in a way will use more on performance in time?

It was suggested to use the assets layers, which I have tried but it just does the sprite. Meaning I would still have to recreate the whole level again more than once, again creating more assets and using more resources.

But I think I have a solution for you to consider which I hope will please some that are frustrated with the tile map system with out changing it in anyway.

Give the asset layer a tile function. So we can use it in the same way as a tile set, so we can change it’s sprite easily, like in GMS1 but without going back to GMS1. I think it will benefit GMS2 in a good way. Some may agree, if they do then I hope they post here too. But in no way do I want to take away the hard work you guys have put into the tile set editor, it’s great! Just a shame it’s not a bit more flexible.
 
A

Arconious

Guest
What do you mean "With the disappointment of not being able to change the tilesets during run time"? As far as I'm aware, you absolutely can make changes to your tilemap layer and tileset resources during runtime (including swapping one tileset for another, i.e grass tileset -> snow tileset). EDIT: The function tilemap_tileset() is what you're looking for in that regard.

What are you not able to do with tiles that you are looking to do?

EDIT2: Actually, as the OP pointed out and I misinterpreted, tileset resources can't be manipulated at runtime.
 
Last edited by a moderator:

Chaser

Member
Tile set 1 has an sprite assigned to it. It I want to change that sprite to something else. Which would change how the level looks, it this can’t be done meaning I will have to use another tile set and map the whole level out again.:) mike says it cannot be done, to use assets layers, but these are not tileable. If you know a way to do this, then please let me know.:) thanks for your reply
 
A

Arconious

Guest
I included in as an edit in my previous reply, but is this the kind of function you're looking for? tilemap_tileset() -- This function allows you to swap the tileset being used by the Tilelayer for a different tileset, which should update all of the tiles on that tilelayer to use the new tileset resource.
 

Chaser

Member
I understand you can change the tile set to another, but it it would be more econimical to change the sprite in that tile set. Which I’m told cannot be done.
If I use another tile set, I will have to recreate the level again with the new tile set?
 
A

Arconious

Guest
Sorry, I must not be fully understanding what you're trying to accomplish.

If your tilesets are already created and stored as a resource in GMS2, then the as far as I understand, the 'tilemap_tileset()' function suits your needs for changing the sprite of the current tilelayer to a different sprite. For example, again, if you had a tileset_Grass_Summer and tileset_Grass_Snow, this would allow you to swap between the two easily.

However, if you are talking about generating or manipulating a tileset resource at runtime and trying to use that, then that is something I don't see as immediately possible, because it looks like GMS2 does not allow us to manipulate individual tileset resources themselves as you pointed out previously.
 
Last edited by a moderator:

Chaser

Member
Yeah you can’t change that, I suppose what I’m trying to say is it would be much easier and less time consuming to just to be able to change the tileset sprite. So instead of just having 20 sprites, I have to now have 20 created tilesets as well. And given that each tileset being used is on around 3 layers within the room editor. So grass is on the first layer, then fences on layer 2 and trees on layer 3 and so on which are all on the same sprite sheet that that tileset is using, then changing just the sprite being used would be more helpful. The way you have shown me means I would have to write code for each layer containing that tilemap and change that layer to the new one, which is OK I guess, but if I’m using 5 tile sets which are set on about 4 layers each then it just seems it could get a bit overkill with all the code, and it would be more econimical to just say: with tileset 1 use sprite 2 index 3, or something like that anyway. I know this is not going to happen with the architecture of tile sets in GMS2, so that’s why I suggested have the asset layer be allowed to be used as a tile set if the user wanted, then that could be changed from sprite to sprite without the restrictions of the current tileset system. I like to explain a bit more and give an example but I don’t have the time at the minute, it may sound like a stupid idea, but to me it makes sense, :)
 

Mike

nobody important
GMC Elder
Sorry... I simply can't see your issue. Changing several tilesets at runtime is just not a major issue... if many rooms/levels need this feature then just name the layers the same, and write a script once. It's just not that complicated.

Or.... if you want to manage ALL of this in the IDE, then create child rooms. The parent being the one you edit, and the children the one with the different tilesets. Then you don't need to change anything, you just go to the "snow" room instead - like is shown in this video...

This way... you can edit several rooms at once, and inherit everything except the tileset that's being used.

(FF to 1:29)

I know you think "just" changing the underlying sprite is the best way, but it's not. There is a lot of pre-generation of tilesets so that they tile properly, and if you started swapping them around, you would take a "hit". Defining them in the IDE means you can just "set" them when you need to.

At some point we will allow runtime generation of tilesets, but even then it won't be for things like this, but to allow more procedural or user generated creation of levels.
 

Chaser

Member
Thanks for your reply mike, I know you don’t see what I see, it’s not a major issue as you say. I just thought just having 20 sprites and a small code function to change them would be an idea over 20 sprites, 20 tile sets and 20 rooms and 20 lines of code. That’s how I see it. I don’t think it’s very resourceful to do this way, having the asset layer be tillable would be helpful for some users, to create the levels with no collision reading. Or think of it as a background creation, But hey, it’s just my opinion, and il just have to get on with it as it is. I know your probably holding your head in your hands at this point, or even hitting a wall with it :) I’m sure there is method in my madness I’m just not very good at explaining myself. Thanks again for your response.
 
Top