IWETHEY v. 0.3.0 | TODO
1,095 registered users | 1 active user | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Map storage theory.
Just want to bounce this idea off to make sure it makes sense to everybody...

Maps are an array[][] of Tiles. A map has an "offset" indicating the smallest x size and y size of a tile. For example, a game like Civilization would have an offset of 1,1, while Ultima 6 (which used 16x16 "template" tiles) would have an offset of 16,16

There are three types of tiles:

Tile. A tile is the size of the "offset" value for the given map. This can contain multiple squares.

Template. A template holds a collection of tiles, indexed by their map location. This is useful for including landscape features in design tools, and possibly other things - for example, collecting an entire continent into a single collection for AI pathfinding purposes.

ChildTile. A childtile is a reference that points back to the array square that contains the Template for that "feature" - it will transparently request the proper tile from it's parent and hand it back to the program.


Can anybody think of a better way to store this, or additional useful tile types?

Thanks,
Thane
After 9/11, Bush made two statements:
1. "Terrorists hate America because America is a land of freedom and opportunity."
2. "We intend to attack the root causes of terrorism."

Sounds like everything is going according to plan.
New You might investigate quadtrees
[link|http://www.flipcode.com/tutorials/tut_octrees.shtml|http://www.flipcode....tut_octrees.shtml]

They're useful for more than just storage. The link is about octrees, but there's a 2D example in the middle.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Thoughts
Are you talking about the visual information or the game information or some combination of both?

I know that some games keep two maps, one that contains the visual information and one that contains the game information. Using the terms you gave above, the game information map would be scaled per square while the visual map would be scaled per tile.

Have you considered the z-order issues and the possibility layering multiple tiles? Say I'm building an RPG and I drop a tree on the map. I want the leaves and branches to be drawn on top of a character walking beside the tree but the ground still has to appear below the character. What about the trunk of the tree? In an isometric engine it may go behind or on top of the character depending on where the character is.

You can simply that sort of problem by saying the tree has to be game object and that terrain is a single layer drawn at the bottom. But going that way can cause many games to be forced to create a large number of game objects that are really static terrain features.

Jay
New Generic map function.
The "map" class is a generic 2d map, which will be extended to handle both display and data storage. By doing multiple rendering passes from the bottom to the top, you can "overlay" the "higher-order" stuff on top and create a pseudo-3d look.

Right now, I'm focusing on data storage, and not concerning myself with the graphics display - if I write the classes in a generic-enough template, it can easily be adapted to either purpose.
After 9/11, Bush made two statements:
1. "Terrorists hate America because America is a land of freedom and opportunity."
2. "We intend to attack the root causes of terrorism."

Sounds like everything is going according to plan.
New What is the density of the data?
Is every tile occupied or are most (some) empty?

For instance, a relatively sparse space can be a dictionary of points (integer pairs). It'll work fine. You don't have to have arrays of arrays and if you don't have fully populated space its wasteful.

One more thing to think about.



"Packed like lemmings into shiny metal boxes.
Contestants in a suicidal race."
    - Synchronicity II - The Police
Expand Edited by tuberculosis Aug. 21, 2007, 06:31:00 AM EDT
New Well, that depends.
For a game like "Empire", you have two terrain types:

Water
Land

For a game like Civilization, you have about 8-10 different terrain types, plus two different specials per terrain type.

For a game like SMAC, you have 3 nutrient levels, plus 3 mineral levels (9 types), plus three resource bonus types (27 combinations) plus altitude variable from ~-3000 feet to ~3000 feet, plus a whole HOST of terraforming types... (Boreholes, Echelon Mirrors, Water Condensors, Solar, Forest, Fungus, Farm, Nutrient Enrichers, Kelp Farms, Tidal Generators, Deep-Sea Mines) Plus you need to keep stateful information about terraforming as it progresses on a square.

Oh, and then there's special terrain like the Borehole Cluster, or Mount Planet, or the Uranium Flats... ;)

Yeah, there's a lot there.
After 9/11, Bush made two statements:
1. "Terrorists hate America because America is a land of freedom and opportunity."
2. "We intend to attack the root causes of terrorism."

Sounds like everything is going according to plan.
New My advice...
unless memory/disk usage is a constraint (it shouldn't be), track each tile.

Furthermore, definitely go with an object-orienteed model, each tile should have a x,y,z - special attribute, terrain type (including ocean), movement modifiers, etc.

FreeCiv has some (limited) stuff on this - their code is in C and they really only track the x,y (they create and throw away the z iirc).
New Sparse data
I think Todd meant sparse in the sense, does every array entry have something in it? In that sense density is going to be 100% for most games, as every square is going to have something in it.

As for SMAC, you would be nuts to try and create a seperate terrain type for every possible combination. Create terrain types for the basic types and then have properties of each square that cover improvements and terraforming. This is part of what I was talking about before with overlaying tiles. You create a grass area with a road by drawing the grass then drawing the road on top of it.

Also, I think Civ and SMAC keep terraforming progress in the units not the square. But doing it in the square would be simpler at the expense of using more memory.

Jay
New Oh GOD no I'm not insane...
Yeah, seperate properties for each distinct property of the terrain type. Good LORD, I'm not THAT dumb. :)

As towards whether each square will have data in it:

It depends.

I'm currently looking at an indexed list for the map array - using the (x,y) position as the index. This will let me play some fun games with map handling, including the possibility for the entire map to actually be a fractal formula, or whatever...
After 9/11, Bush made two statements:
1. "Terrorists hate America because America is a land of freedom and opportunity."
2. "We intend to attack the root causes of terrorism."

Sounds like everything is going according to plan.
     Map storage theory. - (inthane-chan) - (8)
         You might investigate quadtrees - (admin)
         Thoughts - (JayMehaffey) - (1)
             Generic map function. - (inthane-chan)
         What is the density of the data? - (tuberculosis) - (4)
             Well, that depends. - (inthane-chan) - (3)
                 My advice... - (Simon_Jester)
                 Sparse data - (JayMehaffey) - (1)
                     Oh GOD no I'm not insane... - (inthane-chan)

Anyone who would spend $5000 on a laptop is either Todd, or out of his mind.
66 ms