Page 1 of 1

Looking for a speed up =)

PostPosted: Wed May 08, 2013 7:08 pm
by Hblade
Hi everybody. I'm looking for a way to speed up the game, I have 100x100 * 2 tiles, that's 20,000 tiles total on the map. I have air tiles and stuff, so "deleting" the tile isn't really going to work with the method I have, since reloading a loading a brand new map file would cause a complete reload which would take a long time.

Currently I have the tiles set to NOT receive events while out of vision, and in draw actor I have safeDraw which is written like this in global code:
Code: Select all
void safeDraw()
{
    if((xscreen>640||xscreen<0) || (yscreen>480||yscreen<0))
    {
        VisibilityState("Event Actor", DISABLE);
    }
    else {
        if(animpos>0)//air tiles :D
        {
            VisibilityState("Event Actor", ENABLE);
        }
         }
}


I'm looking for the best way to increase performance. It wont go above 32/33 FPS (Which is fine if I cap my game at 30 but I want 60 if possible =D)

Re: Looking for a speed up =)

PostPosted: Wed May 08, 2013 7:27 pm
by skydereign
It really depends on what you are doing. I'd recommend not create every tile in the 100x100 map as the best way to improve performance. Just say that on any given map, one third of the first layer is air, and two thirds of the second layer is air. In total you have 20000 actors created, and you are ignoring 10000 actors that you don't need, and will pretty much never need. If you really don't want to delete and recreate the map each time, just create however many tiles you need, and use them. If you ever need more, create more. Any ones you no longer need, move them off to some remote part of the stage, and disable them until you need them again. This bypasses the need to create 20000 each time you load a map.

On the same note if you were really worried about it, you could set it up to only use the number of tiles that fit within the view, plus a few extra columns and rows for a buffer. From there shift them around as needed.

Re: Looking for a speed up =)

PostPosted: Wed May 08, 2013 7:59 pm
by Hblade
Thanks sky! =D