Removing Lag

Started by bigace, February 07, 2013, 01:17:17 pm

Previous topic - Next topic

bigace

I have a quick question, what are ways to remove lag from your scripts. While I was coding; if I remove the image, so there is no moving background and then I start up the game, when I go to the scene without the background, I experence heavy lags until I exit the scene. Thats just one example. What are your examples.


Use Dropbox to upload your files. Much simpler than other upload sites, you can simply place a folder on your desktop that will sync with your DropBox account.

Blizzard

There are several types of lag. A common mistake some scripters make is to keep calling refresh. Usually refresh redraws stuff and drawing is very expensive so constantly drawing tends to have huge slow downs. This is often fixed by refreshing the display only the necessary.

Other lag problems include too many windows/sprites. Invisible sprites and windows need still a lot of CPU time as RMXP wasn't coded too well in that area. If something is invisible or out of the screen, one should always think about possibly completely disposing the sprites.

Yes another category are parallel process events, a huge number of normal events on the map and huge maps. A huge map requires a lot more CPU power. More events mean that more stuff has to be processed. And parallel processes have an unusual behavior. If you have 1 such event with 15 commands, you will barely notice it. But if you have 15 parallel process events with 1 command each, it will lag a lot.

These would be the 3 most common mistakes/causes of lag from the top of my head.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.