View previous topic :: View next topic |
Author |
Message |
sotrain515
Joined: 17 May 2010 Posts: 39 Location: Connecticut
|
Posted: Sun Jul 28, 2013 10:07 am Post subject: Memory usage / filesize |
|
|
I have a question about backdrop vs. rects when it comes to memory usage.
What I'm wondering is should I always use slice collections of rects as opposed to backdrops when possible? For example, if I had a checkerboard background that I wanted to use, I could either import one as a backdrop graphic OR spend some time and create one using a bunch of rects in a slice collection and then load that up. Is it a waste of my time to do that or am I saving space? |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Sun Jul 28, 2013 12:20 pm Post subject: Re: Memory usage / filesize |
|
|
sotrain515 wrote: | I have a question about backdrop vs. rects when it comes to memory usage.
What I'm wondering is should I always use slice collections of rects as opposed to backdrops when possible? For example, if I had a checkerboard background that I wanted to use, I could either import one as a backdrop graphic OR spend some time and create one using a bunch of rects in a slice collection and then load that up. Is it a waste of my time to do that or am I saving space? |
Backdrops are 320x200 256 color uncompressed bitmaps. That means that each backdrop takes up 64 kilobytes of space (64000 bytes)
It is a little more difficult to estimate the size of a slice, but I went through the source and just added up the sizes of the members of the data structures, and got about 208 bytes for a slice, plus 28 more bytes for rectangle-specific data on a rectangle slice. Together that is a total of That is probably a little low because I am sure there is some overhead I am not counting, so Just to be on the safe side I am going to round up to 300 bytes.
So if my estimations are close, you would have to have more than 200 rectangle slices in your checkerboard before the slice collection was larger than the equivalent backdrop. If your checkerboard was made out of 16x16 squares, that would require 130 rectangle slices, so the slice collection would be slightly smaller, but not small enough that the savings is really important.
So the short answer is, don't worry about it. They are both in the same ballpark. If backdrops are easiest to make, then use backdrops. If slice collections are easiest to make, use slice collections. |
|
Back to top |
|
 |
sotrain515
Joined: 17 May 2010 Posts: 39 Location: Connecticut
|
Posted: Sun Jul 28, 2013 1:33 pm Post subject: |
|
|
Okay, thank you. |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Tue Jul 30, 2013 12:42 am Post subject: |
|
|
Were you asking about RPG file size or RAM usage?
A simple image like a chequerboard pattern will compress to nearly nothing when the .rpg file is zipped. That goes for any image with large monochrome areas or similar repetition.
You would have to create hundreds of thousands of slices at once before the memory usage becomes a concern (but the game will start slow down way before that).
Either way unless you're trying to fit your whole game into 300KB you shouldn't be worrying about it. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
|