Looking for a speed up =)

Non-platform specific questions.

Looking for a speed up =)

Postby Hblade » Wed May 08, 2013 7:08 pm

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)
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Looking for a speed up =)

Postby skydereign » Wed May 08, 2013 7:27 pm

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Looking for a speed up =)

Postby Hblade » Wed May 08, 2013 7:59 pm

Thanks sky! =D
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron