POP1 modding limits

Discussions about all other tools (CusPop, SAV/HOF editors) and hex editing.

Moderator: English Moderator Team

Post Reply
Doktor Headshot
Scholar Scribe
Scholar Scribe
Posts: 4
Joined: May 10th, 2016, 10:49 pm

POP1 modding limits

Post by Doktor Headshot » May 15th, 2016, 4:06 am

Since PopSource and FormatSpecifications docs didn't helped me, I've got some technical questions strictly related to the mod I am planning to make. My aim is to know the limits of POP1 modding.
  • - Ai-controlled Prince. This question is quite simple: how can I setup movements for Ai-controlled Prince (as shown in demo level)? I would like to add some kind of in-game cutscene after particular event occurs.

    - Shadow movements. Almost the same question as before: it is possible to script the Shadow in order to make it appear and move? Think about Shadow appearing and pressing a button in order to trap/liberate the Prince or just appearing and running in order to show him the way.

    - Automatic texts. It is possible to make a text appear in the bottom side of screen (where you read how many minutes are left) when particular event occurs?

    - Custom environments. POP1 allows two environments: Dungeon and Palace. It is possible to add a 3rd one (and perhaps a 4th, a 5th etc.) on the assumption everyone will have its own graphics stored on own .dat file? I asked because I didn't find any clear dungeon or palace reference in the .plv levels inspected with my hex editor nor in the aforementioned docs.

    - Prince animations I. Some "Kid" animations (e.g. running, crouching ecc.) become loopable after specific frame number x and most animations are connected to another ones by specific frame number x that is compatible both with old animation (to allow loop) and new animation (to allow smooth transition if player performs an action that requires the Prince to play a different animation). Is there any specific documentation or topic with a detailed list for these "special" frames and their effects (loop or inter-connect animations)? I asked because I would like to customize main character whose sprites are already made for every animations but they are not smooth and look choppy when looping or switching because I cannot identify those aforementioned "special" frames.

    - Prince animations II. Some "Kid" animations make Prince move or "shake" whilst animation is playing (e.g. you press down for crouching, you release down button, Prince stands up and get moved a bit forward; you drink potion and you see Prince "shaking" a bit etc.). Where can I edit these properties of animations? I specifically would like the Prince not to move forward when jumping up or crouching and I would like to disable "crouch bouncing forward".

    - Prince animations III. It is possible to implement a "turn crouching" animation on the assumption I already have frames? If yes, how?
Thanks in advance to every kind people who will send me a reply.

User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 3140
Joined: April 9th, 2009, 10:58 pm
Contact:

Re: POP1 modding limits

Post by Norbert » May 15th, 2016, 11:58 am

David once created an executable that allows for more than two level environments:
viewtopic.php?p=11122#p11122
viewtopic.php?p=11036#p11036

Prince of Persia for SNES already has 10 different level environments.
And it's easier to edit all guard properties with SNES: F2 in apoplexy; the Guards menu in Pr1SnesLevEd.

However, seeing what you want and have in mind, you should probably use SDLPoP or MININIM instead of an original game.
MININIM already includes some new movements, like hanging and falling turns.
If you're a skilled programmer, the PoP1 world is yours.

User avatar
oitofelix
Wise Scribe
Wise Scribe
Posts: 202
Joined: February 17th, 2016, 1:59 pm
Contact:

Re: POP1 modding limits

Post by oitofelix » May 15th, 2016, 6:22 pm

Hello Doktor!
Doktor Headshot wrote:
  • - Ai-controlled Prince.
    - Shadow movements.
    - Automatic texts.
Guile scripting is planned to be added to MININIM in the near future. When that happens you'll be able to do that and much more.
Doktor Headshot wrote:
  • - Custom environments.
This could theoretically be achieved partially in MININIM by replacing alternative graphics modes, resulting in 6 different environment modes. In any way I plan to add general graphics-set support for MININIM eventually.
Doktor Headshot wrote:
  • - Prince animations I.
    - Prince animations II.
Nice to hear that someone besides me is annoyed by the shaky and choppy animations of the original game. MININIM solves that problem. Let me know if any remain.
Doktor Headshot wrote:
  • - Prince animations III. It is possible to implement a "turn crouching" animation on the assumption I already have frames?
Could you describe this movement in more detail? If it's useful enough, I may implement it in MININIM if you send me the frames.

I'm interested in working with modders that have a free mindset, that would like to go way beyond the limitations of the original game engine. That's all MININIM is about: improving the game by removing any arbitrary limitation and implementing useful new features for a richer playing experience, whilst being truthful to the original game's roots.

MININIM has already several improvements over the original game engine. Try the development version available at the VCS. It has a complete in-game level editor, with unlimited undo and general multi-room support, among several other powerful features.

Ps: MININIM documentation is a bit outdated since multi-room has been implemented. Sorry.

Code: Select all

 88888  FFFFF Bruno Félix Rezende Ribeiro (oitofelix) [0x28D618AF]
 8   8  F     http://oitofelix.freeshell.org/mininim/
 88888  FFFF  mailto:oitofelix@gnu.org
 8   8  F     irc://chat.freenode.org/oitofelix
 88888  F     Please, support my work: http://oitofelix.freeshell.org/funding.html

Falcury
Wise Scribe
Wise Scribe
Posts: 329
Joined: June 25th, 2009, 10:01 pm

Re: POP1 modding limits

Post by Falcury » May 15th, 2016, 9:54 pm

Doktor Headshot wrote:Since PopSource and FormatSpecifications docs didn't helped me, I've got some technical questions strictly related to the mod I am planning to make. My aim is to know the limits of POP1 modding.
Like the others have said, depending on how far you are willing to go, the sky is the limit! ;)
I am experimenting with scripting support for SDLPoP; when I get around to it, I could definitely try to add the shadow movements, special event hooks and displaying text at the bottom as scripting features.
If you have more ideas, be sure to post them!
(See this thread for the experimental scripting feature for SDLPoP - it works, but is rough around the edges, still has limited functionality and is very scarcely documented)

If you want to change the shadow's hardcoded automatic movements by modifying PRINCE.EXE, I believe David found out how this can be done (unfortunately I can't find back where this was discussed...)
Doktor Headshot wrote:- Custom environments. POP1 allows two environments: Dungeon and Palace. It is possible to add a 3rd one (and perhaps a 4th, a 5th etc.) on the assumption everyone will have its own graphics stored on own .dat file? I asked because I didn't find any clear dungeon or palace reference in the .plv levels inspected with my hex editor nor in the aforementioned docs.
The .DAT filenames are hardcoded in PRINCE.EXE. The game keeps track of which level is associated with which environment using a specific byte array (tbl_level_type in SDLPoP).
Support for more environments could be added to SDLPoP (E.g. we could add an option to use a different .DAT filename for specific levels, I think? Then, internally the levels are still either "dungeon" or "palace", but the loaded images can be different for each level.)
Doktor Headshot wrote:- Prince animations I. Some "Kid" animations (e.g. running, crouching ecc.) become loopable after specific frame number x and most animations are connected to another ones by specific frame number x that is compatible both with old animation (to allow loop) and new animation (to allow smooth transition if player performs an action that requires the Prince to play a different animation). Is there any specific documentation or topic with a detailed list for these "special" frames and their effects (loop or inter-connect animations)? I asked because I would like to customize main character whose sprites are already made for every animations but they are not smooth and look choppy when looping or switching because I cannot identify those aforementioned "special" frames.
- Prince animations II. Some "Kid" animations make Prince move or "shake" whilst animation is playing (e.g. you press down for crouching, you release down button, Prince stands up and get moved a bit forward; you drink potion and you see Prince "shaking" a bit etc.). Where can I edit these properties of animations? I specifically would like the Prince not to move forward when jumping up or crouching and I would like to disable "crouch bouncing forward".
- Prince animations III. It is possible to implement a "turn crouching" animation on the assumption I already have frames? If yes, how?
PoP1 makes use of a sequence table (see here and here) - basically, this is a fixed series of instructions that defines the basic aspects of the movement sequences. It describes what the next frame should be, and in addition (importantly!) X and Y movement offsets are often inserted as well (these instructions update the position of the kid, and they also cancel out a lot of the "choppiness"!)
In principle you can just modify the SDLPoP sequence table as you want, or add new sequences at the end, recompile and run. Or you could even use a hex editor to directly modify the (hardcoded) table in PRINCE.EXE. Some things to watch out for:
- Be careful about "inserting" or "deleting" instructions from the sequence table, because PoP1 expects the start of all of the the sequences to be located at a fixed number of bytes from the start. Easiest to do is simply replacing instruction bytes with different instruction bytes, without changing the total length of the sequence table.
- If you add a new sequence, you will still need a way to trigger it... (you could either delve into the source code and add at the appropriate place some code to jump to the start of your new sequence, OR use a jump instruction within the sequence table itself)

So yes it is all possible :)

Doktor Headshot
Scholar Scribe
Scholar Scribe
Posts: 4
Joined: May 10th, 2016, 10:49 pm

Re: POP1 modding limits

Post by Doktor Headshot » May 16th, 2016, 10:18 pm

Wow! Back at home and here are a lot of replies! I am going to reply you all one by one.

@Norbert
Thanks, Norbert I will look further into that executable created by David and into other mentioned SDLPoP and MININIM game ports. Unfortunately, I am not skilled programmer but I have got some experience by modding and hex-editing other PC games. However, full accessibility of SDLPoP and MININIM is undoubtely better and more editing-friendly than old DOS-Prince. Still... DOS-Prince is always DOS-Prince but, now, I am not able to decide which Prince engine fits my editing needs better because I actually am into stage of sprites creation and implementation.

@Oitofelix
Hello, I would like to thank you for your concerning to this post and to the introductory one. Speaking about Prince animations, I'm afraid I didn't phrased good that period and my words were unclear so they have been misunderstood by you (my fault as English is not my native language): I do actually have a whole new main character with all animations ready and "over-placed" above the old ones but motion and interpolation between a new animation and another is not that smooth as I wish because of those X and Y offset thing. Indeed, original animations are very smooth and realistic because of the rotoscope technique. Speaking about MININIM, it seems to be very versatile and promising and I'm looking forward to try that Guile scripting when it will be ready.

@Falcury
Hello Falcury, glad to get help from you too. I didn't have fully studied those sequence tables yet because of late time in Italy but they seem very helpful as well as other suggestions which, by the way, sound very encouraging about overcoming any modding limit.

I will take my time to study that material you all kindly provided to me. My project may hav<e some slowdowns because I am at beginning of Pop 1 modding and because of real-life business which leaves me limited time for modding (which, theoretically, would need infinite time as there always is something new to discover). In the mean time, thank you all for your support!

User avatar
oitofelix
Wise Scribe
Wise Scribe
Posts: 202
Joined: February 17th, 2016, 1:59 pm
Contact:

Re: POP1 modding limits

Post by oitofelix » May 17th, 2016, 12:12 am

Doktor Headshot wrote:@Oitofelix
Indeed, original animations are very smooth and realistic because of the rotoscope technique.
Although the frames per se are good, the transition offsets are not optimal in the original game. MININIM has smoother animations.

Code: Select all

 88888  FFFFF Bruno Félix Rezende Ribeiro (oitofelix) [0x28D618AF]
 8   8  F     http://oitofelix.freeshell.org/mininim/
 88888  FFFF  mailto:oitofelix@gnu.org
 8   8  F     irc://chat.freenode.org/oitofelix
 88888  F     Please, support my work: http://oitofelix.freeshell.org/funding.html

Post Reply