Author Topic: Xenogears worldmap info  (Read 3917 times)

Micky

  • *
  • Posts: 300
    • View Profile
Xenogears worldmap info
« on: 2006-01-06 12:30:36 »
Just a tiny bit about worldmaps in Xenogears: The map is stored in the last two files in each directory, once row-by-row and and once column by column, probably to optimise the disk-access when updating edges.
The map is stored in 16x16 tiles of 2k, each tile starts with four 9x9 sub-tiles of 4 byte per entry followed by a 16x16 subtile of 2 byte per entry.
The elevation is in the first byte of the 4 initial subtiles.
I've got some code to display it, but it is a bit boring without textures... Does anyone have an idea what compression is used? It doesn't seem to be LZS, because the data doesn't make sense.
(I got my own code to display the battle stages as well, but it is terribly unoptimised - but the stages really look cool, don't they? Maybe I'll port it to GameCube at some point. Where are the filed maps stored?)

Akari

  • *
  • Posts: 766
    • View Profile
Xenogears worldmap info
« Reply #1 on: 2006-01-06 19:31:48 »
The first file in map dir (for example 26/3964) are archived pack. The second file in pack are usual 3dmodel. Though i still don't know where textures are. Hope you find it =) There are all 3d models placed on map (cities, dungeons, yagdrasil)
Others files in pack are still unknown, but there must be animation for 3d models somewhere. And hrc for them because all parts of model of city are started from zero position.

The second file in map dir (for example 26/3965) are archived pack of map textures. There are always six of them. They are usual tim without modification.

The third file (for example 26/3966) are archived textures of skyes. And maybe something else (need to be further analized)

Next five files are music.
And last two files are map itself =)

As for the archive. Its almost the same as in ffvii some lzs modification. I don't rememder diferences. Please look at my class for extract it. (if you write description of it for XENO-GEARS it would be wonderful ^_^).
http://server.titansoft.ru/akari/xenogears/engine.rar (src/resource/archive/archive.cpp)

Quote
Where are the filed maps stored?


What are field maps?

Micky

  • *
  • Posts: 300
    • View Profile
Xenogears worldmap info
« Reply #2 on: 2006-01-07 11:41:36 »
Quote from: Akari
Quote
Where are the filed maps stored?


What are field maps?

Of course, I mean the field models, what you already described in dir 11.

Akari

  • *
  • Posts: 766
    • View Profile
Xenogears worldmap info
« Reply #3 on: 2006-01-07 14:27:28 »
Quote from: Micky
Of course, I mean the field models, what you already described in dir 11.


Yeah, Im working on them. As soon as I understand texture format - I add info about them to XENO-GEARS.

Micky

  • *
  • Posts: 300
    • View Profile
Xenogears worldmap info
« Reply #4 on: 2006-01-07 18:03:31 »
Quote from: Akari
As for the archive. Its almost the same as in ffvii some lzs modification. I don't rememder diferences. Please look at my class for extract it. (if you write description of it for XENO-GEARS it would be wonderful ^_^).

You can use this description if you want:
Quote
The LZS compression format used in Xenogears is similar to the one used in Final Fantasy 7 and other Square games, but it is coded slightly differently:
Each packet starts with a control code, followed by compressed and uncompressed values. The control code contains a bit for each packet, if it is clear then the value is copied verbatim, if it is set then it is copied from the ring buffer. (This is directly opposite of what the decompressor in Final Fantasy does). Additionally the ringbuffer offset is calculated differently from Final Fantasy: The offset is the lower 12 bit of a 16-bit value, the length is the upper 4 bit.


Update:
Now that I've got working decompression code I found the worldmap textures as well: The second file of the directory contains an archive of 6 textures. That explains the attributes as well: The byte after elevation is an attribute byte: The texture index is the lower 3 bit, U-flip is the 6th bit and V-flip is the 7th bit. The next byte is the tile index, the lower 4 bit are the tile in U-direction and the upper 4 bit are the tile in V direction. Just scale these by 16 to get the position in the texture.
There are still rendering problems, then, but most of the map is correct. I assume there is some additional scaling going on.
Now I'll have to write proper rendering code, as it is I get <1 fps...
screenshot!

---- Update:
The duplicated tiles were a problem from me - you can ignore the 9th row/column of each 9x9, as they are only required if don't have access to neighbouring tiles. This makes each height tile exactly 16x16, which is the same size of the second tile. Which makes me think that the second tile is encounter info or something that is static over the area of a single map point.