Performance query for CJ

Started by Radiant, Mon 30/07/2007 07:33:26

Previous topic - Next topic

Radiant

I have a question about performance in AGS.

Suppose I have 40-50 moving things on screen, that move in front of the background else but behind the GUIs. Would the fastest way to implement this be
* characters, using ignorewalkbehinds
* rawdrawimage (requiring RawRestoreScreen)
* GUI objects, using z-order to place them behind other GUIs

Gilbert

This is my guesses, from the fastest to the slowest:
1. GUI objects, using z-order to place them behind other GUIs
2. characters, using ignorewalkbehinds
3. rawdrawimage (requiring RawRestoreScreen)

Actually I can't tell for 1 and 2, but I suppose there may be more "automatic" interaction detection for characters (like stepping into regions, scaling, etc.) so using characters may involve more operations, however, for the case of GUI's it may also cause a speed impact if there're a lot of GUI objects and e.g. transparency on backgrounds are used. I'll say for a fairly fast computer the difference wouldn't be apparent.

For rawdrawing, I think raw-restoring the background in each loop involves a complete redraw of the screen and a complete change in the frame's bitmap buffer (i.e. includes changes in all off-screen pixels) so I think it can be slow in general (especially when you're using large scrolling room in hi-res and high/true colour), compared to moving objects/characters/whatever which involves only redraw of "dirty" areas (I think) in each loop.

Of course, it's up to CJ for the official answer.

Pumaman

I couldn't say for certain, it'd be an interesting experiment to find out.

By far the slowest part of this would be the drawing of the graphics to the screen, which is likely to be similar with all the proposed solutions. Potentially the GUI Objects route could be slowest because they are drawn to a temporary GUI buffer and then that buffer is copied to the screen.
RawDraw should be fairly fast, except that as Gilbert says the RestoreScreen would cause a whole screen refresh.
Therefore characters might actually be the fastest approach, however it does seem a rather wasteful use of characters.

What resolution is your game? If it's relatively low and it's not a scrolling room then RawDraw is probably the simplest and most effective approach.

Radiant

High resolution, not scrolling.

From your comments I surmise that characters would work best? It may be a technical waste but as long as it works... :)

SMF spam blocked by CleanTalk