M
MirthCastle
Guest
Hey ALL!
I wanted to give a shout out to a new 2.5D sorting system I made I call Grid-Layers.
Here is a Presentation File that says what it is: (This is in the video, but I wanted to provide it separate too)
https://www.dropbox.com/s/jea942d31g6ta2q/GMS2_DepthSystem.pdf?dl=0
(don't use my PDF without creds!)
Grid-Layers works by using a ds_grid to store a reference to a code created layer_id for each Y (depth) of the room. This makes it very easy to move our objects between layers without strings.
What's more!? The whole system works without having to override any draw_events. YES! We get our draw_events back!!!!
All of the layers are created dynamically at room start, so no messing with the room editor beyond initial setup. This system also allows for using the room editor layers as normal, so you can add as many layers as you want in the room editor to make your game the way you imagined (barring skill level or course hahaha).
Using the code created "real" layers means you can use all of the layer functions EG: turn them on and off, move them, and even add layer scripts etc. Especially in the case where you want to use multiple views - you can fairly easily disable these layers while the second view is rolling - thus cutting your draws in half.
Here is a benchmark (with view culling)
This is with 500 instances in a 2048x2048 room, 7 AI bots, and a Player. About 1/3 of the instances are grass objects that sway back and forth when you collide with them.
The system above really kicks into high gear because I use the view to deactivate all of the "Static" instances when they are out of the view, and for the "Active" instances, I switch off their Draw_Events (can't see them anyways!).
Here is the benchmark (w\o view culling)
STILL super fast (Using the view to cull instances per the tutorial is highly recommended)...
Once we have our instances place themselves on one of these code-created layers they stay there until they move up or down. Static objects only get sorted once (at creation), while active objects only sort when they move up or down.
That means there is no looping the grid, or the layers, or sorting! Everything is handled automatically by the regular draw-pipeline the Layers and GMS2 use. If a Layer is empty, it is simply skipped. If it has instances, they are all batched and drawn without any further lookups.
Youtube Tutorial:
Here is the Template:
https://www.dropbox.com/s/uz4s11geprq93wo/Grid_Layers_Template.zip?dl=0
p.s. The video is my first one ever - I could use come constructive criticism on it please. Is the voice too quiet?? I can't tell - i've listened to it 500 times... I can hear it without volume anymore lolol.
p.p.s. @Ariak - Would you be willing to add this to the list of sorting systems on your post? I can provide finished version for you to test.
@Nocturne - It wouldnt let me put this in tutorials?.. wouldn't this go in tutorials?
Many thanks to @FriendlyCosmonaut - She really helped me get all the pieces together to make my first video. Everything from what programs to use to video making advice. She is super cool! I appreciate all the help Friendly!
I wanted to give a shout out to a new 2.5D sorting system I made I call Grid-Layers.
Here is a Presentation File that says what it is: (This is in the video, but I wanted to provide it separate too)
https://www.dropbox.com/s/jea942d31g6ta2q/GMS2_DepthSystem.pdf?dl=0
(don't use my PDF without creds!)
Grid-Layers works by using a ds_grid to store a reference to a code created layer_id for each Y (depth) of the room. This makes it very easy to move our objects between layers without strings.
What's more!? The whole system works without having to override any draw_events. YES! We get our draw_events back!!!!
All of the layers are created dynamically at room start, so no messing with the room editor beyond initial setup. This system also allows for using the room editor layers as normal, so you can add as many layers as you want in the room editor to make your game the way you imagined (barring skill level or course hahaha).
Using the code created "real" layers means you can use all of the layer functions EG: turn them on and off, move them, and even add layer scripts etc. Especially in the case where you want to use multiple views - you can fairly easily disable these layers while the second view is rolling - thus cutting your draws in half.
Here is a benchmark (with view culling)
This is with 500 instances in a 2048x2048 room, 7 AI bots, and a Player. About 1/3 of the instances are grass objects that sway back and forth when you collide with them.
The system above really kicks into high gear because I use the view to deactivate all of the "Static" instances when they are out of the view, and for the "Active" instances, I switch off their Draw_Events (can't see them anyways!).
Here is the benchmark (w\o view culling)
STILL super fast (Using the view to cull instances per the tutorial is highly recommended)...
Once we have our instances place themselves on one of these code-created layers they stay there until they move up or down. Static objects only get sorted once (at creation), while active objects only sort when they move up or down.
That means there is no looping the grid, or the layers, or sorting! Everything is handled automatically by the regular draw-pipeline the Layers and GMS2 use. If a Layer is empty, it is simply skipped. If it has instances, they are all batched and drawn without any further lookups.
Youtube Tutorial:
Here is the Template:
https://www.dropbox.com/s/uz4s11geprq93wo/Grid_Layers_Template.zip?dl=0
p.s. The video is my first one ever - I could use come constructive criticism on it please. Is the voice too quiet?? I can't tell - i've listened to it 500 times... I can hear it without volume anymore lolol.
p.p.s. @Ariak - Would you be willing to add this to the list of sorting systems on your post? I can provide finished version for you to test.
@Nocturne - It wouldnt let me put this in tutorials?.. wouldn't this go in tutorials?
Many thanks to @FriendlyCosmonaut - She really helped me get all the pieces together to make my first video. Everything from what programs to use to video making advice. She is super cool! I appreciate all the help Friendly!
Last edited by a moderator: