XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Tue Apr 24, 2018 4:26 am

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Order & Chaos 2: Redemption terrains
PostPosted: Fri Nov 17, 2017 11:54 pm 
Offline
n00b

Joined: Wed Nov 18, 2015 4:59 pm
Posts: 18
Has thanked: 3 times
Have thanks: 0 time














You can make the ads go away by registering

Recently I've been trying to RE a terrain format from O&C2 game. While there are other file types associated with a single world chunk, the terrain file itself seem to contain such info as:
- heightmap;
- textures list;
- texture mapping;
- water level;
- water type (normal, lava, tar, etc).
For now I've only been able to determine heightmaps.

Format template as what I do know by now can be found here.

So far, terrain is a 64x64 chunk. The format consists of 6 sections:
- header;
- section one (starts at 0x10, consists of 8b marker + 64 structures of 12 values (2 byte each);
- section two - heightmap (starts at 0x618, consists of 65x65 2 byte values);
- section three - possibly water level (starts at 0x271A, consists of 65x65 2 byte values);
- section four (starts at 0x481C, consists of 65x65x3 bytes);
- strings - textures used by chunk.

My main question is: can someone help me determine at least how do textrues are used in this format? I lack general understanding of concept of how do textures applied to terrain.

In the attached archive you can find .obj and .h2o files to view terrain model in hex2obj, original .trn file which to be used by 010 Editor template and screenshot from hex2obj showing terrain.


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.



Top
 Profile  
 
 Post subject: Re: Order & Chaos 2: Redemption terrains
PostPosted: Wed Jan 17, 2018 9:27 am 
Offline
n00b

Joined: Wed Nov 18, 2015 4:59 pm
Posts: 18
Has thanked: 3 times
Have thanks: 0 time
A few additions to refresh a post.

Once again, terrain is a 64x64 chunk. The format consists of 6 sections:

1. Header.
2. Section one (starts at 0x10, consists of 8b marker + 64 structures of 12 values (2 byte each).
3. Section two - heightmap (starts at 0x618, consists of 65x65 2 byte values).
4. Section three - possibly water level (starts at 0x271A, consists of 65x65 2 byte values).
5. Section four (starts at 0x481C, consists of 65x65x3 bytes).
6. Strings - textures used by chunk.

A few examples of section one:

Code:
    0010h .. .. .. .. .. .. .. .. 00 00 01 00 C0 12 01 00
    0020h 02 00 03 00 04 00 FF FF 0A 40 60 00 14 00 9F 23


Splitting section into 2-byte `unsigned short` values we get a sequence (every row is some random sample):

Code:
     0:    0 1 0.0008239746 1 2  3 4 -1 2.019531 96 20 0.01488495
    20:    0 1 0            4 2 -1 5  5 2.019531 96 20 0.01488495
    41:    0 1 0.0008239746 8 2  3 4  9 2.019531 96 20 0.01488495
    63:    0 1 0.0008239746 1 2  3 4 -1 2.019531 96 20 0.01488495


So we have only 64 such sequences for any terrain taken. As we see, most of the values are repeating for some reason.

Sections 2 and 3 are not very important: 2 is heightmap, 3 seem to be waterlevel.

Now, section 4 is weird one. It consists of 65x65x3 bytes. So every terrain vertex has 3 bytes of additional info which probably has something to deal with textures. A few samples:

Code:
       0: 04 7C 19
     939: F2 7D ED
    1548: F8 7F FE
    4224: 00 7F 00


Second value doesn't seem to go lower than 115 for sample file.

I haven't found a maximum number of textures possible, but in the example attached there are 16 textures used. In this particular format all textures can be layered upon terrain chunk and every terrain vertex might have a weight value for each of the textures. However I didn't succeed on finding any patterns on texture indeices or anything similar. I hope someone could give me a couple ideas on where to move on.

Sample file on mediafire.


Top
 Profile  
 
 Post subject: Re: Order & Chaos 2: Redemption terrains
PostPosted: Thu Jan 18, 2018 12:26 pm 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran
User avatar

Joined: Fri Apr 20, 2012 9:24 am
Posts: 2211
Location: Nexus, searching for Jim Kirk
Has thanked: 481 times
Have thanks: 1150 times
I'd suggest to check some trn files in irfanview for example (load as raw file):

Thus you might get more insight how this works.

(guess, the texture format uses some compression)


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.


_________________
"you can't always get things served on a silver tray"
extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip

"We are Microsoft. You will be assimilated. Resistance is Futile."


Top
 Profile  
 
 Post subject: Re: Order & Chaos 2: Redemption terrains
PostPosted: Thu Jan 18, 2018 2:09 pm 
Offline
n00b

Joined: Wed Nov 18, 2015 4:59 pm
Posts: 18
Has thanked: 3 times
Have thanks: 0 time
shakotay2 wrote:
I'd suggest to check some trn files in irfanview for example (load as raw file)
I seem to not understand why load terrain file in irfanview since trn does not contain anything that could be viewed as multimedia.
shakotay2 wrote:
(guess, the texture format uses some compression)
Texture itself is s PVR image, external file.


Top
 Profile  
 
 Post subject: Re: Order & Chaos 2: Redemption terrains
PostPosted: Thu Jan 18, 2018 4:11 pm 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran
User avatar

Joined: Fri Apr 20, 2012 9:24 am
Posts: 2211
Location: Nexus, searching for Jim Kirk
Has thanked: 481 times
Have thanks: 1150 times
lolbas wrote:
Texture itself is s PVR image, external file.
ok, then, I didn't get this - I thought, the textures were included in the trn file.

When you're talking about "sections" it's unclear whether it's related to the texture files or the trn files.

Your question was how the textures are mapped to the terrain, right?

So the usual proceeding (for PC, not consoles) were to give the trn file a structure, find sections, then zero out bytes that might address textures (could result in annoying trial 'n error, yes).

Then save (or repack if required) the changed trn and start the game.
Then some texture should be missing so you'd know the data you zeroed out refers to that missing texture.

_________________
"you can't always get things served on a silver tray"
extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip

"We are Microsoft. You will be assimilated. Resistance is Futile."


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: shingenseiji, sjzbanw119 and 5 guests


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 © 2000, 2002, 2005, 2007 phpBB Group