• 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 - Code Single surface lags game right at the room start for 2-3 seconds

MilesThatch

Member
I've pinned down the objects that caused my game to lag for 2-3 seconds at the start of every room. Turns our it was my lighting master object. This is not a complex lighting system - a single surface the size of the game camera (1440x900), cleared with a draw_clear(c_black); and all the lights use bm_src_color to punch through the blackness. Basic stuff everyone knows about. I've deleted the lighting master object from a level and instantly the lag went away. I've continued pin pointing the exact code that caused the momentary lag. I've re added the master light object and commented out the surface stuff, same deal - lag is gone. This is a ported project from 1.4 and the master lighting objects did no lag the game when it was in 1.4.

I've read somewhere that you shouldn't use surfaces of large resolution, although I use only one surface in the entire game, it begs the question of why it wasn't an issue in 1.4...?

Also why does it lag the game for just a few seconds and not the entire time. Is the surface being loaded or something? After a few seconds, the lag goes away and the game runs at an appropriate speed.
 
Last edited:

rwkay

GameMaker Staff
GameMaker Dev.
First of all - what happens when you increase the sleep margin in the Windows Game Options (try something like 5 or 10ms)

If that does not help then please File a bug with a minimal project attached (create a YYZ file File -> Export Project) and we will take a look as that should not really happen

Russell
 
Top