Page 2 of 4

PostPosted: Mon Aug 07, 2006 12:30 am
by marathon332
That's what I thought.

Thanks a lot for your help Makslane...

--Steve

PostPosted: Mon Aug 07, 2006 11:25 am
by irblinx
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.

PostPosted: Mon Aug 07, 2006 11:59 am
by marathon332
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

PostPosted: Mon Aug 07, 2006 7:43 pm
by irblinx
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

PostPosted: Mon Aug 07, 2006 8:40 pm
by marathon332
irblinx:

I was wondering about fonts and FPS myself...

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

--Steve

PostPosted: Mon Aug 07, 2006 9:36 pm
by makslane
The characters used in the ttf font are render before use.
After export, there is no more ttf fonts, only the images of characters.

PostPosted: Wed Aug 09, 2006 1:21 pm
by marathon332
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

PostPosted: Wed Aug 09, 2006 3:41 pm
by Novice
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?

PostPosted: Wed Aug 09, 2006 4:02 pm
by Game A Gogo
why dont we also make a topic about the game size also??

PostPosted: Wed Aug 09, 2006 5:02 pm
by makslane
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.

PostPosted: Wed Aug 09, 2006 5:04 pm
by makslane
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.

PostPosted: Thu Aug 10, 2006 2:57 am
by 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!

PostPosted: Wed Aug 16, 2006 6:36 pm
by marathon332
[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

Transparency Question

PostPosted: Mon Dec 03, 2007 10:55 pm
by DST
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)

Re: Game Optimization Tips

PostPosted: Mon Dec 03, 2007 11:42 pm
by Fuzzy
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.