• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • 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 how to depth sort in this GM2

J

juztehspessdE

Guest
help me pls mastersgame maker
i used to just depth = -y for many of srot in game maker (for in previous versions)
i am dum.. so dum now
i cant see the new easy user way for depth sort......?

layers maybe nice but i need easy it seem layers sort static array depth array? why so much hard compare in the old game maker studio??????

i can see maybe other language than GML they do sort draw lists

maybe i am confuse but GM2 did not remove for easy draw.. ?
how can i do easy depth = -y now?
 

Mike

nobody important
GMC Elder
You can still do this.

But ask yourself if you need to. Look at the dungeon demo, it does it a different way so that most of the depth sorting is free.
 
J

juztehspessdE

Guest
0.0
um..

Code:
// create a many list in dsGrid
for(var newPlaceY = 0; newPlaceY < global.otDsGrid_RoomHeight; i++){
   global.ot_dsgrid[# 0, newPlaceY] = ds_list_create();
}


...





while(count>=0)
       {
           // Get the instance in the list
           var i = ds_list_find_value(global.GridPlaceY , count--);
           draw_sprite_ext( i.sprite_index, i.image_index,i.x,i.y, i.image_xscale, i.image_yscale, i.image_angle, i.image_blend, i.image_alpha );
       }

thx i see it now ... only
that maybe this too much? i think this basic for any none GML languge? idk i think it is much too hard....
but maybe depth = -y much beter?

i can see this maybe too slow for big gamemaker projects??

how come there is such changes in new vers of this game makerm ...
if you have layer and you make new thing on it then the next thing is always on the top.... not looking good. i think it is basic need for any developers?? unless maybe i wrong. how do all you do it ?

wont player get mad with it and not like it if you forget depthsort = -y??
 
S

Sam (Deleted User)

Guest
I think the problem is he thinks it's too much code to write, where as depth = -y is just one line.
 
J

juztehspessdE

Guest
What makes you think depth = -y is any faster?
oh it not?

i think array of all y cells mabe hav size limitations in speed no???

if it is same in inner working old code for old gamesmaker then i did not know

sry

ok i see this will have to be work. thx..
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
You can STILL use depth = -y. Nothing is stopping you, and while it is slower than having fixed layers or doing your own depth sorting, it's still okay for most uses. I imported my game Skein from 1.4 to 2.0, and it uses depth = -bboxbottom for EVERYTHING and I often have upwards of 3000 instances on the screen... In 1.4 my FPS with that many instances hovers around the 300 mark, and in 2.0 it's hovering nearer the 250 mark. Now, that 50 FPS drop is pretty small imho, and it's also not JUST from the depth stuff, since GMS2 has to also call dozens of compatibility scripts and stuff for the game to run.

Keep in mind that "slower" doesn't always mean it's bad, and it's also VERY relative. How much slower and compared to what? Are a few (potential) microseconds really worth all the hassle of doing something differently? I would suggest just using depth = -y if you need it and seeing how you get on. If you have performance issues then you can look at other solutions but I suspect that you'll be just fine.
 

origamihero

Member
I ran into some troubles using depth=-y for mixed persistent and non-persistent objects in different rooms. Trying to get them all onto one layer per code was problematic and didn't work out. But that could very well be just me not understanding the layer system. I switched to a method like the one mentioned above in the 3rd post which works just fine. I guess my point is as as follows: That method isn't very beginner-friendly, and having a more accessible way of z-sorting would be very welcome.
 
J

juztehspessdE

Guest
I ran into some troubles using depth=-y for mixed persistent and non-persistent objects in different rooms. Trying to get them all onto one layer per code was problematic and didn't work out. But that could very well be just me not understanding the layer system. I switched to a method like the one mentioned above in the 3rd post which works just fine. I guess my point is as as follows: That method isn't very beginner-friendly, and having a more accessible way of z-sorting would be very welcome.
hi
do u know best ways for x and y??

i figuree out the y but need for both... old game makers make it not hard
but new way is hard

an for you problem in the persstent obj it may be for the layer delete in new room create
you must make layer for each again every room changes..
(layer memory get clear every new room an load)

so for any depth you must test in each room to make again
here from doc i copy something

maybe to put in obj begin step
Code:
if (!layer_exists(layer_get_id("mylayer"))
{
layer_create(depth, "mylayer");



}
else 
{
//it exist
if (layer_get_depth(layer_get_id("mylayer") != depth )
{
   layer_destroy(layer_get_id("mylayer")); //maybe not destroy but for doc had for this maybe you do wants layer_depth(layer_get_id("mylayer"), depth)

   layer_create(depth, "mylayer");
}
}
see mabe this do it

but for first i need help in x and y for sorting.... i can do y but need for both.. grid list create slow even in small size
 
Top