I haven't a clue where to post this considering you're all hoping to have new forum in the future. But I'll point this issue out in case it hasn't been noticed before.
I was doing some tests because of this thread (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=45242.msg607149#msg607149) when I discovered this multiple sprites in memory issue.
I create a dynamic sprite that is 6400x4800. The game memory usage becomes: 179,240 KB
I then assign object[0] the above mentioned dynamic sprite. The game memory usage becomes: 419,756 KB
I then assign object[1] the same sprite. The game memory usage becomes: 660,272 KB
Then the same with object[2]. The game memory usage becomes: 900,792 KB
..etc etc.. each time I run this test the memory usage is slightly larger or smaller - which I imagine is expected
There is approximately 240,516 KB difference every time a different object is assigned the same dynamic sprite.
It's significantly worse running the game with Direct3D.
Why would AGS do this? Discuss. Does this need to happen for some hardware reason I'm not familiar with?
Edit: I figured I'd check a sprite that wasn't a dynamic sprite and assigned it to 3 objects. It does the same deal as above.
I've never checked the sources, but maybe the engine has to make a copy of the sprite image whenever an object is to be drawn?
I sorta understand why it does this, but it should only really need to be doing this if the object is using scaling, tint, flipped, etc.
I imagine that's why it bloats the game each time an object is assigned a sprite because there are two instances of it. The original and the scaled, flipped, tinted, etc version.
Quote from: Ryan Timothy on Wed 08/02/2012 01:51:09
...it should only really need to be doing this if the object is using scaling, tint, flipped, etc.
Maybe this is exactly the reason. What differentiates an unmodified object sprite from a modified one? So, say, an object is zooming in from 10% to 150%. During this process, should the engine
not make a copy of the sprite and free the memory specifically at the frame where the scaling is 100%?