[SDL] Downsizing resources
Alberto Luaces
aluaces at udc.es
Mon Nov 5 08:41:21 PST 2007
El Monday 05 November 2007 17:18:04 Miguel Pragier escribió:
> Alberto Luaces <aluaces <at> udc.es> writes:
> > El Monday 05 November 2007 13:42:52 Miguel Pragier escribió:
> > > At present, I work on 32 bits PNG images.
> > >
> > > The original 32 MB of PNG files, takes 110 MBs RAM, when the game
> > > runs..
> > >
> > > Would anyone know a way to downsize this consume?
> >
> > Load only an image when you need it, delete it as soon as you aren't
> > using it.
>
> Ok.
>
> In my games I have a lot of bonus ( jackPot-like ) animations.
> When I load my images just before the use, we experience a small delay.
> I read something about to shrink images resolution to 24 bits. Is it
> possible? Can I convert my images from 32 bits to 24 and keep the quality?
> My plattaform is Windows, and the desktop is ~32 bit colors~.
You can develop some more complex strategies, as loading the image for the
first time and not freeing its memory until you are sure it would not be
needed for a long time, what one would call a "cache". Maybe you have to
spend a little bit of memory for the possibly used graphics, but it shouldn't
be necessary to reach that 110 megabyte size. You will have to think about
the trade off between the loading delay and the amount of RAM used and adjust
the program accordingly.
If your display is 32 bit, you win nothing converting your graphics to 24 bit,
as you (or the driver) will eventually have to convert them again to 32 bit
at blit time, so you will experience lower performance.
More information about the SDL
mailing list