• 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.

Discussion Drawing at a depth of 0 dramatically decreases performance?


So I was just testing a few things on a quick test setup I have for testing the speed of scripts and I found something very strange as you can probably tell by the post title. Here are some screenshots of the performance and code for each set up along with an instances counter. The white dot are just all the instances stacked on top of eachother.

Drawn at depth of 0:
draw0.png draw0draw.png

Drawn at depth of 1:
IDE Version: v2.0.6.136
Runtime: v2.0.6.93

I was going to upload the project file but apperently the forum doesn't accept .zip files or .yyz projects.

Just curious what's going on here and why is there such a big difference in performance. These tests were done on windows using the VM not YYC compiler as it doesn't run for some reason on YYC. In my current game I was planning on making the main game plane at depth of 0 (as it is using a fov camera matrix) but now I am having second thoughts, Thanks!.


Friendly Tyrant
Forum Staff
Not sure what the issue is here exactly, BUT I suspect it's to do with you setting the depth every step and so forcing GMS to create and discard managed layers all the time. You should be setting the depth once only and NOT two times every draw frame, and you should really be using layers rather than depth too unless necessary for specific effects. Also note that you should NOT set depth in the draw event of an instance... Have you read the manual to see how depth actually works? https://docs2.yoyogames.com/index.h...rence/instances/instance_variables/depth.html