Jump to content


Photo

Lags after about 10 min gameplay


  • Please log in to reply
8 replies to this topic

#1 Dragon47

Dragon47

    GMC Member

  • GMC Member
  • 147 posts
  • Version:GM8

Posted 25 June 2012 - 12:26 PM

I've been working on this game for quite a while, and I've been developing it on my kinda crappy school computer. If I play and walk around for about 10 minutes the game's fps suddenly drops, it's like the processor doesn't want to try. There's no lag in the beginning and I really want to keep it that way. And I'm quite sure the problem doesn't have anything to do with objects in the background suddenly getting created and stuff, since if I turn the game off and back on when the lag has come, it stays that way for a long time.

Could you please try the game and tell me if it lags after 10 minutes? Or if you have a video card that's able to be monitored it would be really
nice if you monitored it while playing. :D
http://www.mediafire...y4os4xc4o1qu9ll
  • 0

#2 Swifty

Swifty

    Shadow

  • GMC Member
  • 362 posts
  • Version:GM:Studio

Posted 25 June 2012 - 12:47 PM

I've been working on this game for quite a while, and I've been developing it on my kinda crappy school computer. If I play and walk around for about 10 minutes the game's fps suddenly drops, it's like the processor doesn't want to try. There's no lag in the beginning and I really want to keep it that way. And I'm quite sure the problem doesn't have anything to do with objects in the background suddenly getting created and stuff, since if I turn the game off and back on when the lag has come, it stays that way for a long time.

Could you please try the game and tell me if it lags after 10 minutes? Or if you have a video card that's able to be monitored it would be really
nice if you monitored it while playing. :D
http://www.mediafire.com/?y4os4xc4o1qu9ll

I didn't download it - however are there objects that are going outside the game room? If so be sure to destroy them, as that could be the cause of your lag. Or possible a variable that's constantly adding up etc.

Swifty
  • 0

#3 ChefDavid22

ChefDavid22

    No, YOU shut up!

  • GMC Member
  • 1193 posts
  • Version:GM:Studio

Posted 25 June 2012 - 12:49 PM

Two things I check when I see lag in my game:

1. Make sure when objects leave the room you destroy them. Especially if your room plays for a long time.
2. Dont scale too many objects. If you have several items you are scaling it's actually better to just make the sprite the appropriate size.
  • 0

#4 Mr B

Mr B

    GMC Member

  • GMC Member
  • 172 posts

Posted 25 June 2012 - 12:49 PM

No serious lag. I noticed a small amount of lag just after loading a world, but that's hardly an issue.
  • 0

#5 Dragon47

Dragon47

    GMC Member

  • GMC Member
  • 147 posts
  • Version:GM8

Posted 25 June 2012 - 01:07 PM

Well, I don't really use a lot of objects, I stay with grids and lists, the clouds and torches are objects though. But the blocks are just 192x192 surfaces (drawing each block wouldn't be possible, then the fps would be at 2 or something :P). I thinkt the cause of the lag is that surfaces constantly need to be processed; deleted and created. But if any of you have
a monitoring device or notice some strange lag at certain moments, it would be great to know. Thanks.
  • 0

#6 dannyjenn

dannyjenn

    GMC Member

  • GMC Member
  • 2041 posts
  • Version:Mac

Posted 25 June 2012 - 01:16 PM

Constantly adding a number to a variable shouldn't be creating any lag... a real takes the same amount of memory regadless of what it' value is. The onyl way it would create lag would be if you are consantly adding to it way too many times in a single step (like, having it in several loops with hundreds or thousands of iterations each).

Also, deleting and creating surfaces could definitely cause lag but I don't understand why it wouldn't happen until 10 minutes into the game (unless the amount of surfaces being created grows as the game goes on and it builds up over time)

But I can't help, since for one thing I use a Mac and for another thing, I don't have any monitering software or whatever

Edited by dannyjenn, 25 June 2012 - 01:17 PM.

  • 0

#7 Swifty

Swifty

    Shadow

  • GMC Member
  • 362 posts
  • Version:GM:Studio

Posted 25 June 2012 - 01:18 PM

Well, I don't really use a lot of objects, I stay with grids and lists, the clouds and torches are objects though. But the blocks are just 192x192 surfaces (drawing each block wouldn't be possible, then the fps would be at 2 or something :P). I thinkt the cause of the lag is that surfaces constantly need to be processed; deleted and created. But if any of you have
a monitoring device or notice some strange lag at certain moments, it would be great to know. Thanks.

Ah yes, if you're using surfaces be sure that you're freeing them properly when they're no longer used. To check your object count you could simply do something like this in a Draw Event:
draw_text(0,0,instance_number(all))
Your surfaces you'll just have to make sure you're freeing each one when you're no longer using them.

Swifty
  • 0

#8 Dragon47

Dragon47

    GMC Member

  • GMC Member
  • 147 posts
  • Version:GM8

Posted 25 June 2012 - 01:29 PM

The instance number is around 50. And I'm very aware that I have to delete surfaces and data structures after use (there's always a possibility that I made a mistake though, but if so; I've been searching for it for a long time with no luck). Each time a surface is created (I have surfaces for background blocks, foreground blocks and shadows) I add the id of it to a ds_list which works as a queue. The size of the list is usually at 500 which means there are usually 500 existing surfaces. If the list size passes a certain number it starts deleting and I don't see anything strange when watching the variables in this system, so I don't think the bug is here. The "bug" might simply be that this school computer is getting old and running such a game for so long makes it tired. Cause as I said; even after I end the game exe, it stays laggy when I turn it on again.

I tried it on my other stationary windows xp computer, and it seemed to work fine there.

Edited by Dragon47, 25 June 2012 - 01:31 PM.

  • 0

#9 dannyjenn

dannyjenn

    GMC Member

  • GMC Member
  • 2041 posts
  • Version:Mac

Posted 25 June 2012 - 01:40 PM

If it stays laggy after being restarted then it has nothing to do with surfaces, since as far as I'm aware surfaces are cleared whenever the game ends (even if you save the game)
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users