Source code of Pr12 available?

Second part of the best game ever made.
Post Reply
User avatar
starwindz
Sultan
Sultan
Posts: 133
Joined: March 8th, 2009, 4:48 pm

Source code of Pr12 available?

Post by starwindz »

@David
Could you please share the source code of Pr12(Prince of Persia 1-2 Level Converter)? I would like to use this software in order to get ideas for making the random level generator of PoP2.
Attachments
pr12.png
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Source code of Pr12 available?

Post by Norbert »

starwindz wrote:source code of Pr12(Prince of Persia 1-2 Level Converter)?
Should be included in the ZIP package here (and here).
User avatar
starwindz
Sultan
Sultan
Posts: 133
Joined: March 8th, 2009, 4:48 pm

Re: Source code of Pr12 available?

Post by starwindz »

Norbert wrote:
starwindz wrote:source code of Pr12(Prince of Persia 1-2 Level Converter)?
Should be included in the ZIP package here (and here).
Thank you so much. I had old zip file which does not have source code.

By the way, do you know the meaning of 'GAME PLAY' checkbox in this program window?
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Source code of Pr12 available?

Post by Norbert »

starwindz wrote:By the way, do you know the meaning of 'GAME PLAY' checkbox in this program window?
Yes, PoP2 for DOS has regular levels 1-14, but also alternative levels that were probably used for demonstrations (and/or testing).
To start the alternative level 9, you'd use: PRINCE.EXE gameplay yippeeyahoo level9
In apoplexy, the alternative levels are accessible as 15-28.
And RoomShaker II has a checkbox "Use "GamePlay" Level: [X]".
User avatar
starwindz
Sultan
Sultan
Posts: 133
Joined: March 8th, 2009, 4:48 pm

Re: Source code of Pr12 available?

Post by starwindz »

Norbert wrote:
starwindz wrote:By the way, do you know the meaning of 'GAME PLAY' checkbox in this program window?
Yes, PoP2 for DOS has regular levels 1-14, but also alternative levels that were probably used for demonstrations (and/or testing).
To start the alternative level 9, you'd use: PRINCE.EXE gameplay yippeeyahoo level9
In apoplexy, the alternative levels are accessible as 15-28.
And RoomShaker II has a checkbox "Use "GamePlay" Level: [X]".
I have one more question.
If you know the PoP1-2 level(tile) converting rule of Pr12 and let me know it? I have examined the source code but I could not get the converting rule since I could not fully understand the level format of Pop2 yet. (Maybe David can answer it...)
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Source code of Pr12 available?

Post by Norbert »

starwindz wrote:If you know the PoP1-2 level(tile) converting rule of Pr12 and let me know it?
It's in the TForm1::convert() function. For the tiles, if PoP1 has, for instance, 30 ("case 0x1E"), which is a floor with a broken tile on it and a torch, then he converts it to 32 ("ti=0x20") for PoP2. Another example is that, in PoP2, closed and open gates are tile 4 with respectively modifier 0 and 200, so when PoP1 has a gate ("case 4:") its modifier 1 needs to become 200 ("m1=((m==1)?200:0);"). And then there are the guards and room links and such. Most of it is straightforward if you know the file formats. The program is still basic; it changes various tiles that do have more specific equivalents in PoP2 to floors and spaces, plus it mostly ignores environment-specific things. The code is sparse on comments, uses variable names of just 1 or 2 characters, barely has any newlines and spaces. But the basic functionality is there. If you'd study the file formats document I linked above, and check apoplexy's LoadPLV() function, then you should be able to understand what Pr12Conv does.
User avatar
starwindz
Sultan
Sultan
Posts: 133
Joined: March 8th, 2009, 4:48 pm

Re: Source code of Pr12 available?

Post by starwindz »

Norbert wrote:
starwindz wrote:If you know the PoP1-2 level(tile) converting rule of Pr12 and let me know it?
It's in the TForm1::convert() function. For the tiles, if PoP1 has, for instance, 30 ("case 0x1E"), which is a floor with a broken tile on it and a torch, then he converts it to 32 ("ti=0x20") for PoP2. Another example is that, in PoP2, closed and open gates are tile 4 with respectively modifier 0 and 200, so when PoP1 has a gate ("case 4:") its modifier 1 needs to become 200 ("m1=((m==1)?200:0);"). And then there are the guards and room links and such. Most of it is straightforward if you know the file formats. The program is still basic; it changes various tiles that do have more specific equivalents in PoP2 to floors and spaces, plus it mostly ignores environment-specific things. The code is sparse on comments, uses variable names of just 1 or 2 characters, barely has any newlines and spaces. But the basic functionality is there. If you'd study the file formats document I linked above, and check apoplexy's LoadPLV() function, then you should be able to understand what Pr12Conv does.
Thank you so much. It is very helpful for my project. By the way I have another questions for PoP2.

1. Attached prince.dat has converterd regular(not alternative) levelsets(PoP1 to PoP2) using Pr12 utility. However after 14th level completed, the game has been crashed and back to DOS prompt not showing ending cutscene. What is the cause of this problem and how to solve this issue?

2. Attached prince.dat cannot be loaded properly in Apoplexy. I have overwrited prince.dat to Apoplexy related folder (apoplexy-3.0\prince2), and then Apoplexy started. But Apoplexy shows only original levelset(all regular and alternative levels).

3. It seems that Roomshaker 2 does not support 'Play specific level', always start at first level 1. Do you have same probem?
Attachments
PRINCE.DAT
(379.07 KiB) Downloaded 103 times
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Source code of Pr12 available?

Post by Norbert »

starwindz wrote:However after 14th level completed, the game has been crashed and back to DOS prompt not showing ending cutscene.
That's probably because PoP2 is won by killing the false prince with a fire ball, not by entering a level door.
starwindz wrote:2. Attached prince.dat cannot be loaded properly in Apoplexy.
That's because apoplexy's editing for PoP2 cannot change environments and has no EXE screen.
I have no plans to implement these either.
starwindz wrote:But Apoplexy shows only original levelset(all regular and alternative levels).
No, it does show the converted levels, just not in the proper environments.
If you look at, for example, level 3, you will recognize PoP1's level 3.
starwindz wrote:3. It seems that Roomshaker 2 does not support 'Play specific level', always start at first level 1.
Maybe Alt+l allows you to load the active level?
I'm not sure about this, I don't know much about RoomShaker II.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Source code of Pr12 available?

Post by David »

starwindz wrote:3. It seems that Roomshaker 2 does not support 'Play specific level', always start at first level 1.
The official RS2 help says:
Note: Once PoP2 opens, the level can be opened by pressing Ctrl+L to open the “Load Game” menu, Selet the first item (named “RS2 - Level xx” where xx is the level number of the currently open level in RoomShaker II)
It should say Alt+L, though.
starwindz wrote: 1. Attached prince.dat has converterd regular(not alternative) levelsets(PoP1 to PoP2) using Pr12 utility.
Not exactly: Level 1 looks like the level from the PoP Special Edition Flash game.
Or rather, its conversion to PoP1 DOS.
Did you (accidentally) use its LEVELS.DAT?
Post Reply