• 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 - GML Visual Where did Layers move to?

W

WWAZman

Guest
Sorry for such a newbish question, I'm just getting back into GMS2 after being on GMS1.4 for years.. I'm trying to update my games for the required sdk updates, and finding the GMS 2 really difficult to find new stuff in.. I'm wayyyyyyy behind. Simply put, on my simplest game I have stuff overlapping each other, the layers / depth that existed on gms 1.4 is different, so how do I change / fix / alter it now? I don't see it as an option in the objects anymore, unless I'm missing something (which very well can be!!)

Thanks for your patience with me, and hope to hear from someone, anyone, soon!

Allonzy!
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Hi there! Okay, so, are any of your instance/tilelayer/background depths over or under +/-16000? That's the depth limit on the new layer system, so if you are outside that range then that'll give you issues straight away. You may be able to "quick fix" it by simply calling gpu_set_zwriteenable() and setting it to false. If that doesn't solve it then you'll have to dig in a bit to the project and change all depths to fall between those values before continuing.

Another thing to be aware of is that there is no way to know how two things at the same depth (or on the same layer) will be rendered, so they may be rendered 1 > 2 or 2 > 1, so if you want something to specifically be over or under something else, it must be at a discreet depth.

Finally, you'll probably want to forget about using depth and try and change all the compatibility scripts and creation code to use layers. I've done this myself and (in general) you'd be surprised how few layers you normally need. In a typical game for me I'll have a GUI object instance layer, an "above" instance layer, a "middle" instance layer" and a "behind" instance layer, then a background layer or two at the bottom. If you use tiles then just slot the tile layer in between the rest as required. I find that with this minimum of layers, I can make most of my older projects look the same... unless you're doing isometric depth = -y stuff, in which case it's more complicated!

Once you work out the minimum number of layers required for the game, simply create them in the rooms and then change the code for creating instances and stuff to use the new layers instead of depth and then remove all the compatibility scripts. I know that's easier to say than do, and I know that for someone new to GMS2 it can seem complex, but once you've done it once, you'll find it easier the next time! And it really is the best way to fix things, as once you've translated all the compatibility scripts into native GML for GMS2, you'll have a btter understanding of how it works and any errors will be easier to fix as they'll point to the exact problem, and not some obscure compatibility script.

tl;dr: Go through the compatibility scripts and your code and project and update the project to use the GMS2 specific functions, then remove the compatibility scripts, and finally fix the problems afterwards.


PS: DO NOT MESS WITH THE TILE COMPATIBILITY SCRIPTS! By all means change the depth of the layer for tiles or the depth they're being created at, but tiles from GMS1.4 are very, very different to those used in GMS2 and as such their compatibility scripts cannot be updated or removed. All the rest can though.

PPS: Have you seen this article on the helpdesk? https://help.yoyogames.com/hc/en-us/articles/231719468-Porting-A-GMS-1-4-Game-To-GameMaker-Studio-2
It has an overview of what's changed between versions... which may be of some help!
 
W

WWAZman

Guest
ok still reading through and trying to comprehend it all (and I just woke up! ;) )

.. I did go through and check in GMS 1.4 and all the objects are set to 0 for the layering. still reading the porting link you sent.
 
Top