how to create illusion of large backgr. images

hi,

my next project will be some game with a very large playing field. the scrolling should be as soft as possible.
i’m wondering if any of you could give me some hints how to accomplish that.

for my first game i was not able to load background images larger than 2000x2000 px. i had OutOfMemoryExceptions as soon as the loaded image was larger than that.

therefore i’m trying to figure out some smart technique which creates the illusion that there is a large bg image. maybe one of you knows a cool tiling mechanism or something else… ???

what do you think?

I’m having a similar problem. Is your issue with the loading of the image, drawing of the image, the scrollpane, etc?

The first thing I would try is lowering the bit depth of the image to reduce the amount of memory it uses.

If your project is able to use tiles for the background then you should definately go that route. You’ll save memory and increase performance drastically.

What do you mean by a “smart technique” for tiling? If all you need is a static background that doesn’t use layers then you can create a 2 dimensional array that represents your x,y coords and draw from that. There are tons of docs on that. Let me know if you need help finding a good one and I’ll post some links.

My project is using a large gif as the background layer with multiple layers of tiles drawn overtop of it. (I’m having mem problems with the large image too though)

Are you both forgetting to set -Xmx and -Xms switches. While 2000x2000 is a big image it should be possible to load assuming you raise the maximum heap size from the default (16?)

Kev

[quote]Are you both forgetting to set -Xmx and -Xms switches. While 2000x2000 is a big image it should be possible to load assuming you raise the maximum heap size from the default (16?)

Kev
[/quote]
… never done that before. thx for the hint. anyway, i think the best way is to do some form of tiling. this way i should be able to create worlds of any sizes because no large image is loaded.

[quote]I’m having a similar problem. Is your issue with the loading of the image, drawing of the image, the scrollpane, etc?
[/quote]
in my first game the image couldn’t even be loaded. i got an exception right at the start of the game.

good idea!

that would be great, thx.

I set these flags -Xms256M -Xmx512M. I’m still hitting heap size errors.

The total size of the background gif < 10 meg on the hard drive. Does the size increase when loaded into memory?

MoD: Try some of these links:

For general info on what types of isometric tiled systems are out there with screenshots of example games
http://www.bookofhook.com/Article/GameDevelopment/IsometricEngineDevelopmen.html

Gamedev.net has some good tile based articles
http://www.gamedev.net/reference/list.asp?categoryid=44