[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Big Scrolling Surfaces



As long as you don't use up the real memory of your user it should be
fine. On the other hand you could flip sections onto and off of the HD
as needed just like you do your zones but an outer circle around your
current 9 zones. You also might be able to predict what will be needed
next by the direction of travel. It is a lot of extra work if you know
the users have the memory that you will need. Remember that next year
the computers will be even bigger in every way but physical size. I
would think that speed might get you if you do it the big way.
Remember KISS.

My other thought is that a tile map only needs to show what is on the
screen. All the rest in in an array that references the tiles, so your
memory usage should just be the tile map and the on screen map parts
and the just off screen bits plus a small array of references that are
the real full map.

DEK

PS Jst because I say it does not mean it is right! :-) Good luck.

On 11/27/05, Kris Schnee <kschnee@xxxxxxxxxx> wrote:
> My project now involves an "infinite treadmill" of map zones, so that
> the player can walk forever in any direction. The game loads 25x25 areas
> of 64x64-pixel tiles (ie. 1600x1600 pixels), and loads _nine_ of these
> areas at a time so that the next zone is always visible beyond a zone
> boundary. (That is, the eight zones around the current one are visible.)
> This whole 3x3-zone region is drawn on a single Pygame surface.
>
> But this is a memory hog of a graphics system! 1600x1600x9 = 23,040,000,
> times 3 bytes per pixel should = 69,120,000 bytes for the surface!
> Windows' Task Manager reports "only" about 109,000 KB memory usage for
> my whole program, which uses not only this gigantic surface, but the
> main blitting surface (800x600) and various other loaded graphics etc.
>
> Am I nuts for using such a big surface, or should I expect it given what
> I'm trying to do? I eventually want to have an "overlay" layer for
> objects that the player can walk behind (like the tops of trees); am I
> going to need another huge surface, or should I handle them like
> sprites, blitting them directly to the drawing surface even though most
> will fall outside it? Would it make sense to trim the 3x3-zone area to
> more like half-a-zone in each direction, including only the areas the
> player can see without leaving the zone -- even though it'll then be
> less practical to save parts of the drawn image on loading a new zone?
>
> Kris
>
>