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

Clearing screen takes too much time?

dT_

Member
For some reason on 2.3 show_debug_overlay shows constantly grey color in graph. Game freezes for some time and graph becomes full of grey, after high CPU or GPU usage. On 2.2 i never seen this color in graph and never had freezes before.

What is actually "The time required to clear screen each draw step"?
 

Attachments

Last edited:

jedy567

Member
This is happening to me as well and I just noticed. I tested it by opening a freshly converted 2.2.5 file (and then fixing any compile errors, all of which are unrelated to my "assets drawing" script), and, like you, the debugger reports a drastic increase in screen clear, and the gray part of the bar seems to jump every step quite erratically.

When profiling, the culprit seems to be "@@NewGMLArray@@" in the script I use for preparing to draw each instance (scr_drawarray_prepare). Each instance has this array stored as an instance variable called "MyDrawArray" and the prepare script simply stores an array inside of "MyDrawArray." I would guess that maybe there is a difference in array management on GMS's end, or maybe instead of editing the existing array for each instance, it's deleting the old one and creating a brand new once, which takes up more processing? I'm not using an array accessors because the new array is returned as [ X, Y, Z, et c]

Capture3.PNG
 
Last edited:

dT_

Member
I don't think that profiler shows it. It's something with drawing inside GMS. Are you preparing it in Draw Event? Will it resolve if you will disable preparing of this array?
 

jedy567

Member
Sorry, I should have mentioned that this particular script IS what is causing my debugger overlay to show that big gray section. I *think* I have a solution for you.

So, in that script I mentioned above, "scr_drawarray_prepare," at the end of the script I used to set the entire array at once like this:

MyDrawArray = [sprite_index,image_index, xfin, yfin, xsc,ysc,_dir,_colr,image_alpha,MyDrawShader]

However, by simply changing it to the following:
Code:
    MyDrawArray[0] = sprite_index
    MyDrawArray[1] = image_index
    MyDrawArray[2] = xfin
    MyDrawArray[3] = yfin
    MyDrawArray[4] = xsc
    MyDrawArray[5] = ysc
    MyDrawArray[6] = _dir
    MyDrawArray[7] = _colr
    MyDrawArray[8] = image_alpha
    MyDrawArray[9] = MyDrawShader
The "jumping gray" section on the debugger overlay disappeared entirely and the framerate has been greatly improved. See if you've got any scripts where you're preparing an array all at once like that and try breaking each array entry down into its own step.
 

jedy567

Member
I was calling it in the step event and then using a second script to actually perform the drawing in the draw event later on.
 

dT_

Member
I just got full graph of grey, when i create 170 instances in Create event, btw empty project with same actions doesn't have this weird grey freeze.
 

jedy567

Member
When you run the profiler? What's taking up the most resources? Is there anything in the profiler that seems to be abnormally high usage (step% column)? For me it was that "@@NewGMLArray@@" line, but it may present differently for you. I know you said the profiler may not show it, but I would bet there's a clue in there
 

dT_

Member
Nope. It's not about this. I just run a game, put in first room single instance with Keyboard Event and on Space create empty instance with single Create Event, inside i create 170 empty instances and got full graph grey and freeze. It's something probably with converted projects or big projects, because i can't reproduce it on empty project.

UPD: I found it. I deleted each type of assets and i builded after deleting. And when project had only sprites issue existed, i deleted them and this issue gone. So? New sequences after converting doing something with sprites? More sprites in project increasing clearing time, how does it work?
 
Last edited:
Top