1. medium-xxxlarge 2d map system: Request comments!

!!!!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 message » categorize

2. Re: medium-xxxlarge 2d map system: Request comments!

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

I've seen longer (in FIDOnet), so this is nothing :)

>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:

I have a book: Teach Yourself Game Programming In 21 Days. It's C and I
kinda gave up C but I understand it enough to read the code but not code
the code :)

Try this:
Load up a bitmap image
Make a converter to convert 8x8 or 16x16 squares to arrays and output to
a file for easier access or convert on the fly:
{{  0,  0,  0,  0,  0,  0,  0,  0,
   10, 10, 11, 10, 10, 10,110,240,
.
.
.
   10, 45, 85, 21,231,199, 10, 30}
 { 30
.
.

}
For the bitmap image. These will be the backgrounds. (Front will be
harder but the same principle)

Take background[1] and display that whereever you see 1 in the main map:
Main map will be a 3d grid. 2 dimensions for x/y on the map, and
dimension 3 is the detail:
Map[1][1] = {1, 3, 4, 4, 5, 6, 1, 9
             1, 3, 1, 3, 6, 2, 1, 4
                etc
Map[1][1] will the upper left corner in the universe. Moving to the right
will give you Map[1][2] and moving down one screen from there will give
you Map[2][2]...
In the 3rd dimension, 1 will mean bitmap[1], 2 will be bitmap[2] and so
on. Display the bitmap (using Display_Image()) for the appropriate
background. Understand? This will produce a Legend of Zelda (NES game)
type look. And use much less memory. (Only for the bitmap sprites and the
map lookuptable)

new topic     » goto parent     » topic index » view message » categorize

3. Re: medium-xxxlarge 2d map system: Request comments!

>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.
>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)

I have some questions:

-> It will be designed for mode 19 or for 257 (I think the ideal for games
like Warcraft), 259 (too slow) ?
-> The screen will scroll tile by tile like War2 or pixel by pixel like
Command & Conquer ?
-> How are you going to transform the map variable, containing information
like what kind of ground (grass, water), into something the user can see ?
By generating an image of the current view and displaying it, by displaying
tile by tile, row after row or you'll generate that 3 X 3 tiles image and
display only the desired region or none of the above ?

Now, a comment:

If you use a scrolling like War2 (tile by tile), isn't it better to
generate only the new row or collumn needed intead of generating 4 new rows
each time the player scrolls the screen ?
---
Ricardo Niederberger Cabral
rnc at infolink.com.br

new topic     » goto parent     » topic index » view message » categorize

4. Re: medium-xxxlarge 2d map system: Request comments!

Anders Eurenius wrote:

> 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)

Would the four bytes per square be enough to store all the "square"
information I would want, such as terrain type, distance above sea
level, any cities in the square (its name, size, location, etc.), any
creatures in the square, any treasure in the square, portals to other
locations, etc., etc.?

I guess you could have pointers or flags for certain items, but 4 bytes
doesn't sound like enough.

Back to an earlier post of mine, I'm still interested in world-builder
software, if anybody has some. Remember Seven Cities of Gold? If
somebody could just pull the continent-forming algorithms in that jewel
I'd be set!

Thanks!
ck

new topic     » goto parent     » topic index » view message » categorize

5. Re: medium-xxxlarge 2d map system: Request comments!

> Would the four bytes per square be enough to store all the "square"
> information I would want, such as terrain type, distance above sea
> level, any cities in the square (its name, size, location, etc.), any
> creatures in the square, any treasure in the square, portals to other
> locations, etc., etc.?
>
> I guess you could have pointers or flags for certain items, but 4 bytes
> doesn't sound like enough.

Oh! That was only an example! I'm thinking of making the number of dimensions
dynamic aswell. Comments anyone?

9-dimensional RPG anyone?

> Back to an earlier post of mine, I'm still interested in world-builder
> software, if anybody has some. Remember Seven Cities of Gold? If
> somebody could just pull the continent-forming algorithms in that jewel
> I'd be set!

Uh-huh. (Haven't seen it, but I do have an active imagination) Sorry! Can't
help you with that though!

> Thanks!
> ck

Anders

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

new topic     » goto parent     » topic index » view message » categorize

6. Re: medium-xxxlarge 2d map system: Request comments!

> >   !!!!WARNING!!!!
> >   !!!LONG POST!!!
>
> I've seen longer (in FIDOnet), so this is nothing :)

Hehe...

> I have a book: Teach Yourself Game Programming In 21 Days. It's C and I
> kinda gave up C but I understand it enough to read the code but not code
> the code :)

Yeah, me too, but I guess I'll have to learn this fall, since it'll be used in
class...

Been there, Done that...

> Try this:
---8<---
--->8---
> background. Understand? This will produce a Legend of Zelda (NES game)
> type look. And use much less memory. (Only for the bitmap sprites and the
> map lookuptable)

Sure I understand, that's not the problem. I don't have time or energy for a
big project, and I really don't want to screw around with trying speed up
graphics! I might make some kind of Hack or Moria-style game though.

Oh yeah! The thing about this project is it keeps the "world"-map on disk and
read only the pieces it needs, saving even more memory. (Or making larger
worlds possible)

Anders

ps. Very nice explanation btw!

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

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu