Archived

This topic is now archived and is closed to further replies.

RuneLancer

Map Format -- Can't think of any good ones...

Recommended Posts

RuneLancer    253
I''m trying to find a format I could use to store the maps in my game. What I want is a means of having a heightmap with objects on it. That is, I want to have a continuous irregular plane, but with stuff on it such as trees or houses, or whatever. I''ve been trying to figure out a way to efficiently handle this, but I''m all out of ideas. Current, I store stuff as so... nTri TextureID U1 V1 X1 Y1 Z1 U2 V2 X2 Y2 Z2 U3 V3 X3 Y3 Z3 CR CG CB SOLID? TextureID U1 V1 X1 Y1 Z1 U2 V2 X2 Y2 Z2 U3 V3 X3 Y3 Z3 CR CG CB SOLID? TextureID U1 V1 X1 Y1 Z1 U2 V2 X2 Y2 Z2 U3 V3 X3 Y3 Z3 CR CG CB SOLID? Where U and V are the texture coordinates (mainly for the sake of stretching/tiling stuff properly) and XYZ are positions in the X, Y, and Z planes. Essentially, this is for each vertice in a triangle. CR, CG, and CB are colors to which I tint the textured triangle (for instance, if I want to have a blue house and a red house without creating two textures). Solid is a flag saying wether the player can move through the area this polygon occupies or not. I planned to have a list of polygons which I could just render in-game, effectively shaping my world however I see fit. The problem is, this takes up a lot of space. A map containing 80,000 polygons is way over 5 megs! Any suggestions? Map format resources would be welcomed. I don''t want to use a pre-made format, btw, so that solution is out. I''ll be storing a couple of other things in my map, such as sprites and event data, so this has to be a custom format. Thanks!

Share this post


Link to post
Share on other sites
SoDdit    157
you could make the heightmap/textures for the terrain seperate from the objects on the terrain. use a script or summit to load them in.

Share this post


Link to post
Share on other sites
RuneLancer    253
quote:
Original post by SoDdit
you could make the heightmap/textures for the terrain seperate from the objects on the terrain. use a script or summit to load them in.


That''s one idea I''ve had, and it sounds very appealing. Very easy to implant and it would reduce the amount of polygons I''d need for the objects on my map. That''s one possibility...

Share this post


Link to post
Share on other sites
Palidine    1315
definitely keep them seperate to begine with, it's way easier than some complicated all in one format. each object should be a seperate chunk of data. you can, of course, compact them into one file format (maybe the .cab format) or just something simple:


(stored as binary format)
int numObjects
//repeated numObjects times
int objectID
int numTextures
//repeated numTextures times
int sizeof texture name
char* texture name
long sizeof model data
model data


in your code it'll probably be easiest at first to keep things chunked out as objects for the time being. eventually you might want to take all the static objects and just turn them into a polygon soup divided up in a BSP tree or OctTree/QuadTree.

-me

[edited by - Palidine on May 25, 2004 1:37:30 PM]

Share this post


Link to post
Share on other sites
not sure if this will help you but my terrain is generated procedurally, and then i move it around to customize it with my editor. for my terrain i simply store the random seed and any offsets. then follow the other guys advice and script your objects in, as they will continue to grow plenty of necessary properties you''ll want to store.

Dredd
________________________________________

"To die with your sword still in its sheath is most regrettable" -- Miyomoto Musashi


Share this post


Link to post
Share on other sites