Unknowns in the PoP2 level format

About PR usage and development, and about the POP format.
Post Reply
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Unknowns in the PoP2 level format

Post by David »

unknown I: offset = 6208 = 0x1840, size=32
* 1 byte at 0x1840: Last used room. In PoP2, the modifier remapping affects tunnels only. The top bit of the first modifier is cleared to hide the tunnel (until the kid enters it).
* 4 bytes at 0x1841: Always contains "JEFF". Might be a reference to the programmer, Jeffrey Charvat.
* 1 byte at 0x1845: The type of the level. 1=desert, 2=temple, 3=caverns, 4=ruins, 5=rooftops, 6=final.
* 1 byte at 0x1846: Unknown. On the original levels they can be: 1,2,5,9,10,12,13,15,22.
* 1 byte at 0x1847: Level number (1..14). Used to decide what special events happen.
- On Gameplay level 2 it is erroneously set to 10. Therefore, the special event that would cause the level to end won't happen.
* array of 12 words at 0x1848: Which optional resources should be loaded.
0: spike
1: lava
2: skeleton (ruins)
3: slicer
4: dart gun
5: pusher
6: turn floor
7: skeleton (caverns)
8: guard run
9: guard jump
10: guard fall
11: potion
Items 0..7 are overridden by the contents of the level.

At 0x1860 is the (documented) start position. (size=3)

unknown II: offset = 6243 = 0x1843, size=4
* 3 bytes at 0x1843: Unknown. Always contains 0,1,0.
* 1 byte at 0x1846: Type of guards on the level. 0=guard, 2=skeleton, 5=head, 7=bird, 255=none.

At 0x1867 are the (documented) static guards. (size=32*116=3712=0xE80)

As I mentioned earlier, the checkpoints are at 0x26E7.
* 2 bytes at 0x26E7: Room and tile of checkpoint 1.
* 2 bytes at 0x26E9: Room and tile of checkpoint 2.
* 14 bytes at 0x26EB: Not used.

At 0x26F9 are the dynamic guards. (size=32*34=1088=0x440)

unknown III: offset = 0x2B39, size=32*30=960.
For each tile of each room, tells which set of background musics should be used. (0 or 1)
Set 1 seems to indicate danger.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Unknowns in the PoP2 level format

Post by Norbert »

Nice.
I like that PoP2 has a lot more information in the levels file.
Lots of new possibilities for custom levels too.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Unknowns in the PoP2 level format

Post by Norbert »

David wrote:unknown III: offset = 0x2B39, size=32*30=960.
For each tile of each room, tells which set of background musics should be used. (0 or 1)
Set 1 seems to indicate danger.
How did you figure this out? I understand you saw more dangerous areas, but it's interesting how you noticed or thought about changes in music.
I created an XLS file with an overview of all locations where this byte is not set to 0.
You're right that there's clearly a difference in music when the prince moves from 0 to 1 (loose tiles, shooters, and so on) and vice versa.
I'll include a music screen in apoplexy 2.0 that'll allow users to change those bytes. Little extra work, but relatively easy.
Attachments
music_not_0.xls
music != 0
(387.5 KiB) Downloaded 116 times
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Unknowns in the PoP2 level format

Post by Norbert »

I'm not just using the information about music, but I'm also using other information.
For example, I always set the last room used to 32, fix the event level number (for gameplay 2), and enable more resources for the levels.
Simply enabling all resources for all levels won't work, I've learned.

Also, according to the resource settings of the original PoP2, this guard can fall (and run), but not jump, which might explain his strange behavior... ;)
Attachments
optional_resources.xls
default optional PoP2 resources
(30.5 KiB) Downloaded 82 times
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Unknowns in the PoP2 level format

Post by David »

Norbert wrote:How did you figure this out?
I started to disassemble PoP2.
Also, most MIDI music resources have a name embedded in them. (But the game refers to them by their resource IDs.)
For the background music, the name looks like this: "Cav1A.mff".
Here, "Cav" is the level type (Cav/Ruins/Temple), "1" is the set (1=normal, 2=danger, 3=?), and "A" is the index within the set (A-P for sets 1 and 2, or A-D for set 3).
Norbert wrote:Also, according to the resource settings of the original PoP2, this guard can fall (and run), but not jump, which might explain his strange behavior... ;)
This happens only in PoP2 1.1 (not in IR or 1.0), and I don't think it's related to the resource settings. Those tell what images to load, not what a guard can do.
Something similar can be done on level 1.
Also, the "fall" refers to the "special" falling, for example when a guard falls off the bridge or the roof (on level 1 or the second half of level 13).
It also includes the landing after jump and the bowing of the birdman.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Unknowns in the PoP2 level format

Post by Norbert »

David wrote:unknown I: [...]
* 1 byte at 0x1846: Unknown. On the original levels they can be: 1,2,5,9,10,12,13,15,22.

unknown II: [...]
* 3 bytes at 0x1843: Unknown. Always contains 0,1,0.

As I mentioned earlier, the checkpoints are at 0x26E7.
[...]
* 14 bytes at 0x26EB: Not used.
All those 'unused checkpoints' are either 0 or 90, which may be suspicious.
I reversed all of them (0->90, 90->0) and played - also finished - several levels, but didn't see/hear any differences.
Here's an overview of all unknown bytes:
Spoiler: show
=== Level 1 ===
Unknown I (1 byte):
10
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 0

=== Level 2 ===
Unknown I (1 byte):
2
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 90 90 0 0 0

=== Level 3 ===
Unknown I (1 byte):
2
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 90 90 0 0 0

=== Level 4 ===
Unknown I (1 byte):
15
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 0

=== Level 5 ===
Unknown I (1 byte):
9
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 0

=== Level 6 ===
Unknown I (1 byte):
9
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 90

=== Level 7 ===
Unknown I (1 byte):
12
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 90 90 0 0 0 0 0

=== Level 8 ===
Unknown I (1 byte):
9
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 0

=== Level 9 ===
Unknown I (1 byte):
2
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 0

=== Level 10 ===
Unknown I (1 byte):
9
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 90

=== Level 11 ===
Unknown I (1 byte):
13
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 90

=== Level 12 ===
Unknown I (1 byte):
13
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 90

=== Level 13 ===
Unknown I (1 byte):
22
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 90

=== Level 14 ===
Unknown I (1 byte):
5
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 0

=== Level 15 ===
Unknown I (1 byte):
10
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 0

=== Level 16 ===
Unknown I (1 byte):
1
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 90 90 0 0 0

=== Level 17 ===
Unknown I (1 byte):
2
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 90 90 0 0 0

=== Level 18 ===
Unknown I (1 byte):
2
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 90 90 0 0 0

=== Level 19 ===
Unknown I (1 byte):
9
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 0

=== Level 20 ===
Unknown I (1 byte):
9
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 90

=== Level 21 ===
Unknown I (1 byte):
12
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 90 90 0 0 0 0 0

=== Level 22 ===
Unknown I (1 byte):
9
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 0

=== Level 23 ===
Unknown I (1 byte):
2
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 0

=== Level 24 ===
Unknown I (1 byte):
9
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 90

=== Level 25 ===
Unknown I (1 byte):
13
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 90

=== Level 26 ===
Unknown I (1 byte):
2
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 90

=== Level 27 ===
Unknown I (1 byte):
2
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 90

=== Level 28 ===
Unknown I (1 byte):
9
Unknown II (first 3 bytes):
0 1 0
Checkpoints (last 14 bytes):
0 0 0 0 0 0 0 0 0 0 0 0 0 0
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Unknowns in the PoP2 level format

Post by David »

David wrote: November 2nd, 2013, 1:59 pm unknown III: offset = 0x2B39, size=32*30=960.
For each tile of each room, tells which set of background musics should be used. (0 or 1)
Set 1 seems to indicate danger.
I found a reference to the game using different music for dangerous places:
https://macintoshgarden.org/games/prince-of-persia-2 (the last image, i.e. the second page of the article)
At the bottom of the middle column it writes: "The ambient music is unobtrusive and peril sensitive."
Post Reply