Game Maker Games Forums
September 30, 2014, 06:10:21 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: There are brand new features in the Monster Archive.  Go check them out!
 
   Home   Help Arcade Search Chat Login Register  
Pages: [1]
  Print  
Author Topic: What Causes Lag  (Read 1424 times)
0 Members and 1 Guest are viewing this topic.
pubby8
Phoenix
***
Offline Offline

Posts: 3456



View Profile
« on: March 28, 2007, 01:44:02 PM »

Hello, I am not asking for any scirpt or anything, I just have a question:

What causes lag the most in a game?

Does sound lag?
Does a lower resolution/screensize lag less?
Does too many variables lag?
Does drawing lag just as much as using sprites?

Thanks in advance
Logged

IceWind91
Chimera
****
Offline Offline

Posts: 425



View Profile
« Reply #1 on: March 28, 2007, 06:44:21 PM »

Lag is usually caused by too many things happening at once, usually too much code or too many scripts running at one time. Drawing a lot of sprites and things could also cause lag. It may be possible for sound to lag a game, but I've never seen it happen. I'm not sure if screen resolution would affect the amount of lag.

If your game is getting hard to play because of lag, you may want to try tijitdamijit's Unlag Scripts. They will keep your game at a playable speed.
Logged

pubby8
Phoenix
***
Offline Offline

Posts: 3456



View Profile
« Reply #2 on: March 28, 2007, 08:18:35 PM »

yeah, I knew that tons of drawing functions lagged.

anyways i prefer to use all my  code so I think I won't use tijitdamijit's scripts.

Sofar I am just using a  simple thing like:

room_speed = 64 - fps

which works pretty nice i guess
Logged

millsa
Cyclops
***
Offline Offline

Posts: 1927



View Profile WWW
« Reply #3 on: March 29, 2007, 03:58:10 AM »

Lag is mainly caused by lots of drawing, may it be hundreds of objects on the screen, there all getting drawn. Code actualy is very efficient as its a small size as its only a small amount of text comparied to anything else and no output is needed unless you tell it to give output. Global variables can also cause lag as they use more memeory than a local variable. Memory is the main problem most people have which will cause the most amount of lag as if you dont have the space required the processor is working harder to put things in and take things out of memeory.

Oh and a lower scren reolution will cause less lag since its using less memeory.
« Last Edit: March 29, 2007, 03:59:01 AM by millsa » Logged
psu24369
Manticore
***
Offline Offline

Posts: 329


Penn State


View Profile WWW
« Reply #4 on: May 18, 2007, 07:28:59 PM »

Oh, and remember, by drawing, that also means special effects such as explosions and smoke.  Particles also cause lots of lag, so stay away from too many of those.  Also, if you must draw several sprites of the same type, always make sure you preload them before starting the game or load them from a different file.
Logged

Penn State Forever!

New at GML? Try my tutorials at http://www.gamemakerlanguage.herobo.com/. If you have any questions or problems, feel free to contact me at djh5331@psu.edu. I promise that I will do my best to help you and will most likely respond in less than one day.
gamefreek2
Hydra
*****
Offline Offline

Posts: 659


On The Brink Of A Moronic Fringe


View Profile WWW
« Reply #5 on: May 20, 2007, 12:57:07 PM »

Soundcan lag a game as well. My Blox game has 11 MIDI files and the first level starts at 24 FPS, but after 2 seconds it goes back to 30.
Logged

Bye.

I'll see you next year.
Time For School: 2010
Hunter and Mitchell: 2009
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!