Skip to main content
gamedev.net
🔒 Locked

Map Format

Started by Edison Bright 3 replies 350+ views
Original Post
Edison Bright
Edison Bright
There is so much information that I need to store in a map ... how do I go about this? -Map Name -Map Size -Player Starting location -For Each Tile -Tile Graphics -Tile Walkability -Tile Event (a script) -Enemies -Animated Graphic -Size -Location -Remaining HP -AI Script -Powerup -Type (HP up, shield, ammo) -Location -Map Goal -Link to next map And more importantly, how do I create an editor for all of this? Making a editor that changes the graphics of a tile is not hard (just change in ids in a array) but for all of the other stuff I have no idea ... especially the scripts! Do I have to write my own fucking programming language in order to write a game? Thanks
Peace!- Edison Bright
Metal Typhoon
Metal Typhoon
quote:
Original post by Edison Bright
There is so much information that I need to store in a map ... how do I go about this?

-Map Name
-Map Size
-Player Starting location
-For Each Tile
-Tile Graphics
-Tile Walkability
-Tile Event (a script)
-Enemies
-Animated Graphic
-Size
-Location
-Remaining HP
-AI Script
-Powerup
-Type (HP up, shield, ammo)
-Location
-Map Goal
-Link to next map

And more importantly, how do I create an editor for all of this? Making a editor that changes the graphics of a tile is not hard (just change in ids in a array) but for all of the other stuff I have no idea ... especially the scripts! Do I have to write my own fucking programming language in order to write a game?

Thanks



how about sliping that into like 4 parts .. it would be easier.. a map doesn''t need all that informations like Ai , Link to next map , remanining hp , enemies and such ....
Metal Typhoon
glassJAw
glassJAw
Here''s what my map format looks like:


FileID (DWORD) - Identifies this as a map file for my game

Map Name (64-byte string) - Name of map

Map Width (DWORD)
Map Height (DWORD)


Then all of the tiles that are in the map.
The tiles look something like this:


Moveable (BOOL)
MoveCost (FLOAT)
Image (DWORD)


And I have Map Width * Map Height of them in the file.
glassJAw
glassJAw
The editor is easy

I''m guessing you have an array of ints or something that represent the images for each tile?

Try this:

struct TILE
{
int iImage;
BOOL bMoveable;
int WhateverElse;
};

Then you make an array of TILEs.

When you''re writing the save routine, all you do is put a header of all the map info (map size, starting locations, whatever) into the file, then dump the tile array into it.
Pseudo
Pseudo
Actually I agree with Edison Bright that all those things "could" be put into a map file, but if you''re not sure how to make a map file then I''m sure you don''t need all those things in YOUR map file. Basically, if you don''t know how, then you should keep it simple. You aren''t going to need AI scripts/Tile Events in the map file until you are capable of making and enterpreter, script language, and a game that needs them. I would start simple like what glassJAw was describing. Just create a format to store the graphics. Then after thats working is should be easy enough to add some of the other features like start location, map goals, and hard coded enemies. That way you still have a good file format but its not overly complicated.

One thing to keep in mind. you''re going to want it to be extensible. If you do decide to add AI scripts and the like, you''re not going to want to have to rewrite a bunch of code because the old format isn''t compatable. The simplest way to do this is to break the file into section (with size information) that way, you can just add stuff to the end of the file and the "chuncks" can be ignored or used. if you want ot get fansy, just use XML.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.