POP2 animation script tool

Discussions about all other tools (CusPop, SAV/HOF editors) and hex editing.
Post Reply
FluffyQuack
Vizier
Vizier
Posts: 102
Joined: June 6th, 2004, 7:05 pm

POP2 animation script tool

Post by FluffyQuack »

I made a tool that can extract the SEQUENCE.DAT file from POP2, convert the contents into a text file with all animation scripts in text form, and repack modified animation scripts back into a new SEQUENCE.DAT.

Here's an example what the generated text file looks like: https://pastebin.com/raw/D8BskNW8

You can edit the data however you like: change script commands, add new ones, remove existing ones, etc. It might even be possible to add all-new animation scripts (note that a name always has to start with a unique number), though I'm not sure if there's much point in doing that since we can't easily modify the gameplay logic.

Some notes:
  • Animation scripts are executed instantly with the exception of the "ShowFrame" command. The game will always wait one gameplay tick after each "ShowFrame" command.
  • Some commands have unknown usage. Though, I suspect UnknownOp23 means looping the current active frame.
  • I've made the tool automatically assign names to a bunch of the animations that I was able to identify, but most of them will only be a number.
If anyone ends up experimenting with this and map out unknown data, then let me know. When I say unknown data I mean figuring out what the unknown animations correspond to, what the unknown commands do, and what the various PlaySound IDs sounds are.

Download and usage information: https://github.com/FluffyQuack/POPtool/releases

Video showcase:
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5764
Joined: April 9th, 2009, 10:58 pm

Re: POP2 animation script tool

Post by Norbert »

Nice to see PoP2 get some attention.
FluffyQuack
Vizier
Vizier
Posts: 102
Joined: June 6th, 2004, 7:05 pm

Re: POP2 animation script tool

Post by FluffyQuack »

I went ahead and mapped out the various sound IDs referenced in animation scripts (with the exception of ID 2, that's not referenced in animations).

0 = Silent?
1 = Footstep
2 = Tile crashing on the ground
18 = Drinking sound "Glug glug glug"
19 = Unsheathe sword
22 = Sound when tapping ceiling when jumping up
25 = Guard screaming as he falls off a ledge
44 = Sound when falling into quicksand
75 = Skeleton rising up from its dead state
76 = Skeleton rattling while it's staying dead
88 = The head enemy's death scream
89 = The head enemy's bite sound
193 = Some kind of "whoosh" sound. Sounds almost magical
195 = Some kind of clang sound. Sounds like a metal object hitting the ground
197 = A "wet" sound of something breaking followed by a short "whoosh" sound
256 = Two short "whoosh" sounds in quick succession
257 = Metal clang sound immediately followed by a magical-esque "whoosh" sound
261 = Magical-esque sound. Very likely the sound of the "disappear" spell by fake Prince
271 = Silent?
AJprince
Sheikh
Sheikh
Posts: 21
Joined: December 20th, 2021, 9:10 pm

Re: POP2 animation script tool

Post by AJprince »

Wow! This is great! Would this be a way to implement move speed and fight speed options in POP2 just like SDLPOP?
AJprince
Sheikh
Sheikh
Posts: 21
Joined: December 20th, 2021, 9:10 pm

Re: POP2 animation script tool

Post by AJprince »

I see you've been working on your Fluffy's Prince of Persia (Pop1 and Pop2 implementation). Fantastic! If I may request the move speed and fight speed options there, please consider it. I love how the SNES speed seems more fluid and with a slight increase to the speed adjustment in SDLPop, it looks wonderful to my eyes.

It's been wonderful watching your progress.
FluffyQuack
Vizier
Vizier
Posts: 102
Joined: June 6th, 2004, 7:05 pm

Re: POP2 animation script tool

Post by FluffyQuack »

AJprince wrote: January 2nd, 2025, 11:41 pm I see you've been working on your Fluffy's Prince of Persia (Pop1 and Pop2 implementation). Fantastic! If I may request the move speed and fight speed options there, please consider it. I love how the SNES speed seems more fluid and with a slight increase to the speed adjustment in SDLPop, it looks wonderful to my eyes.

It's been wonderful watching your progress.
Changing game speed is not possible by changing the animation sequences/scripts. I believe it's an official feature with the FM Towns port, though. I'm pretty sure you can change game speed there. That said, this is very easy to accomplish with the DOS version by messing with the executable.

Open the executable in a hex editor and search for this array of bytes: 06 00 EB 03 B8 05

It should correspond to these (decimal) offsets in the various DOS executables:
  • IR: 69824
  • 1.0: 71180
  • 1.1: 70454
Change the first number in the byte sequence (06) to define the game speed during combat, and change the last number (05) to define the game speed during normal gameplay.

The number defines how many frames the game should wait before simulating a tick of gameplay. Ie, 60/6 = 10fps, and 60/5 = 12fps.

POP1 SNES version runs at 15fps, so you'd want to set the last number to 4. Does the SNES version also slow down during combat? If so, you'd probably want the first number at 5, or set it to 4 if you want the entire game at 15fps.

Context for above byte array: It's code near the start of ResetFrameVars() that sets the framerate and it's called during the game's main loop.

Here's an example of the game running with both values set to 2 which makes it run at 30fps all the time:
AJprince
Sheikh
Sheikh
Posts: 21
Joined: December 20th, 2021, 9:10 pm

Re: POP2 animation script tool

Post by AJprince »

FluffyQuack wrote: January 5th, 2025, 2:02 am Changing game speed is not possible by changing the animation sequences/scripts. I believe it's an official feature with the FM Towns port, though. I'm pretty sure you can change game speed there. That said, this is very easy to accomplish with the DOS version by messing with the executable.

Open the executable in a hex editor and search for this array of bytes: 06 00 EB 03 B8 05

It should correspond to these (decimal) offsets in the various DOS executables:
  • IR: 69824
  • 1.0: 71180
  • 1.1: 70454
Change the first number in the byte sequence (06) to define the game speed during combat, and change the last number (05) to define the game speed during normal gameplay.
Fantastic!, it worked! I tested with the 1.0 version of PoP2. Thank-you so much. Thanks for porting this feature from the FM Towns version. :o
Post Reply