Game Optimization Tips

You must understand the Game Editor concepts, before post here.

Postby marathon332 » Mon Aug 07, 2006 12:30 am

That's what I thought.

Thanks a lot for your help Makslane...

--Steve
User avatar
marathon332
 
Posts: 57
Joined: Tue Sep 06, 2005 4:00 am
Score: 2 Give a positive score

Postby irblinx » Mon Aug 07, 2006 11:25 am

I assume that these internal image formats only affect in game performance rather then reducing the exported file size, also an issue for PPC developers?

I would imagine that good housekeeping is also important for optimisation, i.e. ensuring that actors that have left the view for good are destroyed. I also destroy all timers in their code but I'm not sure what impact this would have.

BTW, good topic Steve. I wonder if this topic isn't deemed worthy of a dedicated area then maybe the forum should have section devoted to PPC development? There are quite a few elements that are sufficiently unique to development for PPC as opposed to windows games, such as the PPC key mapping and areas such as installers that we might possibly benefit from a closer look on the PPC front and it would certainly help new users to find anything specific that they needed.
irblinx
http://www.irblinx.me.uk/Crania.htm
Current projects: Crania deluxe for Mac, iCrania
User avatar
irblinx
 
Posts: 122
Joined: Wed Apr 19, 2006 11:15 am
Location: Manchester, UK
Score: 6 Give a positive score

Postby marathon332 » Mon Aug 07, 2006 11:59 am

irblinx:

[quote]I would imagine that good housekeeping is also important for optimisation, i.e. ensuring that actors that have left the view for good are destroyed. I also destroy all timers in their code but I'm not sure what impact this would have. [/quote]

Yes, I can confirm that destroying your actors off screen has a definite impact. I just tried it out yesterday and my sluggish test game picked up 2 FPS by doing that. The game has lots of actors in it so this is a must IMHO.

I'm also working on a scheme to dynamically create the actors so that they are created in memory only when needed but I haven't completed the tests and can't measure the overall impact yet.

Don't know about timers but I would imagine destroying them is also a good idea since anything you can do to preserve precious clock ticks will help.

In the area of optimization, no one thing (other than graphics) may have much of an effect. But when all things are added together, they definitely will.

I also agree that there should be a seperate area for device development discussions since there are a lot of special issues related to that. In my opinion this is what makes Game Editor different from other game development tools and will attract a lot of new developers like us in the future. So that would be a handy resource.

BTW, I like your website.

--Steve
User avatar
marathon332
 
Posts: 57
Joined: Tue Sep 06, 2005 4:00 am
Score: 2 Give a positive score

Postby irblinx » Mon Aug 07, 2006 7:43 pm

From a file size point of view it seems to make sense to use graphical fonts as these are a fraction of the file size of the truetype ones, however I wonder if one type is better than the other when it comes to game speed?

(BTW Steve, we like our site too ;) )

Incidentally, I promise to make a 240x240 version of our game :D
irblinx
http://www.irblinx.me.uk/Crania.htm
Current projects: Crania deluxe for Mac, iCrania
User avatar
irblinx
 
Posts: 122
Joined: Wed Apr 19, 2006 11:15 am
Location: Manchester, UK
Score: 6 Give a positive score

Postby marathon332 » Mon Aug 07, 2006 8:40 pm

irblinx:

I was wondering about fonts and FPS myself...

Maybe Makslane or someone else can shed some light on that too...

--Steve
User avatar
marathon332
 
Posts: 57
Joined: Tue Sep 06, 2005 4:00 am
Score: 2 Give a positive score

Postby makslane » Mon Aug 07, 2006 9:36 pm

The characters used in the ttf font are render before use.
After export, there is no more ttf fonts, only the images of characters.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby marathon332 » Wed Aug 09, 2006 1:21 pm

Okay, I've been working on my optimizations for the 1945 demo project and I 've achieved a lot better performance on my 312 and 624Mhz Pocket PC's.

Originally I was only getting about 4-6 FPS on these devices but by using various omptimizing techniques, I'm now getting an average on my Axim X50v of over 16 FPS and on my HW6515 it can get up to 15 FPS with an average of about 12.

The game is much smoother on both devices which is great since it was unplayable on the HW6515 and barely playable on the X50v.

So, here's what I've done so far to make it faster:

- Removed all unnecessary actors from the game

- Removed all alpha images

- Set transparency off on all actors except where it was essential.

- Simplified the animations. Made them shorter, smaller and changed them so that they didn't use alpha transparency.

- Removed any unnecessary Draw Actor scripts

- Simplified the code and made use of If Else conditionals in order to speed up execution. Especially on Draw Actor events which improved it 50 percent.

- Actors are now dynamically generated so that don't exist in the game until needed

- All Actors are destroyed after they are no longer needed

- Timers are destroyed when no longer required

- Used many seperate Activation Regions

This last tip added 3 FPS to the game alone and made the FPS more consistent throughout the whole game.

Here's a screenshot to give you an idea of what I did.

http://240x240.com/Treo700/InGame.jpg

Activation regions seem to be very efficient at keeping actors in memory only when needed.

Makslane, it would be interesting to know how it accomplishes this exactly. Just for the sake of understanding. Is it using buffers or what?

Anyway, do these things if they apply to your game and it will work much faster.

--Steve
User avatar
marathon332
 
Posts: 57
Joined: Tue Sep 06, 2005 4:00 am
Score: 2 Give a positive score

Postby Novice » Wed Aug 09, 2006 3:41 pm

Nice topic :D. I wanted to read something like this.

My question is when using the read text from a file function do i need to unload the text later when it's not needed anymore and will it possibly make a difrence or is it automaticly cleared?
Why do i always get stuck?
User avatar
Novice
 
Posts: 399
Joined: Mon Aug 29, 2005 10:54 am
Location: Relative
Score: 5 Give a positive score

Postby Game A Gogo » Wed Aug 09, 2006 4:02 pm

why dont we also make a topic about the game size also??
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby makslane » Wed Aug 09, 2006 5:02 pm

marathon332 wrote:Activation regions seem to be very efficient at keeping actors in memory only when needed.

Makslane, it would be interesting to know how it accomplishes this exactly. Just for the sake of understanding. Is it using buffers or what?


From documentation:

1) A Region, and your actors, is loaded only when the View Actor intersects it.
The Region and all actors within the Region are destroyed when the View Actor no longer intersects it.

2) If an Actor moves outside of the Activation Region, it will be destroyed only when the Activation Region no longer intersects with the "View" Actor.

3) All of an Activation Region's Actors load inside of the defined region. The Actor's parents, and Actor reference through script is also be loaded.

4) Actors created with "Create Actor" will be assigned to a visible Activation Region.

5) If the "View" Actor leaves a region and later it comes back, all Actors will be reloaded, except those destroyed explicitly with the "Destroy Actor" Action.

6) Any Actor can be loaded with "Create Actor", even if has been destroyed explicitly.

7) If no Activation Regions have been defined, all game Actors will be loaded when the game starts.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby makslane » Wed Aug 09, 2006 5:04 pm

Novice wrote:when using the read text from a file function do i need to unload the text later when it's not needed anymore


It's a good idea use fclose to close the file after read a text.
But if not, Game Editor will close later.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby willg101 » Thu Aug 10, 2006 2:57 am

I love it!! This topic got me fascinated and i went on reading about this stuff on wikipedia for well over an hour!

Thanks for the info!
http://www.wish-games.com
Old betas now available!!
User avatar
willg101
 
Posts: 473
Joined: Thu Dec 16, 2004 12:08 am
Location: West Michigan
Score: 5 Give a positive score

Postby marathon332 » Wed Aug 16, 2006 6:36 pm

[quote="willg101"]I love it!! This topic got me fascinated and i went on reading about this stuff on wikipedia for well over an hour!

Thanks for the info![/quote]

Yes, there are a lot of ways to make your game faster.

It's an art really and there isn't a game in existence that couldn't use some optimitzation somewhere.

What many developers forget is that there are millions and millions of people that can't play their games because they're using older computers and laptops that can't use cutting edge game graphics or use lots of memory.

And then there is the issue of devices which makes it imperitive to optimize your game.

Hopefully, this thread will grow longer over time and provide lots more useful info...

--Steve
User avatar
marathon332
 
Posts: 57
Joined: Tue Sep 06, 2005 4:00 am
Score: 2 Give a positive score

Transparency Question

Postby DST » Mon Dec 03, 2007 10:55 pm

My question is: If there are lots of images with transparencies, would it be faster to merge those images into large ones and and reload the entire image, or keep them separate and change only the parts that need to be....

For instance, i have a monster, who holds a sign, and the sign lights up. There is lots of transparency on the sign letters, because i am simulating light glow. So the monster(actor) stays the same, and the letters(a different actor) light up, thus creating transparency which slows down cpu...or i could get rid of the transparency and make the monster+sign+letters into one single image, and change the whole image when the letters light up (no transparency).

Which would be faster on a normal windows pc?

also, is there any way to load color palettes? i want my entire game screen, including all actors, to change from a red theme to a blue theme. Currently, i rerender everything in blue, and change to blue animations when that happens(there are over 50 unique actors and hundreds of clones in this game).

But if i could just swap the color palette....that would be SOO much easier.

Btw, Game Editor RULES! Flash is weeeeeeeeeeeek! (now we're all waiting for the online browser version of GE lol)
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Game Optimization Tips

Postby Fuzzy » Mon Dec 03, 2007 11:42 pm

I have three simple tips for optimization:

1. Remove for() and while() loops from draw events
2. Eliminate unneeded decisions for the compiler.
---Kill those if() statements. A lot of times people dont think about what will always happen and they just use if. In these cases the outcome can be decided before compiling to executable format.
---Other times, its possible to use some multiplying of variables to simulate a variety of outcomes
3. Precalculate complicated formulas and store them. If you know you need 16 sin and cos values, make an array and store them. Looking up a value in an array is a heck of a lot faster than calculating it every frame.

This is a great topic, please keep it going! I love this sort of conversation.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

PreviousNext

Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest

cron