Jump to content


Photo

.map Fileformat


  • Please log in to reply
17 replies to this topic

#1 Oldtype

Oldtype

    Sergeant

  • Forum Members
  • PipPipPip
  • 67 posts

Posted 22 April 2006 - 03:41 PM

Hi

Where can I find info on the .map fileformat?
The Tileset thingy was pretty easy thanks to Llyrs post here:
http://www.xcomufo.c...topic=242024650
I wanted to write a little mapviewer, wich may become more later on.

Oldtype

#2 nappes

nappes

    Sergeant

  • Forum Members
  • PipPipPip
  • 74 posts

Posted 22 April 2006 - 04:43 PM

The first three bytes are the dimensions (width, length, height), then comes a list of all the map cells as chunks of four bytes, each byte representing one of the map elements/planes (Floor, Left wall, Right wall, and Object, respectively). AFAIK, there's nothing more to it.
Posted Image

#3 Oldtype

Oldtype

    Sergeant

  • Forum Members
  • PipPipPip
  • 67 posts

Posted 22 April 2006 - 06:28 PM

OK, thank you.
What is the first cell though?
I would guess that it is like this:
1|3|6|...
2|5|...
4|...
...
Turn this a bit to the right to match isometric view.
Starting with the lowest Maplevel to the highest.
Is that correct?
That means this format can not save maps bigger than 255X255X255 and can not have more than 255 different tiles/objects?

#4 Hobbes

Hobbes

    UFO2000 Staff

  • Moderators
  • PipPipPipPip
  • 719 posts

Posted 22 April 2006 - 09:06 PM

OK, thank you.
What is the first cell though?
I would guess that it is like this:
1|3|6|...
2|5|...
4|...
...
Turn this a bit to the right to match isometric view.
Starting with the lowest Maplevel to the highest.
Is that correct?
That means this format can not save maps bigger than 255X255X255 and can not have more than 255 different tiles/objects?

<{POST_SNAPBACK}>


Each map file for UFO2000 can have 10, 20, 30...up to 60 squares on its side. Height for all maps is 4. Maximum tiles are 256, but 2 of those are automatically reserved, leaving.

The first batch of cells seems to represent height level of 1, then it either represents the individual lines or columns (I never figured out which is the direction) of the square. Then it represents the next level, until 4.

#5 Sporb

Sporb

    UFO2000 Staff

  • Moderators
  • PipPipPipPip
  • 739 posts

Posted 22 April 2006 - 09:55 PM

possible map editor? this sounds like just the thing! even if it doesnt, a map veiwer would still be an invauble tool. Goodluck dude

#6 Blood Angel

Blood Angel

    Captain

  • Forum Members
  • PipPipPipPip
  • 513 posts

Posted 23 April 2006 - 03:38 AM

Yes. You would be the next Daishiva. In fact, it might be a good idea to contact him.

#7 Oldtype

Oldtype

    Sergeant

  • Forum Members
  • PipPipPip
  • 67 posts

Posted 23 April 2006 - 04:26 AM

No, I do not intend to mess with all the old files from the original. Maybe I will write a programm that converts the stuff from original X-COM to my format, but not the other way.
If I make a mapeditor I will only include the newer LUA/png format/tileset stuff.
Say is the moonbase.lua file actually used?
I parsed the lua file now and aplied the info to the moonbase.png file, so that all the tiles mapped in the lua file are shown in my program.
Strange thing is that not all tiles that are in the png show in my program and one of the white placeholder boxes does show up.

P.S. parsing lua files is no fun

#8 nappes

nappes

    Sergeant

  • Forum Members
  • PipPipPip
  • 74 posts

Posted 23 April 2006 - 04:49 AM

Not all of the tiles in moonbase.png are implemented in the lua. Partly because of the limitations in using daishiva's editor for what it was not intended, partly because some things are not supported by the UFO2000 engine yet. (such as the animated doors) There may also be some junk in the lua, explaining the placeholder box appearing in your viewer. The moonbase terrain is still largely unfinished (I consider it only approximately 25% done), so I have not been too careful in trying to clean the thing up.

Edited by nappes, 23 April 2006 - 07:49 AM.

Posted Image

#9 Sporb

Sporb

    UFO2000 Staff

  • Moderators
  • PipPipPipPip
  • 739 posts

Posted 23 April 2006 - 05:33 AM

if your after a mapless but complete terrain, I can send you Tron. Its an odd terrain but ive used Nachtwolfs tilemaker to create the LUA along with accurate hitboxes and animated tiles. It doesnt, however, have any sort of mapdata with it.

Edited by Sporb, 23 April 2006 - 05:41 AM.


#10 Oldtype

Oldtype

    Sergeant

  • Forum Members
  • PipPipPip
  • 67 posts

Posted 23 April 2006 - 09:06 AM

if your after a mapless but complete terrain, I can send you Tron. Its an odd terrain but ive used Nachtwolfs tilemaker to create the LUA along with accurate hitboxes and animated tiles. It doesnt, however, have any sort of mapdata with it.

<{POST_SNAPBACK}>

That would help a lot, thank you.
I am not at the map reading stage yet anyway, but it seems to be pretty simple to implement from where I am now.
Wich reminds me:

Where does the .map file start to list those tileboxes anyway and by wich order does it go on to list them?

#11 nachtwolf

nachtwolf

    UFO2000 Staff: Leader

  • Moderators
  • PipPipPipPip
  • 310 posts

Posted 23 April 2006 - 03:22 PM

Using a HEX editor you will see the following :

.map file format :
Contains header info : 00 00 00
Width, height, number of levels.
Every value is a Hex number... so 10 = 0A, 20 = 14; Those two values are the only ones valid for width and heigth.

After the header, all following values represent 1 tile for each set of four numbers defined as : 00 00 00 00
first value is floor tile index.
second value is left wall index.
third value is right wall index.
fourth value is object index.
so 10 x 10 x 1 would be described by 100 tiles (403 values), but 20x20x4 would be described by 1600 tiles (6403 values).
Posted Image

#12 Oldtype

Oldtype

    Sergeant

  • Forum Members
  • PipPipPip
  • 67 posts

Posted 23 April 2006 - 03:37 PM

I know that much, nappes already wrote that.
But I want to know where the tilelist starts.
I mean:
Where is the first tile located on the map and where the second and so on.

Edited by Oldtype, 23 April 2006 - 03:38 PM.


#13 nachtwolf

nachtwolf

    UFO2000 Staff: Leader

  • Moderators
  • PipPipPipPip
  • 310 posts

Posted 23 April 2006 - 05:36 PM

I know that much, nappes already wrote that.
But I want to know where the tilelist starts.
I mean:
Where is the first tile located on the map and where the second and so on.

<{POST_SNAPBACK}>


from what I seen, tile are ordered this way :

On the battlescape... from Top to Right, Top-Right to Bottom-left.
Posted Image

#14 Oldtype

Oldtype

    Sergeant

  • Forum Members
  • PipPipPip
  • 67 posts

Posted 23 April 2006 - 08:37 PM

Yes, thank you.
That worked, it shows all the moonbase maps now. =b
The .map file starts listing in the northern corner and goes on to the eastern corner, lowest level first.
Too bad there is only that one tile/map-set in that format as far as I can tell, all the others seem to use data from X-COM 1&2.

#15 Sporb

Sporb

    UFO2000 Staff

  • Moderators
  • PipPipPipPip
  • 739 posts

Posted 23 April 2006 - 08:42 PM

Here be the terrain named Tron. In the archive you will find the Tile graphics, the LUA and probably some hidden files windows slipped in there when i wasnt looking. This is probably the first look at the completed tiles anyone has had. This tileset is completely free of all copyrighted Xcom materia.

OT: making all tiles transparant on the map has no effect on performance on my Computer - a prlim version of it can be made avliable to those who might want to test performance on older computers. This intrigues me. If its possible to make all tiles transparant, would it be possible to intergrate a scnen into the black background of the map? like A paralax background depicting a mountain range or a wasteland? If we could, it means we could make cool floating maps instead of just the square ones

Edited by Sporb, 23 April 2006 - 10:02 PM.


#16 Oldtype

Oldtype

    Sergeant

  • Forum Members
  • PipPipPip
  • 67 posts

Posted 27 April 2006 - 11:22 AM

Sporb the png in your tileset differs from the moonbase png, I do not know who used the "correct" way, but the difference did cause problems for me.
The problem for me is that your png is 2 rows smaller, wich causes problems when I try to cut out the tileimages in the last row. If you add an empty row of pixels at the top and the bottom it will be the same.

#17 Oldtype

Oldtype

    Sergeant

  • Forum Members
  • PipPipPip
  • 67 posts

Posted 27 April 2006 - 07:19 PM

Funky, seems like I made a mistake.
Highest level is first in the .map not lowest. <_<

#18 Sporb

Sporb

    UFO2000 Staff

  • Moderators
  • PipPipPipPip
  • 739 posts

Posted 27 April 2006 - 09:21 PM

that should be easy to correct (Tron.png) if nappes png is different its a fair bet its mine that is faulty since his png is actually used in a map. I'll fix it and re-post