Ace Combat levels

Eggheads talking about bytes and stuff.
mikew
Data Genius
Posts: 603
Joined: 2022-Jan-09, 20:21

Re: Ace Combat levels

Post by mikew »

Unfortunately, I haven't been able to give this my undivided attention :(

So, I've only just formatted my output to take into account some of your previous findings.

Code: Select all

M04 Paper_Tiger
01024103 ; unknownA
00000000 ; groundColor
07302800 ; horizonColor
d84c5f6d ; unknownB
19fc0000 ; unknownC
07141600 ; skyColor1 slightly above horizon
07161600 ; skyColor2
02070e00 ; zenithColor
ecf1cdac ; unknownD
071e1c00 ; sunColor
071e1c00 ; ambientColor
08000800080008000800080008000800
b001e106 ;432 1761
245 286 245
34 34 33
0000000000000000
00000000000000007f7f7f00
3f3f3f001f1f1f000f0f0f00
00010101332d26000f000000
11000900281c000026191900
f50009006606000026191900
30000900f528000026191900
900009004721000026191900
c0000900b82e000026191900
d00009000040000026191900
e00009000040000026191900
20000900cc0c000026191900
52010900e12a000026191900
d10109000020000026191900
00020900a310000026191900
030309000010000026191900
0a030900001000003f333300
a10009000010000026191900
0f010900cc0c0000ccffb200
0e010900cc0c0000b2cc9900
Those values at the end of those last 16 lines look like RGB0, so I an going to see if you've documented the conversion algorithm somewhere as you don't just multiply everything by 4, like for TFX.
What I don't see are obvious XYZ coordinates, for things like the sun position, so it may be done with angles.
What I don't see either is a compass in the game, so can't say the sun is at a particular heading.

Yeah, running the game would be good, but I haven't investigated at all if the game can be run extracted, or if everything has to be put back into an .iso.
Regarding emulators, I can only comment that pcsx-redux looks like a good option for Windows at least. It built perfectly after I downloaded the VS2022 community edition....and it seems to run AC3 OK. I haven't actually tried playing the game though, and all my experience is watching the demo sequence and people flying missions on YT.
https://github.com/grumpycoders/pcsx-redux
User avatar
Krishty
Site Admin
Posts: 1364
Joined: 2022-Jan-09, 00:59

Re: Ace Combat levels

Post by Krishty »

mikew wrote: 2023-Sep-04, 07:28So, I've only just formatted my output to take into account some of your previous findings.

Code: Select all

M04 Paper_Tiger
01024103 ; unknownA
00000000 ; groundColor
07302800 ; horizonColor
d84c5f6d ; unknownB
19fc0000 ; unknownC
07141600 ; skyColor1 slightly above horizon
07161600 ; skyColor2
02070e00 ; zenithColor
ecf1cdac ; unknownD
…
Almost all unknowns before 0800080008000… are 16-bit signed integers; most likely Y coordinates. E.g. 5f6d in your example is 27,999 (accounted for Little-Endian).
Those values at the end of those last 16 lines look like RGB0, so I an going to see if you've documented the conversion algorithm somewhere as you don't just multiply everything by 4, like for TFX.
No algorithm, you just take the bytes as they come. The PSX has a very special gamma curve though, that I wasn’t able to replicate yet.
What I don't see are obvious XYZ coordinates, for things like the sun position, so it may be done with angles.
What I don't see either is a compass in the game, so can't say the sun is at a particular heading.
See the cues circled in yellow here:
image.png
image.png (144.09 KiB) Viewed 2279 times
Your overview is very interesting because it seems like Project Aces took all snapshots in direction of the sun?! Its height above the horizon differs, but most often all mission thumbnails have it in a similar place.

————

I also wanted to report on something I found out yesterday. The Y coordinates of ships and some enemies seem a bit off; e.g. ships submerge or hover. I fired up the game and … it’s identical there. You just don’t notice in the original game because there is no Z buffering, so the polygons are never occluded by ground or sea.

M28 Dilemma displays for me with the ships several meters submerged; you can only see the bridge:

image.png
image.png (185.08 KiB) Viewed 2279 times
image.png
image.png (284.15 KiB) Viewed 2279 times

M14 Pawns in the Game has an AA gun floating above a building, and a power plant sunken into the ground. Again, that’s hidden by the game’s low resolution and incorrect depth buffering. (You can see the dark windows on the TGT in the game, but not in TFXplorer.)

image.png
image.png (183.54 KiB) Viewed 2279 times
image.png
image.png (635.9 KiB) Viewed 2279 times

I will ignore these errors for buildings, but I will have to find a solution for ships as the problem is really obvious there. It might get worse once we add shadows to the mix …
User avatar
Krishty
Site Admin
Posts: 1364
Joined: 2022-Jan-09, 00:59

Re: Ace Combat levels

Post by Krishty »

mikew wrote: 2023-Sep-04, 07:28Unfortunately, I haven't been able to give this my undivided attention :(
If you ever get back to it, could you have a look at 7.dat from this post? With the placement of objects in missions?

I’m wrapping up the API and I will soon reach a point where targets like SAM / AA guns could become interactive. But for this to work, I would need to know how to differentiate between SAM, AA gun, and other targets like factories or radar sites. Also allegiance so I know if an object is hostile or friendly.

I’m also trying to find a way to supply you with a working prototype of my AC3 extension. The thing is, you can view the levels – but you still need to manually find and count individual objects in them, as I don’t have a way of saying “LOOK! There’s an interactive object over there!”
mikew
Data Genius
Posts: 603
Joined: 2022-Jan-09, 20:21

Re: Ace Combat levels

Post by mikew »

Last time I looked at this, I was wondering why the object block of eg Mission 1 was empty even though there's a city in it.
I'm probably making a counting mistake though, so plenty to check with my parser...
User avatar
Krishty
Site Admin
Posts: 1364
Joined: 2022-Jan-09, 00:59

Re: Ace Combat levels

Post by Krishty »

Does not seem like a counting bug! The city does not contain any targets you could destroy. (Skyscrapers etc. are entirely contained in the terrain, and not placed by the mission.) M02 does have lots of ground targets, though.
mikew
Data Genius
Posts: 603
Joined: 2022-Jan-09, 20:21

Re: Ace Combat levels

Post by mikew »

Aha.
By the way, the number of elements in that object block (what I'm calling block 9 for now) is given by 'numberofDDD'.
numberofAAA, numberofBBB, and numberofCCC are the corresponding element sizes of Blocks 1,2 &3 so a bit of a departure.

This is an example how I'm splitting things right now:

Code: Select all

M28 Dilemmafilesize 4712
numberofAAA 1
numberofBBB 9
numberofCCC 21
numberofDDD 32
Block1start 72 size 12
Block2start 84 size 180
Block3start 264 size 924
Block4start 1188 size 480
Block5start 1668 size 416
Block6start 2084 size 384
Block7start 2468 size 60
Block8start 2528 size 40
Block9start 2568 size 1152
Block10start 3720 size 432
Block11start 4152 size 432
Block12start 4584 size 48
Block13start 4632 size 80
unk4 4696 ;original value times 4

Block1
010005000b0c0d0e0fffffff

Block2
0100202100000c00006001000000000000000000
0100242500000c00006001000000000000000000
0100282900000c00006001000000000000000000
0100222300801500009001000000000000000000
0100262700801500009001000000000000000000
01002a2b00801500009001000000000000000000
0100021200000000000000000000000000000000
0100021300000000000000000000000000000000
06000214000000000000020000a0ecff00000000

Block3
00ffffff0000b80b00402bfe0000f0d80000000000008e33000000000010100000000000ffffffffffffffff
00ffffff0000b80b00402bfe0000f0d80000000000000000000000000010100000000000ffffffffffffffff
002d0b02000000000080e5f900000000000000000000000000000000003030001200ffff06ffffffffffffff
000606000080790b00e03afe0000f0d80000000000008e3300000000001010000001000000ffffffffffffff
000702010080020a00e03afe0080abd90000000000008e3300000000001010000102010100ffffffffffffff
01150505000060f000402bfe0080311700000000000000200000000000101000020302020bffffffffffffff
0115050500809ef000402bfe0080311700000000000000200000000000101000030402020cffffffffffffff
01150505000060f000402bfe000018fc000000000000711c00000000001010000405020209ffffffffffffff
01150505000060f000402bfe008056fc000000000000711c0000000000101000050602020affffffffffffff
01150505000060f000402bfe0000c0e0000000000000c71100000000001010000607020207ffffffffffffff
01150505000060f000402bfe00003de1000000000000c71100000000001010000708020208ffffffffffffff
01140304000060f000402bfe00c0980b0000000000001c1f00000000001010000c0d030304ffffffffffffff
01150505000060f000402bfe0000b80b0000000000001c1f00000000001010000809020205ffffffffffffff
0115050500c040f000402bfe0000b80b0000000000001c1f0000000000101000090a020205ffffffffffffff
01150505000060f000402bfe0040d70b0000000000001c1f00000000001010000a0b02020bffffffffffffff
0115050500407ff000402bfe0000b80b0000000000001c1f00000000001010000b0c02020bffffffffffffff
011304030000000000008ffd0000d8dc000000000000c71100000000001010000d0e040404ffffffffffffff
01130403000018fc00008ffd000055dd000000000000c71100000000001010000d0f040404ffffffffffffff
002d0702000000000080e5f900000000000000000000000000000000003030001300ffff06ffffffffffffff
002d0802000000000080e5f900000000000000000000000000000000003030001300ffff06ffffffffffffff
002d0a02000000000080e5f900000000000000000000000000000000003030001400ffff06ffffffffffffff

Block4
102701010000030101000000ffffffff
102701020000030101000000ffffffff
8c0002ff00010301010001001500ffff
8c0002ff00010301010000001500ffff
8c0002ff00010301010001001500ffff
8c0002ff00010301010001001500ffff
8c0002ff00010301010001001500ffff
8c0002ff00010301010001001500ffff
8c0002ff00010301010001001500ffff
8c0002ff00010301010001001500ffff
8c0002ff00010301010001001500ffff
8c0002ff00010301010001001500ffff
780002ff00010301010001002100ffff
8c0002ff00000301010000003300ffff
3c0002ff010003010100000032000000
3c0002ff010003010100000032000000
3c0002ff010003010100000032000000
3c0002ff010003010100000032000000
102701ff000003010100010000009600
102701ff000000000000010000000000
102701ff000000000000010000003c00
3c0002ff00000301010001002a00ffff
102701ff0100030001000100ffff0000
102701ff010003010100010000000000
102701ff010003000000010000000000
102701ff010003000000010000000000
102701ff010003000000010000000000
102701ff010000000100010000000000
102701ff010000000000010000000000
102701ff010000000000010000000000

Block5
0400ff00f0d20000000000000000000000000000000000000000c4090000e204
03ffff00f0d200000000d00700008ffd0000e119000000000000a00f0000e204
03ffff00f0d200000000d60600008ffd000012fd000000000000a00f0000e204
03ffff00f0d200000000000000008ffd0000aee3000000000000a00f0000e204
0200ff00f0d2000000000000000000000080bb00000000000000c4090000e204
0200ff00f0d2000000000000000000000080bb00000000000000a00f0000c409
01ffff00f0d20000000000000080e5f9000000000000000000002e220080841e
03ffff00f0d2000000006cee00008ffd0000b4e2000000000000dc050080a304
0200ff00f0d20000000000000000000000000000000000000000d00700005307
03ffff00f0d20000000060f000008ffd000018fc000000000000dc050080a304
0200ff00f0d20000000000000000000000000000000000000000d00700005307
03ffff00f0d2000000006cee00008ffd00802519000000000000dc050080a304
0200ff00f0d20000000000000000000000000000000000000000d00700005307

Block6
01020000008056fc0080c7fe1e000807000068012c010e01
03070000008056fc0080c7feb4002c0100003c000807b400
03070000008056fc0080c7feb4002c0100003c000807b400
02040000008056fc0080c7fe500014050000c80084034a01
03070000008056fc0080c7fe1e000807000068012c015a00
02040000008056fc0080c7fe500014050000c80084034a01
03070000008056fc0080c7fe1e000807000068012c013c00
02040000008056fc0080c7fe500014050000c80084034a01
03070000008056fc0080c7fe1e000807000068012c013c00
02050000008056fc0080c7fe9b002602000050004006f000
02050000008056fc0080c7fe9b002602000050004006f000
01070000008056fc0080c7fe37000e060000180158027800
01070000008056fc0080c7fe1e000807000068012c017800
03060000008056fc0080c7fe9b0026020000500040067800
02040000008056fc0080c7fe500014050000c80084034a01
01030000008056fc0080c7fe37000e060000180158026801

Block7
01005a001c07000028230000
03005a001c07000028230000
030050001c070000401f0000
01005a001c070000401f0000
030046001c070000581b0000

Block8
0200080060090000
0100080060090000
0400080034080000
0400050034080000
03000500d6060000

Block9
01390802000060f0000000000000350c000000000000000000000000011010000eff0600
0130ff01000060f0000000000000350c000000000000000000000000001010000f090601
013c090200a055ec0000000000e0f9df0000000000000000000000000110100010ff0600
0130ff0100a055ec0000000000e0f9df00000000000000000000000000101000110a0601
01390802000066ef000000000000350c000000000000000000000000011010000eff0600
0130ff01000066ef000000000000350c000000000000000000000000001010000f0b0601
013c0902006056ef0000000000c0f8fb0000000000000000000000000110100010ff0600
0130ff01006056ef0000000000c0f8fb00000000000000000000000000101000110c0601
0139080200b0daec000000000050f819000000000000000000000000011010000eff0600
0130ff0100b0daec000000000050f819000000000000000000000000001010000f0d0601
013c09020000dcec000000000040071a0000000000000000000000000110100010ff0600
0130ff010000dcec000000000040071a00000000000000000000000000101000110e0601
012b09060000f5ec0020d1ff008004e00000000000000010000000000010100115000702
012b09060000e3ef00c0e0ff002002fc0000000000000010000000000010100115010702
012b0906000072ed00c0c7ff0040001a0000000000000010000000000010100115020702
012b09060000aaf200e0b1ff008056e30000000000000018000000000010100115030702
012b0906009029fc0020d1ff00c063e00000000000000000000000000010100115040702
012b0906009022f600c0e0ff00d08afd0000000000000000000000000010100115050702
012b09060080f2ef0080a8ff00e043180000000000000038000000000010100115070702
012b090600c097f80040a2ff00f0501a0000000000000028000000000010100115080702
0038ff02a3648e30c32df5ffc2a17a0f0000000000000000000000000010100017ff0600
0031ff010ac78d30d84bfaffc211690f00000000000000000000000000101000180f0601
0030ff0100d493307becf9ff28049b0f0000000000000000000000000010100019100601
0030ff013df681301fb9f9ff47e99e0f000000000000000000000000001010001a110601
00000000f5ac8e305d0bf6ffc2fd7a0f000000000000000000000000001010001bff08ff
00000100f5ac8e305d0bf6ffc2fd7a0f000000000000000000000000001010001cff08ff
00000200f5ac8e305d0bf6ffc2fd7a0f000000000000000000000000001010001cff08ff
00000300f5ac8e305d0bf6ffc2fd7a0f000000000000000000000000001010001cff08ff
00000400282c8430488df9ff70d9870f000000000000000000000000001010001dff08ff
00000500282c8430488df9ff70d9870f000000000000000000000000001010001dff08ff
00000600282c8430488df9ff70d9870f000000000000000000000000001010001dff08ff
00000700282c8430488df9ff70d9870f000000000000000000000000001010001dff08ff

Block10
01010500d606000000f80008aa0a551504003c005a000000
01010500d606000000f80008aa0a551504003c005a000000
01010500d606000000f80008aa0a551504003c005a000000
01010500d606000000f800080008002804003c005a000000
01010500d606000000f800080010003004003c005a000000
01010500d606000000f800080020e34804003c005a000000
01010500d606000000f80008c731c75104003c005a000000
01010500d606000000f800080028004804003c005a000000
01010500d606000000f800080020004804003c005a000000
01010a0088130000e300380e5505aa1a020046003c000000
01010a0088130000e300380e5505aa1a020046003c000000
01010a0088130000e300380e5505aa1a020046003c000000
01010a0088130000e300380e5505aa1a020046003c000000
01010a0088130000e300380e5505aa1a03003c003c000000
01010a0088130000e300380e5505aa1a03003c003c000000
11006400401f0000e300380e5505aa1a01001e002c010000
01010a0088130000e300380e5505aa1a04003c005a000000
01010a0088130000e300380e5525aa3a04003c005a000000

Block11
0400001000000000124a00000000adf8000000000000350c00000000000000000000350c00005307000000000000350c
0400001000000000124a0000003081ef0000000000a0f3df00d062f50000000000107fe1004018050000000000107fe1
0400001000000000124a00000000adf8000000000000350c00000000000000000000350c00005307000000000000350c
0400001000000000124a000000408ff4000000000020a9fc00a0adf600000000007032fe00f079ff00000000007032fe
0400001000000000aa42000000700eef0000000000e0651900a0fcf9000000000080191b00000000000000000080191b
0400001000000000e358000000700eef0000000000a0781900a0fcf9000000000080321b00000000000000000080321b
000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
030000000000000068070000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Block12
0700000000000000000000000000ffff
0200000000000000000000000000ffff
1500000000000000000000000000feff

Block13
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

ffffffffffffffffffffffffffffffff
User avatar
Krishty
Site Admin
Posts: 1364
Joined: 2022-Jan-09, 00:59

Re: Ace Combat levels

Post by Krishty »

mikew wrote: 2023-Sep-15, 08:47This is an example how I'm splitting things right now:
Great! Mostly identical to my analysis 👍 My 5 ct:

Block 2
The last four bytes are always zero.
The first four bytes are unknown.
But the twelve bytes in-between seem to correspond to six 16-bit numbers. Bounding boxes?

Block 3
The last byte is always FFh. Seems to be a marker for “unused” data.

Block 9
I hope you didn’t overlook:
Krishty wrote: 2023-Aug-20, 01:10The section denoted by wordsToObjects is an array of the following structure (length can be computed from the offset to the following section):

Code: Select all

// Types of objects in missions.
enum class MissionObjectType : uint8_t {
	static_ = 0, // bridges, carrier decks, …
	gndTgt  = 1, // ground targets
	ship    = 2, // ships, submarines, …
	airdrop = 3, // airdrop in “Enter Dision”
	train   = 4, // train in “One-Way Ticket”
	sam     = 5, // surface-to-air missiles in “Damage Control” (friendly ones?)
	heli    = 6, // can move a bit vertically and turn towards the player
	debris  = 7, // building debris in “The Orientation” after they collapsed with an animation
	antlion = 8  // air-dropped Antlion tanks in “Reaching for Stars”
};

// Objects in mission files.
//  • no AI; may move but only along simple, pre-defined paths
struct MissionObject {
	uint8_t           unknownA;
	uint8_t           unknownB;
	uint8_t           indexOrFF; // semantics depend on type
	MissionObjectType type;
	int32_t           x; // meters × 16384
	int32_t           y; // meters × 16384
	int32_t           z; // meters × 16384
	uint8_t           unknownD[12];
	uint8_t           unknownE;
	uint8_t           unknownF;
	uint8_t           unknownG;
	uint8_t           unknownH;
	uint8_t           unknownI; // some kind of index?
	uint8_t           unknownJ; // some kind of index? “0xFF” if unused
	uint8_t           unknownK; // some kind of index?
	uint8_t           unknownL; // some kind of index? “0xFF” if unused
};

Maybe we can correlate a few bytes to the number of objects/planes in a mission. E.g. data/34/3 is the pack with all rotatable models for M28 Dilemma, and there are 128 of them. I can’t extract all of them and I need to find out why (could be as simple as them being empty) …

image.png
image.png (144.81 KiB) Viewed 2231 times

Most of the models we see above are individual parts of the Sphyrna airship seen at the end of the gameplay video here:


So models 28–35 and also 40–45 and 127 make up the Sphyrna, and the game displays all of them always in the same place. Is there some kind of grouping going on?

Index 36 seems to denote the most detailed LOD of a helicopter. Maybe this number appears prominently somewhere in the data? Helicopters have mission object type 6 in block 9, according to my code above.

Speaking of LODs: Most objects seem to have three LODs, but I’m not sure yet. They are not always at consecutive indices either. This, too, needs to be somewhere in that file …
mikew
Data Genius
Posts: 603
Joined: 2022-Jan-09, 20:21

Re: Ace Combat levels

Post by mikew »

No, I didn't overlook your breakdown of Block9, but I wanted to sort out the basic structure 'my way' first. I probably need to duplicate what you've done somewhat to gain familiarity.

Anyway, I'm relying on this site for the gameplay aspects:
https://acecombat.fandom.com/wiki/Awakening
...and from that, we can see that Block3 looks like it contains the enemy plane info plus 5 elements at the start which I haven't correlated with anything yet.
m01_b3.PNG
m01_b3.PNG (50.06 KiB) Viewed 2227 times
Where 0x28 is the R-501 etc
User avatar
Krishty
Site Admin
Posts: 1364
Joined: 2022-Jan-09, 00:59

Re: Ace Combat levels

Post by Krishty »

mikew wrote: 2023-Sep-15, 10:58Anyway, I'm relying on this site for the gameplay aspects:
https://acecombat.fandom.com/wiki/Awakening
FYI: That wiki recently moved, because Fandom has become a horrible nightmare of advertisement and tracking. The new version is at https://acecombat.wiki.gg/wiki/Awakening but it will take some time for Google to pick up the site rank.
...and from that, we can see that Block3 looks like it contains the enemy plane info plus 5 elements at the start which I haven't correlated with anything yet.
m01_b3.PNG
Where 0x28 is the R-501 etc
FANTASTIC!

That site does not list friendly planes, which would be You + Erich + Fiona + Rena according to this gameplay video. So, only one unknown entry left?
mikew
Data Genius
Posts: 603
Joined: 2022-Jan-09, 20:21

Re: Ace Combat levels

Post by mikew »

The first byte of each Block3 element is either 0 or 1, with 1 meaning enemy. I'm not quite sure how to interpret the 0 elements.
There are always 2 lines starting with 00ff, so they may relate to the player's plane.

Regarding the plane codes in the second byte of each Block3 element, here's a rough list cross referenced from that wiki site.
Note that helicopters (R-701?)or the V22 don't seem to live in Block3

Code: Select all

01 F/A-18I Hornet ADV
02 F-16XF
03 F-16XA
04 F-15S/MT
05 A/F-117X NAV Hawk
06 F-22C
07 F/A-32C
08 XFA36A
09 RF12A2
0a EF-2000E or F/A-18U Hornet ADV (M19)
0b MiG-33 (M21)
0c EF-2000E or F/A-18U Hornet ADV (M19)
0d R-101U
0e R-101U or R-505U "Fiona"
0f R-201U (M21)
10 R-101U or R-505U "Fiona" or Su-37 (most likely)
11 Su-43
12 R-101 Delphinus 1
13 R-201 Asterozoa
14 R-102 Delphinus 2
15 R-211 Orcinus
16 R-103
17 R-311

19 XR-900
1a X-49 "Rena" (M30)
1b UI-4053 (M30)
1c XFA36A ?? (M16 Broken Wings)
1d Su-43 ?? (M16 Broken Wings)
1e R103 ?? (M16 Broken Wings,M17)

21 C-17B
22 B-1C

26 R-505U "Fiona"
27 R-352
28 R-501
29 R-531
2a R-808

2d Ouroboros fighters (M16 Broken Wings,M17)
2e IRBM (M27)
2f SAM (M35)

52 Decoy
User avatar
Krishty
Site Admin
Posts: 1364
Joined: 2022-Jan-09, 00:59

Re: Ace Combat levels

Post by Krishty »

Outstanding! 👏
mikew wrote: 2023-Sep-15, 22:15Note that helicopters (R-701?)or the V22 don't seem to live in Block3
Helicopters live in block 9 (with ships, trains, AA guns etc). Not sure about the V-22, but I think I have once seen an AA gun in its place during my experiments, so I assume that it too lives in block 9.

I assume that in block 3, the bytes 6/7, 10/11, and 14/15 form 16-bit signed integers, respectively. The correlation is pretty high, and M01 shows very clear numbers like 2500, -2200, and -4500. These can’t occur by coincidence alone.
mikew
Data Genius
Posts: 603
Joined: 2022-Jan-09, 20:21

Re: Ace Combat levels

Post by mikew »

Hard to say. Those 'plane codes' from my last post may in fact be 4 bytes long.
For M01, that seems to be the case, but right now I'm just 'looking' at the block to see what is worth scanning all the files for.
There's a bit/byte which marks whether the plane is marked with a TGT symbol, and also some differences if a plane appears in the 'main mission' or some extension after an event.
Those bytes could be grouped as you say, but almost look like 24 bit signed integers with a zero padding.

Here's M01's Block3 cut up with some comments. Anything here which stands out?

Code: Select all

00 ffffff00 000d e900 c069 fe00 000d e900 0000 0000 0000 0800 0000 00 00 1010 0000 0000 00ff ffff ffffffffff
00 ffffff00 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 00 00 1010 0000 0000 00ff ffff ffffffffff´

00 10040200 008a e900 c069 fe00 80c8 e900 0000 0000 0000 0800 0000 00 00 1010 0001 0301 0106 0907 ffffffffff
00 0a060100 c06a e900 c069 fe00 40a9 e900 0000 0000 0000 0800 0000 00 00 1010 0002 0400 0007 ffff ffffffffff
00 0a060100 804b e900 c069 fe00 008a e900 0000 0000 0000 0800 0000 00 00 1010 0003 0500 0008 ffff ffffffffff

01 28050000 20ae f000 0089 fe00 00dd f000 0000 0000 0000 0800 0000 00 01 1010 0000 00ff 020a ffff ffffffffff R-501 TGT
01 28050000 00dd f000 0089 fe00 20ae f000 0000 0000 0000 0800 0000 00 01 1010 0000 00ff 0203 ffff ffffffffff R-501 TGT
01 28050000 8074 f700 0089 fe00 60a3 f700 0000 0000 0000 0800 0000 00 01 1010 0000 00ff 020a ffff ffffffffff R-501 TGT
01 28050000 60a3 f700 0089 fe00 8074 f700 0000 0000 0000 0800 0000 00 01 1010 0000 00ff 0203 ffff ffffffffff R-501 TGT

01 12020300 f0a1 f000 6079 fe00 00dd f000 0000 0000 0000 0800 0000 00 00 1010 0004 0000 0300 ffff ffffffffff R-101
01 12020300 d0d0 f000 6079 fe00 20ae f000 0000 0000 0000 0800 0000 00 00 1010 0004 0000 0300 ffff ffffffffff R-101
01 13030400 5068 f700 6079 fe00 60a3 f700 0000 0000 0000 0800 0000 00 00 1010 0005 0102 0401 ffff ffffffffff R-201
01 13030400 3097 f700 6079 fe00 8074 f700 0000 0000 0000 0800 0000 00 00 1010 0005 0102 0402 ffff ffffffffff R-201
These appear if R-501s are shot down within 3 minutes
01 12020300 00dc 0500 402b fe00 00dd f000 0000 0000 0000 0000 0000 00 01 2020 0004 0200 0305 ffff ffffffffff R-101 TGT
01 12020300 00c4 0900 80c7 fe00 800f f300 0000 0000 0000 0000 0000 00 00 2020 0004 0100 0305 ffff ffffffffff R-101
01 12020300 00f4 0100 0089 fe00 00e9 ee00 0000 0000 0000 0000 0000 00 00 2020 0004 0100 0306 05ff ffffffffff R-101
01 12020300 00d0 0700 804a fe00 006c ee00 0000 0000 0000 0000 0000 00 00 2020 0004 0100 0306 05ff ffffffffff R-101
mikew
Data Genius
Posts: 603
Joined: 2022-Jan-09, 20:21

Re: Ace Combat levels

Post by mikew »

No time for this over the last couple of days, but some comments regarding the files I've been analyzing.

For now, I've only been considering files that are part of the missions used in the game. For the 'sky' 0.dat files, these are all exactly the same length, but are shorter for the 'extra' missions.

For the 52 mission 7/ directories, all but 4 contain 5 files (0.dat to 4.dat), so have only included these 48 in the recent analysis.
So, making an attempt to include these missing missions, I see that M06 and M08 each have 3 sets of 0.dat to 4.dat files for some reason. My parser has some problems with these, but I do see that the first byte in Block3 can be 0x02 for both of these missions.

M12 and M37 have their 0.dat files in an extra directory (/7/0/0.dat instead of 7/0.dat), and my parser completely chokes on these for now.

Anyway, I should probably try to understand why these 4 missions are different before doing anything else.
User avatar
Krishty
Site Admin
Posts: 1364
Joined: 2022-Jan-09, 00:59

Re: Ace Combat levels

Post by Krishty »

mikew wrote: 2023-Sep-18, 09:59For now, I've only been considering files that are part of the missions used in the game. For the 'sky' 0.dat files, these are all exactly the same length, but are shorter for the 'extra' missions.
Correct 👍
mikew wrote: 2023-Sep-18, 09:59 For the 52 mission 7/ directories, all but 4 contain 5 files (0.dat to 4.dat), so have only included these 48 in the recent analysis.
So, making an attempt to include these missing missions, I see that M06 and M08 each have 3 sets of 0.dat to 4.dat files for some reason. My parser has some problems with these, but I do see that the first byte in Block3 can be 0x02 for both of these missions.
Both M06 and M08 are randomized missions. In M06, you fly through a canyon and the target can be found in one of several places; it’s different whenever you start the mission. In M08, you protect an airship that may take one of several different paths.

If I look at M06 in TFXplorer, which ignores all but 0.dat, the final target (whose position should be randomized) is missing completely from the level.

So I presume that these additional files store randomized targets and the engine picks a set at random when the game starts.

Note: The doors in M51 Tunnel Vision look randomized on first sight too, but speedruns suggest that they are in fact based on the player’s heading. E.g. in this video at 0:50 the player seems to point the nose towards a door for an instant to make it close.
mikew wrote: 2023-Sep-18, 09:59M12 and M37 have their 0.dat files in an extra directory (/7/0/0.dat instead of 7/0.dat), and my parser completely chokes on these for now.
So does mine. I had to hard-code that 😔
mikew wrote: 2023-Sep-18, 09:59Anyway, I should probably try to understand why these 4 missions are different before doing anything else.
This is where I kindly disagree – there is so much undiscovered stuff. Missions being divided into stages, with events being triggered dynamically. How does the engine designate ships as two or three targets (bridge + AA gun + SAM) when there is no such information in the model file. Etc pp

We should get an overview first, and pick the low-hanging fruits. When the easy stuff is solved and only the difficult problems remain, they automatically become easy by principle of exclusion … or so I hope 😆
mikew
Data Genius
Posts: 603
Joined: 2022-Jan-09, 20:21

Re: Ace Combat levels

Post by mikew »

Yes, since I wrote that, I'm now including one set from M06 and M08 in my 7/ analysis. I'll worry about M12 and M37 later.

M06 and M08 are also different in that they both have a large 'Block14' that takes up most of the 0.dat file.
There's a pointer to it at the start of the file, which works for M06 and M08, but some files have invalid values. Something else to sort out...

EDIT: I meant M03 (not M08) and M06 with the large 'Block14'. These missions both have a chase element, so may be something to do with that.
User avatar
Krishty
Site Admin
Posts: 1364
Joined: 2022-Jan-09, 00:59

Re: Ace Combat levels

Post by Krishty »

mikew wrote: 2023-Sep-16, 10:34Those bytes could be grouped as you say, but almost look like 24 bit signed integers with a zero padding.
I finally checked and you are completely right. These are the X, Y, Z position multiplied by 25,600 (centimeters×256), stored as 24-bit numbers.

Mapping it to the overview places everything exactly where the player, allies, and enemies spawn:
image.png
image.png (55.91 KiB) Viewed 1443 times
Will implement this and then check if it applies to other maps. I don’t have enemies yet so I will only spawn the player, who is hopefully always at the first position.

Best to test the tunnel level as it requires placement accurate to 100 m or you’ll spawn outside of the tunnel …
User avatar
Krishty
Site Admin
Posts: 1364
Joined: 2022-Jan-09, 00:59

Re: Ace Combat levels

Post by Krishty »

Correction: It’s *not* multiplied by 25,600, it’s full 32-bit numbers multiplied by 32,768. But it looks like 24-bit numbers because if you divide by 256, they are all evenly divisable by 1000. It’s very odd.

What got me on the wrong track is the altitude. I compared my Y coordinate with the altimeter in AC3, but for some reason it is off by factor ~0.81. E.g. the Stratosphere mission spawns you at 45,480 ft according to the data, but AC3 displays 37,301. I am pretty perplexed?!

Anyway. Here is Stratosphere:
image.png
image.png (1.96 MiB) Viewed 1436 times
And Tunnel Vision:
image.png
image.png (4.6 MiB) Viewed 1436 times
Resistance starts on the runway, but sadly the game spawns you 50 ft above it. Pretty sure they had to do this to avoid clipping problems with the PSX renderer. That’s a bit sad, because if it were 10 ft then UAW would automatically place the plane on the ground, with gear extended, parked like in the game. Maybe I’ll just subtract 40 ft everywhere …
image.png
image.png (1.48 MiB) Viewed 1436 times
So, coordinate system is the same as for static models (meters ×32,768) and spawn points work, but altitude is displayed differently in AC3.

Note that planes now face the wrong direction. It would be great to find out where the game stores the heading for each unit! I haven’t identified angles in the data files so far, so it could be degrees, rad, full circles divided by 4096 (popular on PSX for some reason) or anything else.

Edit: The game does not seem to be able to spawn with arbitrary headings. It seems to be limited to N/E/S/W and to NE/NW/SE/SW. So the heading could be hidden in a 3-bit number!

Here’s the player heading from what I’ve seen in playthroughs:

Code: Select all

M01 Awakening		NE
M24 Stratosphere	E
M48 Resistance		N
M51 Tunnel Vision	N
User avatar
Krishty
Site Admin
Posts: 1364
Joined: 2022-Jan-09, 00:59

Re: Ace Combat levels

Post by Krishty »

Solved. The 24th byte is 8 for Awakening (NE), 16 for Stratosphere (E), and 0 for Tunnel Vision (N).

So the heading in degrees can simply be computed from this byte via × 360 / 64. Checked it with a few other missions and works nicely.

It is well possible that the bytes immediately before or after it are pitch and roll angles; I haven’t checked. M24 Stratosphere starts with you pitching up IIRC, so this is where we could investigate it.

As of today, TFXplorer does not support roll/pitch for spawning, so we couldn’t use this data. But it may come in handy later, when the engine supports actual waypoints.
mikew
Data Genius
Posts: 603
Joined: 2022-Jan-09, 20:21

Re: Ace Combat levels

Post by mikew »

Heh, I kind of regretted that '24 bit integer' comment, as while they indeed looked like 24 bit integers, it would be unusual if they were used like that.

I should revisit my AC3 parser.
User avatar
Krishty
Site Admin
Posts: 1364
Joined: 2022-Jan-09, 00:59

Re: Ace Combat levels

Post by Krishty »

mikew wrote: 2024-Jan-20, 23:26I should revisit my AC3 parser.
Didn’t want to distract you; I just had this code in my hands while finishing up the terrain API docs 🙂

The heading thing has an important implication: If AC3 stores angles in 0…63 range there, it may do the same for the sun. We should revisit the sky files and check for two bytes in 0…63 range that could denote sun angle.

That’s pretty important as I currently have to set the sun angles manually for all 60 missions, which I won’t do for obvious reasons – but then the sky looks shitty in most of them.
Post Reply