Opt File Format
Opt File Format
-
- Posts: 1289
- Joined: Mon Oct 30, 2000 12:01 am
- Contact:
Hi everybodey! It's been a very long time since my last post here, but the gog release of XWA made me come back here and my interest on the game awoke once more
The last few days I've been meddling around with the OPT file format, out of interest in a personal project. I'm new to this stuff and used the only source I found on the format, which is Stealth Jedi's document: http://www.oocities.org/v_d_d/Xwing_Uno ... Specs.html
I was able to understand everything to up to block 22 I guess, but from there I'm puzzled and don't understand the Main Mesh Header. I'm using the original Containerbrick,opt, as I thought this model to be rather easy.
For example I tried to find the vertices, but I don't really understand how to find the jump offset, from the information given in the document:
offset to 03 // vertices
I would be grateful if someone would be able to point me to more information or would be able to explain it to me a bit more detailed. Thank you!
The last few days I've been meddling around with the OPT file format, out of interest in a personal project. I'm new to this stuff and used the only source I found on the format, which is Stealth Jedi's document: http://www.oocities.org/v_d_d/Xwing_Uno ... Specs.html
I was able to understand everything to up to block 22 I guess, but from there I'm puzzled and don't understand the Main Mesh Header. I'm using the original Containerbrick,opt, as I thought this model to be rather easy.
For example I tried to find the vertices, but I don't really understand how to find the jump offset, from the information given in the document:
offset to 03 // vertices
I would be grateful if someone would be able to point me to more information or would be able to explain it to me a bit more detailed. Thank you!
- JeremyaFr
- Posts: 4002
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
Hi,
If this can help, here is the structure of ContainerBrick.opt: Add 8 to the indicated offset to find the block in the file.
If this can help, here is the structure of ContainerBrick.opt: Add 8 to the indicated offset to find the block in the file.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 1289
- Joined: Mon Oct 30, 2000 12:01 am
- Contact:
Hi JeremyaFr, thank you for the strucutre, but I'm still not sure if I get it right.
According to Stealth Jedis documentation,
I located the 02 Header at bock 12 and 13 (0200) after that I should locate the NumOfOffsets, which in my understanding indicates the mesh count, right? This would be a longint 010000 (starting at block 14) and this would be 1, which is correct for the containerbrick model, right? The next instruction is the Jump to the first offset. I don't know how this offset ist stored (longint, byte, word).
Even though I don't seem to understand that part correctly according to StealthJedi I should find the first jump offset at block 22, which would be 66, as you pointed out in your image of the OPT Structure. So I would start at block 66+8 reading the vertices, right? If i'd do so I'd calculate a vertex as 3 float values, which would be 216bytes of data for the vertices.
So I would get the following points:
Block Float
74 0.0
78 0.0
82 0.0
86 0.0
90 0.0
94 0.0
98 435.5
102 2.015751
106 -2.019767
(...)
Am I'm correct here?
According to Stealth Jedis documentation,
I located the 02 Header at bock 12 and 13 (0200) after that I should locate the NumOfOffsets, which in my understanding indicates the mesh count, right? This would be a longint 010000 (starting at block 14) and this would be 1, which is correct for the containerbrick model, right? The next instruction is the Jump to the first offset. I don't know how this offset ist stored (longint, byte, word).
Even though I don't seem to understand that part correctly according to StealthJedi I should find the first jump offset at block 22, which would be 66, as you pointed out in your image of the OPT Structure. So I would start at block 66+8 reading the vertices, right? If i'd do so I'd calculate a vertex as 3 float values, which would be 216bytes of data for the vertices.
So I would get the following points:
Block Float
74 0.0
78 0.0
82 0.0
86 0.0
90 0.0
94 0.0
98 435.5
102 2.015751
106 -2.019767
(...)
Am I'm correct here?
- JeremyaFr
- Posts: 4002
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
Hi Gringlas,
At block 66+8, it's the node (Mesh Vertex Header ) that contains the vertices, not the vertices themselves.
mostly right. The first offset may point to a texture. In that case, NumOfOffsets = mesh count, otherwise NumOfOffsets = mesh count + 1.Gringlas wrote:I located the 02 Header at bock 12 and 13 (0200) after that I should locate the NumOfOffsets, which in my understanding indicates the mesh count, right?
rightGringlas wrote:This would be a longint 010000 (starting at block 14) and this would be 1, which is correct for the containerbrick model, right?
All offsets are longint.Gringlas wrote:I don't know how this offset ist stored (longint, byte, word).
The first jump offset at block 22 is 26 (Main Mesh Header). In this node, the first jump is 66.Gringlas wrote:I should find the first jump offset at block 22, which would be 66, as you pointed out in your image of the OPT Structure. So I would start at block 66+8 reading the vertices, right?
At block 66+8, it's the node (Mesh Vertex Header ) that contains the vertices, not the vertices themselves.
-
- Posts: 1289
- Joined: Mon Oct 30, 2000 12:01 am
- Contact:
Thanks for the detailed answer. i'm in skiing holidays right now, so i think i'll be able to try it next monday
-
- Posts: 1289
- Joined: Mon Oct 30, 2000 12:01 am
- Contact:
And its me again
I was able to find most of the values in your screenshot.
No the vertex header puzzles me. I find it at node 74 as 00 03 00 00. It seems to me, that the number of 00 in the headers pointed out in Stealth Jedis document are 1...n, right? Because The count of vertices is 12 00 00 00 found at offset 87, followed directly by 8A 08 A9 00 which would be the jumpf offset to the first vertex in this case 90 + 8, but at that location I would find 0.0/0.0/0.0 for the vertex x/y/z coords.
Also I'd assume to find jump offsets to 18 vertices and not just one, but the other bytes won't give me reasonable jump offsets. What I'm doing wrong here?
I was able to find most of the values in your screenshot.
No the vertex header puzzles me. I find it at node 74 as 00 03 00 00. It seems to me, that the number of 00 in the headers pointed out in Stealth Jedis document are 1...n, right? Because The count of vertices is 12 00 00 00 found at offset 87, followed directly by 8A 08 A9 00 which would be the jumpf offset to the first vertex in this case 90 + 8, but at that location I would find 0.0/0.0/0.0 for the vertex x/y/z coords.
Also I'd assume to find jump offsets to 18 vertices and not just one, but the other bytes won't give me reasonable jump offsets. What I'm doing wrong here?
-
- Posts: 1289
- Joined: Mon Oct 30, 2000 12:01 am
- Contact:
any hints or ideas, or is my question not clear enough? Help would be greatly appreciated. thanks!
- JeremyaFr
- Posts: 4002
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
Hello,
Here is the list of jump offsets in ContainerBrick.opt:
CONTAINERBRICK.OPT
0x00000000: File Header
File Size: 72929
Global Offset: 11077680
Jumps Count: 1, Offset: 0x00000016
Jump 0: 0x0000001A
0x0000001A: Node Type: NodeGroup
Jumps Count: 6, Offset: 0x00000032
Jump 0: 0x0000004A
Jump 1: 0x0000013A
Jump 2: 0x000001E2
Jump 3: 0x000002BA
Jump 4: 0x0000031A
Jump 5: 0x00000362
0x0000004A: Node Type: MeshVertices
Data Offset: 0x00000062
Count: 18
0x0000013A: Node Type: TextureCoordinates
Data Offset: 0x00000152
Count: 18
0x000001E2: Node Type: VertexNormals
Data Offset: 0x000001FA
Count: 16
0x000002BA: Node Type: MeshDescriptor
Data Offset: 0x000002D2
0x0000031A: Node Type: RotationScale
Data Offset: 0x00000332
0x00000362: Node Type: NodeGroup
Jumps Count: 4, Offset: 0x0000037A
Jump 0: 0x00000000
Jump 1: 0x00000000
Jump 2: 0x00000000
Jump 3: 0x0000038A
0x0000038A: Node Type: FaceGrouping
Jumps Count: 1, Offset: 0x000003A2
Jump 0: 0x000003AA
Data Offset: 0x000003A6
Count: 1
0x000003AA: Node Type: NodeGroup
Jumps Count: 8, Offset: 0x000003C2
Jump 0: 0x000003E2
Jump 1: 0x00004EC5
Jump 2: 0x00004FA9
Jump 3: 0x00007A8C
Jump 4: 0x00007B0C
Jump 5: 0x0000A5EF
Jump 6: 0x0000A66F
Jump 7: 0x00011BFD
0x000003E2: Node Type: Texture
Data Offset: 0x00000403
0x00004EC5: Node Type: FaceData
Data Offset: 0x00004EDD
Count: 2
0x00004FA9: Node Type: Texture
Data Offset: 0x00004FCA
0x00007A8C: Node Type: FaceData
Data Offset: 0x00007AA4
Count: 1
0x00007B0C: Node Type: Texture
Data Offset: 0x00007B2D
0x0000A5EF: Node Type: FaceData
Data Offset: 0x0000A607
Count: 1
0x0000A66F: Node Type: Texture
Data Offset: 0x0000A690
0x00011BFD: Node Type: FaceData
Data Offset: 0x00011C15
Count: 2
Notes:
Here is the list of jump offsets in ContainerBrick.opt:
CONTAINERBRICK.OPT
0x00000000: File Header
File Size: 72929
Global Offset: 11077680
Jumps Count: 1, Offset: 0x00000016
Jump 0: 0x0000001A
0x0000001A: Node Type: NodeGroup
Jumps Count: 6, Offset: 0x00000032
Jump 0: 0x0000004A
Jump 1: 0x0000013A
Jump 2: 0x000001E2
Jump 3: 0x000002BA
Jump 4: 0x0000031A
Jump 5: 0x00000362
0x0000004A: Node Type: MeshVertices
Data Offset: 0x00000062
Count: 18
0x0000013A: Node Type: TextureCoordinates
Data Offset: 0x00000152
Count: 18
0x000001E2: Node Type: VertexNormals
Data Offset: 0x000001FA
Count: 16
0x000002BA: Node Type: MeshDescriptor
Data Offset: 0x000002D2
0x0000031A: Node Type: RotationScale
Data Offset: 0x00000332
0x00000362: Node Type: NodeGroup
Jumps Count: 4, Offset: 0x0000037A
Jump 0: 0x00000000
Jump 1: 0x00000000
Jump 2: 0x00000000
Jump 3: 0x0000038A
0x0000038A: Node Type: FaceGrouping
Jumps Count: 1, Offset: 0x000003A2
Jump 0: 0x000003AA
Data Offset: 0x000003A6
Count: 1
0x000003AA: Node Type: NodeGroup
Jumps Count: 8, Offset: 0x000003C2
Jump 0: 0x000003E2
Jump 1: 0x00004EC5
Jump 2: 0x00004FA9
Jump 3: 0x00007A8C
Jump 4: 0x00007B0C
Jump 5: 0x0000A5EF
Jump 6: 0x0000A66F
Jump 7: 0x00011BFD
0x000003E2: Node Type: Texture
Data Offset: 0x00000403
0x00004EC5: Node Type: FaceData
Data Offset: 0x00004EDD
Count: 2
0x00004FA9: Node Type: Texture
Data Offset: 0x00004FCA
0x00007A8C: Node Type: FaceData
Data Offset: 0x00007AA4
Count: 1
0x00007B0C: Node Type: Texture
Data Offset: 0x00007B2D
0x0000A5EF: Node Type: FaceData
Data Offset: 0x0000A607
Count: 1
0x0000A66F: Node Type: Texture
Data Offset: 0x0000A690
0x00011BFD: Node Type: FaceData
Data Offset: 0x00011C15
Count: 2
Notes:
- The offset next to Jumps Count is the offset of the jump table. Each jump is a int. Remove the global offset and add 8 to obtain the node offset.
- A node doesn't directly contains data, but contains a jump offset to its data.
-
- Posts: 2
- Joined: Thu Feb 26, 2015 5:04 am
Is there documentation for the xvt/bop format the same way you found for the xwa format? I know there are differences between bop and xwa, and this document seems to describe the OPT format in terms of xwa entities.
-
- Posts: 2
- Joined: Thu Feb 26, 2015 5:04 am
I decided to just use the available documentation and parse the xwa opts, and it turns out they are significantly better. See xwa's imperialstardestroyer2 opt vs bop's ISD. Now that I can successfully parse higher quality opts, I'm not really sure I need to parse the xvt bop ones anymore.
I found OP's documentation page ambiguous but correct. If I update my code to also parse xvt/bop models I may put out an updated HTML.
Loading/rendering/editing in java/opengl
I found OP's documentation page ambiguous but correct. If I update my code to also parse xvt/bop models I may put out an updated HTML.
Loading/rendering/editing in java/opengl
-
- Posts: 1289
- Joined: Mon Oct 30, 2000 12:01 am
- Contact:
It's been some time since my last post, but I was busy and only able to have a look at this topic every now and then. I finally have found the Vertices and compared them to those displayed in your superb XWAOptEditor, JeremyaFr. The Containerbrick.opt contains 10 vertices, but Iat block 90 I find 12 00 00 00 which should be the NumVertices (Longint) according to StealthJedi. The next block 94 (8A 08 A9 00) is Jump to Floats, which contains the jump offset to the vertices of the Mesh, which start in block 98 up to 314, which are 18 vertices with 3 floats each. What is the meaning of those 8 overmuch vertices?
- JeremyaFr
- Posts: 4002
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
The extra vertices at the end of the vertices block replicate the hitzone.
- JeremyaFr
- Posts: 4002
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
Hello,
I have uploaded the source code of my opt dll to GitHub:
https://github.com/JeremyAnsel/JeremyAnsel.Xwa.Opt
The binaries are consumable through a NuGet package:
http://www.nuget.org/packages/JeremyAnsel.Xwa.Opt
I have uploaded the source code of my opt dll to GitHub:
https://github.com/JeremyAnsel/JeremyAnsel.Xwa.Opt
The binaries are consumable through a NuGet package:
http://www.nuget.org/packages/JeremyAnsel.Xwa.Opt