Thursday, September 30, 2010

Defeated the Lag Monster!

Not much in terms of asset updates, however, over the last two days I have solved a large-ish issue with the game. You see - Game Maker is a slow, high-level script. Its math computations are laggy, and its asset management is rather inefficient. But hey! I'm not really complaining there. My biggest issue with it, however, its abysmal handling of tiles. Not only that the built-in tile editor is completely worthless, and doesn't allow to utilize even a fraction of GM's own tile manipulation abilities, but the output algorithm is incredibly inefficient. It appears it blits every tile in the room on each redraw - with larger tiles most people use - it's not really a problem, but since I had to use DS-compatible tilesets of 8x8 elements the game ran like crap on lower-end computers.
From the day I got my netbook I've been frustrated with the game's awful performance on it. Even on "high power" mode the game ran at barely 20 fps. I tried to solve the problem several times before, but could never pinpoint the fps sink, always suspecting my own code as the culprit. A couple days ago I have finally discovered the tile issue, and have quickly devised a solution.
A short script was added to the hud object. At the start of each room a global surface is created, views are turned off and the entire room's tilemap is blitted to that surface once. The tilemap is then deleted from memory, and replaced with an object that draws only the part of the surface currently visible on screen... BAM! - 30% speed-up!
I couldn't be happier: )

Oh - and other news - I have dug up issues 2 and 3 of the old LOI "comic" I drew when I was 11 years old... Not even sure I should make that travesty public, as it is a genie of infinite shame: )


  1. Hey, that's good news on the dev front!! Keep up the good work, I would really like to see your opus magnum finished one day.

  2. congrats on killing the lag monster,i notice that you make better programs than game makers original tools,which i think is funny.
    truth is, i really want to read those comics,but
    if you think you shouldn't I wont push you.

  3. @Matthew: I didn't wanna imply that I am in some way capable of writing code better than the creators of GM - after all, the problem was solved from within GameMaker. GM's tile output engine is geared toward having larger, layered tiles - something that I'd actually love to use, but since I started the whole DS-authentic limitation, I'll keep going with it.
    As per my "comic", I seriously doubt it has any value outside of making me feel ashamed:) For one thing - it's in Russian, though translating it would probably make it slightly less terrible.
    Other things to know are:
    * Iya is NOT the main character.
    * It has absolutely NOTHING in common with the games.
    * And last, but not least, since I was bad at drawing humans back then - all characters are sort of furrie-looking things:)

  4. i didnt mean 'make' as in writing whole new code. i just meant that you know how to work around stuff, though i bluntly said "you make better programs".
    i guess i need to think how i word things :P

  5. Heeyyyy, is that Skeletor?!!! What's he doing creepin' up on Lady Sia like that? HUURRMMM...

    Anyway, you know, it's always been a dream of mine to make a game, so one day I would love to sit down with a program like Game Maker or Construct and see what I could do. I keep seein' the sorts of hiccups that guys like yourself and Derek Yu run into with it though. It's too bad that GM requires so much effort just to run efficiently, but it's great that you found some clever workarounds. I'm hoping my PC will even be able to run the thing when it's done.

    Looks awesome man, keep up the good work! I'mma get back to lurking now...

  6. Daaaaaamn! I really want to read those comics!
    Not only it looks really decent for a 11-years old artist, but kids have that kind of imagination without bounds people tend to develop over time

    I don't think there's anything to be ashamed about, the age excuses you completely anyway C:

  7. Wow, just HOW inefficient is the game maker thing then? If it can't work at a decent speed on a machine that is - if you're on an original EeePC - at LEAST a 600Mhz Pentium-III equivalent, even though it's only pushing around stuff that wouldn't hugely trouble a typical 8mhz 68000 (or well-made 4Mhz Z80) yesteryear computer, just how many cycles is it wasting on each refresh?

    And though that comic may be a bit scratchy in the grand scheme of things, it blows anything I could have come up with at the same age completely out of the water. (...or anything from the following 4-5 years, at which point I gave up having discovered the internet and how, even within my own Geocities neighbourhood, there were scads of much better amateur artists around)