DynamicSprite.CreateFromFile possibilities and limits

Started by Sackboy, Mon 21/07/2014 13:04:02

Previous topic - Next topic

Sackboy

i am wondering how fast or slow the

Code: ags
static DynamicSprite* DynamicSprite.CreateFromFile(string filename)


function is. let's say i have 100 external sprites which i load into the game with the function above. i don't want to draw them all the time but on certain events one of them is drawn on a gui/object/screen. now i am not sure how much the engine can take related to:

- is there a limit to how many sprites i can store in variables at the same time (when does it get slow)?
- how many of these stored sprites can i draw at the same time before the game becomes slow?
- how does the image size influence the game speed?

has anyone experience with this?

Crimson Wizard

#1
First thing you should know is that there's literally no difference between sprite you add to game project and those created with DynamicSprite.CreateFromFile. They all work the same way.

Creating sprites from file at runtime takes some time, depending on size of image. But it is usually a matter of milliseconds.

Quote from: Sackboy on Mon 21/07/2014 13:04:02
- is there a limit to how many sprites i can store in variables at the same time (when does it get slow)?
There's a limit of 30.000 sprites, both fixed and dynamic ones summed up.
Storing high number of created sprites will not slow things down on its own, so long as your PC have enough memory. But so do other things, like audio items, room backgrounds, etc.

Quote from: Sackboy on Mon 21/07/2014 13:04:02
- how many of these stored sprites can i draw at the same time before the game becomes slow?
- how does the image size influence the game speed?
As I mentioned above, there's no difference between fixed and dynamically created sprite in regards to drawing speed. As for speed itself, nobody can tell beforehand, because that depends on such factors as sprite resolutions, CPU speed and graphics card you have, and graphics driver you use to run the game. Direct3D9 is significantly faster than software driver.

The larger sprite is, the more time spent to draw. But I think this is as much as is possible to tell in general. To know if that will affect your gameplay, you'll have to experiment.

Sackboy

oh, cool. i think i misread the manual then. if there is no difference then that's fine for me! ;-D thanks for the fast reply!

SMF spam blocked by CleanTalk