medium-xxxlarge 2d map system: Request comments!

new topic     » topic index » view thread      » older message » newer message

!!!!WARNING!!!!
   !!!LONG POST!!!

I am thinking of making a 2d-map-engine. (useful, perhaps, in the games people
seem to be writing...) Anyway, I've been thinking something like this:

Maps are segmented into regions so the map can be far bigger than can fit into
memory. This is still pretty simple:

3x3 regions are kept in memory. (Each region is bigger than can be shown on
screen)

The "player" (Or whatever) is always in the center "region". When player steps
near the edge, the screen can still show his surroundings, because the
neighbouring regions are already in memory, right there (seamlessly) with
center one.

When player crosses the edge into another region, the regions furtest away are
thrown out, the in-memory map shifted so the player is again in the center
region, and the new neighbours are loaded from disk. (If the map has somehow
been altered, that could be saved, so that it'll still be there when you come
back...)

Using only normal integers, maps can be of size ~1Exa-squares^2 (about one
billion billion squares on the side, or about 10^36 individual squares on the
entire map. Doing the math: Example: If you have the maximum size map, and for
each square need four bytes to store your data, you would however need about
5*10^27 *Gb* of disk-space just to store it...hehe)

The map would of course not be a big collection files, but one big file,
because I feel it'd be easier to manage that way...

There would of course be a map editor in the package, but unless someone does
an interface, it'll be all text-mode...

Hey Craig! could we have some way of doing the loading in the background?
(so it doesn't chop up the smooth gameplay?)

openmap(?,?)
closemap(?,?)
movemap(?,?)
savemap(?,?)
loadregion(?,?) -- low level calls, use
saveregion(?,?) -- move-/savemap instead!

COMMENTS PLEASE! ANY QUESTIONS?

Anders

-------------------------------------------------------------------
Anders Eurenius <c96aes at cs.umu.se> ICQ UIN:1453793
Computer Science/Engineering student at the university of Umeaa
-------------------------------------------------------------------

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu