Rules for loading images at one time ?

is there any rule of thumb for loading/referencing a bunch of images at once for a level/a whole game ?

imaging a 2d-scroller. should i reference all tiles for a level at the beginning and where is the limit ?

or a card game with different deck-themes … loading on demand or at the beginning ?

finally, what size does an image-reference have ? is the whole pixel-array loaded into memory (so memorysize ~ image size) ?

In General…

Game assets get loaded before game play starts. This is in order to prevent delays in user response.

So for instance, in a level based game, typically all assets get loaded before the level play starts.

[quote]finally, what size does an image-reference have ? is the whole pixel-array loaded into memory (so memorysize ~ image size) ?
[/quote]
Depends on what kind of Image you are talking about. Java supports many types (Images, BufferedImages, Volatile Images, etc) In general all types immediately allocate the memory necessary to hold the entire image in the appropriate form.

The memory though does not necc contain all the Image data. Using the traditional Toolkit getImage mechanisms the memory is allocated immediately but the image is loaded into it asynchronously. If you wish to wait until the image data is fully loaded then you need to use a MediaTracker object.

A Volatile image represents shared video memory so a VolatileImage can lose its contents at any time and need to be refreshed.

ok, i my view lays on the getImage() methods used with a mediatracker. in that case the data is completely stored in memory. my problem is, that i have no “feeling” about memory usage. if i program a 2d-space-shooter like Xenon or Raptor, then i have many background tiles, the ship sprites, weapon effect an so on. but it seems to be necessary for non stocking performance to load all at the beginning …

ohh, btw:

perhaps you know 2d-games (especially for old game-stations) like zelda. there you are only free to move over a map which is perhaps 3times of monitor view. after that the avatar exits and reaches another “larger” map.
is this limit set for loading new images or only for limiting the tile-map array size ?

[quote]after that the avatar exits and reaches another “larger” map.
is this limit set for loading new images or only for limiting the tile-map array size ?
[/quote]
Bit of both, but mainly the second I’d say (going from experience coding the GBA). Since the consoles actually had built in support for tile rendering they have a section of ram reserved for the tile map, which is limited in size (and varies depending on the draw mode). Typically max size is from 256x256 to 1024x1024.

Also, loading in images while running is much simpler on these consoles - the data just has to be streamed in from one place on the catridge to the vRam, no modification needed so DMA method can be used.

For your app, just load everything at the start of a level (and try and cache images already loaded from the previous one). If you find thats not working then you can rework it later.

Think about web pages that load 400x400 images or so. Thats not too unreasonable is it (a 50k gif?)? Think of how many tiles and sprites you can fit in one 500x500 image. I’ve never had an artist, so thats never been a problem for me!

Those old consoles are pretty neat; I’ve been thinking of a ‘general purpose’ console applet with a simplified vm; heh heh and mode7 rendering… alot of work for little gain though :frowning:

IF you ask me… rules are meant to be broken… it more of a guideline rather than a rule… as there are many ways good and bad, fast and slow ways to solve the problem… ^^

ariiiise, zombie thread! feel life RUSH into your veins!!

hummm

lolz… I really think reading older threads makes you more wiser… and remember the times when you had to put your first post… really makes you seem like you were an idoit and that time and now a pro at this time… ^^

yeah but why reply? surely the conversation is over after 3 years :slight_smile:

See if anyone has any bright ideas to the topic… some people do not realy see the date before posting (No insults to those people out there!) SO yah… hope that these posters will post something userful… haha