Iris2.de

Iris2-Forum
It is currently Thu Mar 28, 2024 9:27 pm

All times are UTC




Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Tile Data Information
PostPosted: Mon Jun 09, 2008 1:53 pm 
Offline

Joined: Mon Jun 09, 2008 1:04 pm
Posts: 12
I've been reading on the UO file formats but the tile information, or rather how to extract the information, has me confused. What is the order of files I need to read to get the tile flags for a specific tile? If I wanted to look at the tile x,y and get all flags for it (land and static), what must I do?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 09, 2008 4:09 pm 
Offline
iris2-developer
User avatar

Joined: Tue Apr 18, 2006 10:28 pm
Posts: 823
Location: Munich, Bavaria, Germany
land(terrain) is map*.mul statics is sta*
see http://uo.stratics.com/heptazane/fileformats.shtml


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 09, 2008 5:16 pm 
Offline

Joined: Mon Jun 09, 2008 1:04 pm
Posts: 12
Yes, those are the formats I've been looking at. This is what I understand so far.

Map%.mul gives you blocks and cells. How do you go from x y coordinates to cell number?

Staidx%.mul gives you the number of statics at each location? If I read block 2 from map%.mul, how do I know where to read from this file? The start refers to the beginning location in the statics$.mul correct?

Statics%.mul contains the statics at the x y offsets within the block.

TileData.mul actually contains the information for each tiles. This is where I would gather the flag information.

How does all this correlate? How do I go from the cell in map%.mul to the tile in TileData.mul? I do not see the connecting datatype. The cell of map%.mul and the statics%.mul both have color and alt. I see nothing connecting TileData.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 10, 2008 12:12 am 
Offline
iris2-developer
User avatar

Joined: Tue Apr 18, 2006 10:28 pm
Posts: 823
Location: Munich, Bavaria, Germany
Quote:
How do you go from x y coordinates to cell number?

Block Number = (XBlock * 512) + YBlock


Staidx%.mul gives you not only the number of statics, but also the "start position", an offset that ells you where to find the data. the data itself is in the STATICS0.MUL file.

our code for loading data is in
http://zwischenwelt.org/trac/iris/browser/trunk
include/data*.h and src/data*.cpp


Last edited by ghoulsblade on Tue Jun 10, 2008 7:24 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 10, 2008 12:27 am 
Offline
iris2-developer
User avatar

Joined: Tue Aug 22, 2006 1:21 pm
Posts: 173
Location: Munich, Germany
xGlacierx wrote:
Map%.mul gives you blocks and cells. How do you go from x y coordinates to cell number?


the map consists of 8x8 tile/cell big blocks.
x 0-7 -> block 0
x 8-15 -> block 1
x 16-23 -> block 2
...

the same along the y axis.

xGlacierx wrote:
Staidx%.mul gives you the number of statics at each location? If I read block 2 from map%.mul, how do I know where to read from this file? The start refers to the beginning location in the statics$.mul correct?


the staidx0.mul is an index file. like in the map.mul the staidx0.mul contains a sequential list of blocks. each block represents a map block and contains the information (Start, Length) where you can find the actual static data. each idx file refers to a mul file (here statics0.mul). so if you want the statics of one map block you lookup the block in the idx, read the actual data position, open the mul file, seek the actual data position and read the information you want.

xGlacierx wrote:
How does all this correlate? How do I go from the cell in map%.mul to the tile in TileData.mul? I do not see the connecting datatype. The cell of map%.mul and the statics%.mul both have color and alt. I see nothing connecting TileData.


map - heightmap of the world
statics - list of static objects in the world (type,x,y,z)
tiledata - object type definitions and graphics

map <-> statics : map block
statics <-> tiledata : objectid

_________________
O-->---


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 10, 2008 3:28 pm 
Offline

Joined: Mon Jun 09, 2008 1:04 pm
Posts: 12
I find that single post more informative than any of the file formats I've read.

Some more questions though. A cell is supposed to be 3 bytes (Color = 2, Alt = 1). A block is supposed to be 196 bytes (Header = 4, 64 Cells = 64 * 3 = 192). Map0.mul contains data for Felucca and Trammel and is 768 * 512 blocks in size. 768 * 512 * 196 = 77,070,336 bytes. My map0.mul file is 89,915,392 bytes. What is the extra data? This occurs with the other files as well.

Map2.mul is Ilshenar which is 576 * 400 blocks. Supposed to be 45,158,400 bytes. Its 11,289,600 bytes.

Map3.mul is Malas which is 640 * 512 blocks.
Supposed to be 64,225,280 bytes. Its 16,056,320 bytes.

Map4.mul is Tokeno which is 362 * 362 blocks.
Supposed to be 25,684,624 bytes. Its 6,421,156 bytes.

Note that the information given is just to show what I am using, not to mock or tell you what it should be if it is wrong.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 10, 2008 7:20 pm 
Offline
iris2-developer
User avatar

Joined: Tue Apr 18, 2006 10:28 pm
Posts: 823
Location: Munich, Bavaria, Germany
osi made the map bigger a while ago, the height (512) remains, it's best if you calc the width from the filesize : w = filesize / ( 512 * 196 )

heights for the different maps :
name = "Trammel", mapheight = 512, (same as fel)
name = "Ilshenar", mapheight = 200,
name = "Malas", mapheight = 256,
name = "Tokuno", mapheight = 181,

uo has many hacks like that i'm afraid

edit : btw, it's not "color", but rather "tiletype". a 16 bit word you can use as index in artmaps to draw it. and in tiledata.mul as well to get some infos :

Code:
/// struct for tiledata.mul first half (id < cStaticTileType::GetFirstID() )
struct RawGroundTileType {
   uint32    miFlags;
   uint16   miTexID;
   char          msName[20]; ///< TODO is this always zero terminated ?!?
} STRUCT_PACKED; // 26 bytes


if the miTexID is set, you can use it to load a texture for it from texmaps.mul (and texidx.mul)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 11, 2008 3:04 am 
Offline

Joined: Mon Jun 09, 2008 1:04 pm
Posts: 12
I now have everything but the TileData being read. What is the ObjectId field being mentioned? Neither the land nor the static information in TileData.mul is labelled ObjectId. I would dare to guess that the Color field within the Statics%.mul format is the ObjectId, what about the TileData.mul?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 11, 2008 6:29 am 
Offline
iris2-developer
User avatar

Joined: Mon Aug 09, 2004 12:20 pm
Posts: 1431
I don't know if you know our uo linklist already:

http://www.iris2.de/index.php/Documenta ... le_Formats

and a fast link:
http://www.iris2.de/index.php/Tiledata_Informations

Here is also a fast link to some tiledata discribtions:
http://sphere.uozone.net/index.php?titl ... properties


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 11, 2008 8:56 am 
Offline
iris2-developer
User avatar

Joined: Tue Aug 22, 2006 1:21 pm
Posts: 173
Location: Munich, Germany
http://zwischenwelt.org/trac/iris/brows ... tiletype.h

both GetRawOffset and GetRawLength map the objectid to the position in the tiledata.mul. i think i mixed up the art*.mul (which has an index) in my previous post.

art*.mul - contains graphic data, you can find the actual data via the index file

tiledata.mul - flags and stuff, you need to calculate the position (see GetRaw*).

_________________
O-->---


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 11, 2008 10:53 am 
Offline

Joined: Mon Jun 09, 2008 1:04 pm
Posts: 12
I have read through each of those links previously. Well all except the one to the source code. The link on "How the UO-Map works" under Map0.mul was particularly usefull. As to the GetRaw* items, would you mind breaking these down into what they mean?

Code:
...
return (512*836)+(((iID-512*32)/32)*1188) + 4 + ((iID-512*32)%32)*37; } // id=512*32 : 428036
...
return (iID/32)*836 + 4 + (iID%32)*26;
...


This is my interperitation.

iID is the ObjectId (previously referred to as Color)?
512 is the map height in blocks?
37 is the length of a static tile data (from first return statement)

What are the others calculating?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 11, 2008 12:37 pm 
Offline
iris2-developer
User avatar

Joined: Tue Aug 22, 2006 1:21 pm
Posts: 173
Location: Munich, Germany
yes iID is the objectid (color)

tiledata.mul looks like this

Code:
512 x [Land Tile Groups] 836 = 32*26 + 4 bytes
  DWORD Unknown
  32 x [Land Tile Data] 26 bytes
    DWORD Flags (see below)
    UWORD Texture ID (If 0, the land tile has not texture)
    CHAR[20] Tile Name
X x [Static Tile Groups] 1188 = 32 * 37 + 4 bytes
  DWORD Unknown
  32 x [Static Tile Data] 37 bytes
    DWORD Flags (see below)
    BYTE Weight (weight of the item, 255 means not movable)
    BYTE Quality
    ...
    CHAR[20] Tile Name


:: static ::
return (512*836)+(((iID-512*32)/32)*1188) + 4 + ((iID-512*32)%32)*37; } // id=512*32 : 428036

512*836 <- skipping land tiles
-512*32 = -16384 = -0x4000 <- uo magic, you need to add/sub 0x4000 to some objectids
/32)*1188) + 4 <- choose the static tile group
%32)*37 <- choose the static tile data in chosen static tile group

:: ground ::
return (iID/32)*836 + 4 + (iID%32)*26;

/32)*836 + 4 <- choose land tile group
%32)*26 <- choose land tile data in chosen land tile data

_________________
O-->---


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 11, 2008 12:57 pm 
Offline

Joined: Mon Jun 09, 2008 1:04 pm
Posts: 12
Quote:
<- uo magic, you need to add/sub 0x4000 to some objectids


That must have been a bitch to figure out.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 11, 2008 1:07 pm 
Offline
iris2-developer
User avatar

Joined: Tue Aug 22, 2006 1:21 pm
Posts: 173
Location: Munich, Germany
our luck was that there were the iris1 team which did a lot of groundwork. so we could just adopt many things.

_________________
O-->---


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 13, 2008 12:20 pm 
Offline

Joined: Mon Jun 09, 2008 1:04 pm
Posts: 12
If the objectid of the cell is the land tile, does that mean there will always only be one land tile per cell, with many statics over it? Is a mountain top a static?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group