Author Topic: [FF8] .x battle fields  (Read 88852 times)

paul

  • *
  • Posts: 179
    • View Profile
Re: [FF8] .x battle fields
« Reply #25 on: 2015-02-02 16:44:46 »
If its like FF7 there is probably some script data in there?

Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile
Re: [FF8] .x battle fields
« Reply #26 on: 2015-02-02 17:14:20 »
That's the only possibility paul. This however doesn't make much sense. Every script is written right to enemy itself, or is scripted in engine. Maybe an animation? Diablos zone has animated background, also eight witches at time compression have deformation animation in it. I'll try to nullify those stages.

Probably found faces, but it's build is a little mess, so the software doesn't read it good. I'll need to manually delete this unwanted data and see what I get. I'm running out of time thou, as I do have a lot of work, so give me two days for update. After faces next step us UV. But I'm just aiming for this base mesh.

Mesh looks a bit more complicated than we though.
« Last Edit: 2015-02-02 18:54:57 by MaKiPL »

Halfer

  • *
  • Posts: 142
    • View Profile
Re: [FF8] .x battle fields
« Reply #27 on: 2015-02-02 20:41:55 »
Okay, I probably found out how the ground is formed.



I highlighted one unmodified section of mesh which seems to represent vertices. Each section at the header start (haven't checked much further) seems to contain 9 vertices which are connected to each other. The numbers colored with orange are nullified vertices and then I added hex number 01 to the possible Z-axis variable. This was the result:



It seems to go a little over the ground which is expected with 01 value since it's the first bit to represent the shortest distance in this 3d dimension. Also the XY-axis seems to collide in the middle which is also expected since they are 00 00 both now.

Here's a little clarification how it may work:
Code: [Select]
Offset: 0x3dd8
B3 F3   B3 F3     00 00
B3 F3   CD F7     00 00
B3 F3   E7 FB     00 00
B3 F3   00 00     00 00
B3 F3   1A 04     00 00
B3 F3   34 08     00 00
B3 F3   4E 0C     00 00
B3 F3   68 10     00 00
B3 F3   99 EF     00 00
X-axis, Y-axis,    Z-axis
X and Y axis may differ.

So to sum up it seems that each vertices has 6 bytes reserved where 2 bytes represents axis in XYZ-format. Hope this gives some insight for you MakiPL! :)

EDIT: I tested it with a0stg101.x and this is what I got (sorry for bad angle, maybe we can get better angles when we can alter the camera):


This is what i changed:
Seems to work how i described it. I'm tired now so going to sleep :/
« Last Edit: 2015-02-02 20:55:49 by Halfer »

Mcindus

  • *
  • Posts: 929
  • Artist, Modder, Musician.
    • View Profile
    • Lunatic Pandora
Re: [FF8] .x battle fields
« Reply #28 on: 2015-02-02 20:43:21 »
Yep. Two other objects are like spheres, but with some details. I'll take a photo of it tomorrow. Still searching for a faces info. I'm having a huge support on Xentax, so I think we'll find it eventually. I'll make you updated :)

Still however no one could identify this data from 0x0 to 0x5D4. On 5D4 is camera starting, but before that? Nothing. Completely nothing. If anyone of us could get the breakpoint when this portion of data is accessed would be awesome, as I'm having almost no experience in process debugging and etc.

Could that be the code for a different field?  Are all of the areas the same?  For example - do the planes operate the same way on the 'beach' battle field?  Or on the 'mountain' battle field?  Perhaps those codes are used for other scenes/functionality?  The only battle field I've seen you guys try to do is the forest.  I don't know a thing about the backend, though - so forgive my ignorance of the process :)

paul

  • *
  • Posts: 179
    • View Profile
Re: [FF8] .x battle fields
« Reply #29 on: 2015-02-02 21:17:21 »
Too bad I don't have a copy of FF8 to dig in to the EXE :(

Looks like you're making good progress anyway :)

Kaldarasha

  • *
  • Posts: 2449
  • Prince of Model Editing
    • View Profile
Re: [FF8] .x battle fields
« Reply #30 on: 2015-02-03 05:04:48 »
Too bad I don't have a copy of FF8 to dig in to the EXE :(

Looks like you're making good progress anyway :)


You could be a help and try to find out in which freaking format the both event files are packed in the snowboard minigame of FF7. As long the files are unknown I   we can't replace the models there.

Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile
Re: [FF8] .x battle fields
« Reply #31 on: 2015-02-03 13:31:25 »
Exactly Halfer, vertex is 6 bytes. I pointed it out on XeNTaX forum, but forgot to do it here. :D Thanks to you, we know it's standard X Y Z.

Sometimes the stages has some weird parameters. For a0st105 it's plain square, but, and that's interesting:

-Even if set the vertex to be higher than 00, it does is covered by the forest model, and player/enemy. It's hard to describe, but let's say we just CAN'T make the ground get higher, so example Squall would have to run thru ground to attack the enemy. Why? Because of the rendering options. The other example of rendering is the example of ground highering you made a test on. The ground mesh is combined with some high points in the background, so the rendering option is set to be normal 3D model, not some "weird one".

A few problems are still appearing:

1. Is X Y Z of vertex reverse-bytes? example 00 05 is higher than 05 00?
2. Still finding the UV and face indices. shakotay2 on XeNTaX made a face test with the data he found, and also rejected my idea. However, the test failed, here's his screenshot:
3. Where are the length bytes? Really. For a0stg105 probably, there're 152 vertices, so 152*6 bytes, still can't find that number, yet. How does the game know for how long it needs to read next bytes.

So, the vertices data is after header 01 00 00 08, and for a0stg105 is as I remember ~152. So After:
01 00 00 00     08 00 00 00     01 00 01 00, after this 152*6 bytes is whole ground vertices data.

If you find the data portion, where the texture is going crazy, and it's before .TIM, then you'll find UV, that could be useful also.

Also, a0stg160 looks great for reversing. It's a cube with UV layout + sky. So only two objects, low res texture, less data portion. I'll take a look there by HEX reversing, see if I could find the UV map, and see if I can find the entry point where vertices does start, and when it does end, to see if there's something characteristic. If so, then possibility of writing a software to rip this stages raise drastically.


Also, I cut from the file all three objects, from 01 00 00 00 08... to another this pattern, so I could test only one mesh, and less data I had to look at.

I'll take a closer look at a0stg101, and try using this HEX2OBJ software, to get the vertices of this ground, and see if it fits. I'm at school ATM, so I don't have that exact file, I'll do it at home.

We're making a nice progress here. :)


Quote
maybe we can alter camera

Camera starts from 0x5da (a0stg105.x with header like 02 00 08 00 20 00...). Camera is dynamic, has pre-keyed prologue animation, miss animation, and camera locations for various enemies. It's hard to reverse camera data, if I have to work on random events. Oh...
« Last Edit: 2015-02-03 13:42:02 by MaKiPL »

Halfer

  • *
  • Posts: 142
    • View Profile
Re: [FF8] .x battle fields
« Reply #32 on: 2015-02-03 13:48:58 »
Nice, May I ask what programs are you using in your picture and with the analyzing. Would also help me a lot to make faster analyzes.

Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile
Re: [FF8] .x battle fields
« Reply #33 on: 2015-02-03 14:58:25 »
Here, a HEX2OBJ software: http://forum.xentax.com/viewtopic.php?f=29&t=10894
Also XeNTaX topic about the same thing: http://forum.xentax.com/viewtopic.php?f=16&t=12561

Aaaand... I think I found length byte. Here:
.
I badly selected bytes here,  but see the very first 97? It represents 151 in decimal, and this stage when visualized is ~152. I still not have access to my PC, but we should check, if this 97 is repeating in any other stages, then it's not a length byte.

Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile
Re: [FF8] .x battle fields
« Reply #34 on: 2015-02-03 20:05:52 »
Let's see. The expected length byte is 9B for a0stg101.x, so 155*6=930 bytes from 0x2b5e.
AND!!! YAY!!!!!!!!!!!!!! THAT'S IT! THAT'S IT!

1.Length byte is two bytes. In this case 9B 00 (Big endian). So 9B= 155, and when made a point cloud from it look what an crystal view appeared:

. And even bigger awesome news! The verices after 930 bytes ends with series of 00 and then another section also with (I'm ATM sure of 80%) header length appears. It's a much bigger amount of data, and guess what, the length byte is also bigger and made from two bytes. I'll test it as faces.

STRUCTURE:
« Last Edit: 2015-02-03 20:09:45 by MaKiPL »

Halfer

  • *
  • Posts: 142
    • View Profile
Re: [FF8] .x battle fields
« Reply #35 on: 2015-02-03 20:33:16 »
Great find! I wonder why it is showing as ellipse. Also the placement of vertices looks very odd in order to make a proper face with uv's

Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile
Re: [FF8] .x battle fields
« Reply #36 on: 2015-02-03 21:01:37 »
This ellipse as I remember is from Tonberry fight zone (So it has to be ellipse) or a0stg101, then it could be weird. But, to make you sure that it's 100% vertices data and it's structure is right here's the cake:



Straight from Ifrit's level. Also, that
Code: [Select]
01 00 00 00 08 00 thing only appears with FIRST object, on second and third instance you'll have to find this header object, but then pass at least 20 bytes, to find nearest
Code: [Select]
01 00 01 00 ** 00 XX XX XX
Where:
**- Would be length header
XX - Vertices info

This applies also for first instance, but for first one this appears just after this header, for second/third object as I wrote it's divided by some bytes, even 160!
See here:
. Yellow selected area is the bytes, that you have to ommit from 01 00 00 00 08 header, to get to byte length.

Do this ALWAYS!. Do NOT start to get vertices info just after header as I wrote some days ago, but after the length byte, that is ALWAYS after 01 00 01 00 **HERE**.


Also, for the SCRIPT section from start up to camera section (header 02 00 08...). It's almost the same on every map, BUT! The maps having animated texture like Ifrit's level, are having completely different this section. So it's 60% texture animation section. Still someone of us will need to null'ify this section up to texture and see what'll happen to lava. The thing game doesn't care for NULL'yfing (probably wrote it bad) 0x0-0x5D4 on forest level is that, there's nothing to animate on forest level...

Halfer, looks like .X file is breaking upon us. :))

EDIT2: Just checked the point cloud with a better shot of Ifrit's stage. It's 100% the same. Yep, we made it! I'm so happy. There's still two things to do:
1) Face indices
2) UV Map

EDIT3: Hey, remember the "opted battle stage" you posted in my topic of unused VIII's BG? I think I've seen a stage like this there. When we finish, I'll totally get a trip thru every stage in this game! Maybe it's just some simple meshes with details, but it's so exciting to look at it.
« Last Edit: 2015-02-03 21:19:25 by MaKiPL »

Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile
Re: [FF8] .x battle fields
« Reply #37 on: 2015-02-07 13:25:55 »
Face indices are 24 bytes, and also have byte length, for faces they're REVERSE byte, so big-indian... Stay tuned!

Vertices byte length is two bytes long, and is also read reverse. Just after length, pass Length*6 bytes, and you can meet 00 00 00 00, thing, after that there's another length byte hidden in four bytes portion. Length * 24 bytes. After that, you'll pass to next object. Where's the UV?

I'll keep you updated.

UPDATE 15:50 - Looks like after vertices, there is 6 bytes of zero'es, then there's 4 bytes of:

1.Face indices byte length (2B) Yep, always 20.
2.UV (2B) always 24

Don't know which one is which.
« Last Edit: 2015-02-07 14:01:59 by MaKiPL »

Yagami Light

  • *
  • Posts: 173
    • View Profile
Re: [FF8] .x battle fields
« Reply #38 on: 2015-02-07 14:43:32 »
Maki you are making amazing progress, even though I know very little about hex editing, I tried using reverse bytes to help you find UV/face vertices for a0stg101 do these pictures mean I'm near the UV since you said the texture data goes crazy or is that something else? 




Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile
Re: [FF8] .x battle fields
« Reply #39 on: 2015-02-07 15:07:56 »
Yagami, this one is interesting, and really, I don't know why is it happening. In your image, the only thing with messed UV is enemy and player, which in fact are completely other files. This is strange. Also, I already found UV, and length byte in my latest post here (ignoring this one). See:

. After I do some testing I'll end up with UV structure. Still, the face indices are our problem. They're 20 bytes per one.

Yagami Light

  • *
  • Posts: 173
    • View Profile
Re: [FF8] .x battle fields
« Reply #40 on: 2015-02-07 15:28:00 »
Ok here is the byte data I reversed to get the top image, gfs,particle effects and spell effects all seem to be affected as well


Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile
Re: [FF8] .x battle fields
« Reply #41 on: 2015-02-07 15:32:54 »
You reversed portion of face indices data. Still, don't know why altering this destroys the other elements. I'll take a closer look at this after this UV's. Currently, I discovered 50% of UV structure, also it does have Brightness settings in it! So the game doesn't itself have lightning data, but just controls the lightning by UV brightness. Nice one Square!

Update: Face indices are QUAD's probably.

DAT Battle model file and Stage file are having some similiar things. This is the same system geometry is build as in DAT as in .X file.

01 00 00 00 - number of objects (but it's inside object itself, so it's always 1, or not*)
08 00 00 00 - Offset of object start
and offset 0x8 for this is 4 bytes of not Face indices/UV, but triangles/quads.
Of course read backward.


X Y Z is 16Bit Signed int.


Extreme milestone!
I'm going to run an "milestone like" test, if it pass, then the full geometry would be done.
Yup. It's done now. The .X file's geometry section has just been cracked.

« Last Edit: 2015-02-07 20:06:12 by MaKiPL »

Mcindus

  • *
  • Posts: 929
  • Artist, Modder, Musician.
    • View Profile
    • Lunatic Pandora
Re: [FF8] .x battle fields
« Reply #42 on: 2015-02-07 20:27:48 »
Amazing work!  Such progress on VIII in such a short amount of time.

Now Crestian and I have more incentive to finish the background textures.

Yagami Light

  • *
  • Posts: 173
    • View Profile
Re: [FF8] .x battle fields
« Reply #43 on: 2015-02-07 20:29:05 »
Well done Maki, this will lead to great things in the future, I'm not sure about the dat files source code better off asking the noesis author

Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile
Re: [FF8] .x battle fields
« Reply #44 on: 2015-02-07 22:13:09 »
But, before we "dance" still there's some rendering problem


They are quad, but well... I need to browse old topics about .DAT files, I think they had the same problem.
Ignore the shadowing, it's renderer.

Yagami Light

  • *
  • Posts: 173
    • View Profile
Re: [FF8] .x battle fields
« Reply #45 on: 2015-02-07 22:59:26 »
I will link you this thread

http://forums.qhimm.com/index.php?topic=8130.50

Satoh in there explains why half is missing on reply#60, this was a ps1 game after all something to do with storing data efficiently

Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile
Re: [FF8] .x battle fields
« Reply #46 on: 2015-02-08 09:42:40 »
I will link you this thread

http://forums.qhimm.com/index.php?topic=8130.50

Satoh in there explains why half is missing on reply#60, this was a ps1 game after all something to do with storing data efficiently

Oh! And that's what I was searching for. I even browsed this topic, but just missed it. Thanks Yagami. Still can't find a good workaround for this.

Zervox

  • *
  • Posts: 55
    • View Profile
Re: [FF8] .x battle fields
« Reply #47 on: 2015-02-08 13:25:13 »
Would it work to process it twice per quad?
tri1(Vertice1,Vertice2,Vertice3)
tri2(Vertice1,Vertice5,Vertice3)
- one quad
tri3(Vertice4,Vertice5,Vertice6)
tri4(Vertice4,getdata8,Vertice6)

that is I wonder on the edges of the mesh, if there isn't stored an additional vertices but not all three so the last row of that quad would be
3+1 instead of 3+2 offset?
« Last Edit: 2015-02-08 13:27:42 by Zervox »

Maki

  • 0xBAADF00D
  • *
  • Posts: 621
  • 0xCCCCCCCC
    • View Profile
Re: [FF8] .x battle fields
« Reply #48 on: 2015-02-08 15:43:15 »
This is dumped OBJ file:
https://www.dropbox.com/s/5zj2j77b3m50m4a/test.zip?dl=0


Data is stored as Quad.
Example:
Code: [Select]
f 1 2 22 23
« Last Edit: 2015-02-08 16:36:40 by MaKiPL »

Yagami Light

  • *
  • Posts: 173
    • View Profile
Re: [FF8] .x battle fields
« Reply #49 on: 2015-02-08 17:08:36 »
Looks to me like the triangles overlap, miscalculation somewhere?