Documentation (Prince of Persia 1 Special Events)

Are you creating new levels/mods for DOS or did you finish your work? Tell us here!

Moderator: English Moderator Team

salvadorc17
Calif
Calif
Posts: 496
Joined: August 27th, 2011, 2:04 am

Re: Documentation (Prince of Persia 1 Special Events)

Postby salvadorc17 » June 13th, 2014, 9:37 pm

What tool application are you using for showing this special events, also you can made new ones???

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

Re: Documentation (Prince of Persia 1 Special Events)

Postby Norbert » June 13th, 2014, 11:24 pm

David wrote:1. The change happens in the room where the mirror appears. This is room 4 by default, but your button is in room 7.


My bad. What happened is this: I did use room 4 when I noticed it didn't work as expected. However, I had already touched other events in the process, so I recreated the rooms in another LEVELS.DAT and when I saw "4" of "level 4" I thought I was once again using the correct room.

David wrote:It's because the bottom five bits of the corresponding byte of "door II" (sSecondDoorEvents) should be zero.


Thanks for figuring that out. To be honest I'll have to look at the code to understand exactly what is going on.

David wrote:That is, you should prepare event 44, not 43.


I will add a note about that in the next version of this PoP1 Special Events document.

David wrote:(By the way, did you get the idea from level 3 of my mod? :) )


No, I was actually trying something quite different but noticed that the 'button change' wasn't working as expected, so I created this simplified sample level that could be used to easily reproduce the problem I was running into.

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

Re: Documentation (Prince of Persia 1 Special Events)

Postby Norbert » June 14th, 2014, 12:08 am

salvadorc17 wrote:What tool application are you using for showing this special events, [...]


Special events can be observed in-game (while playing), get discovered by accident/chance, people use reverse engineering, disassemblers, hex editors, look at Mechner's source code, use debuggers, stepping, read assembly, and so on. Some of it is extremely technical and is almost magic to mere mortals.

salvadorc17 wrote:[...] also you can made new ones???


The short answer to that would be: yes. The longer answer is that, while possible, changing them (with CusPop or some of the tools mentioned above) is easier than making new ones. Showing/discovering events can be tricky; making new ones... better to just recreate PoP from scratch and then add whatever you'd want to that new code. In practice, only adding certain things would be doable and all of it is lots of work.

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

Re: Documentation (Prince of Persia 1 Special Events)

Postby Norbert » August 9th, 2014, 5:34 pm

Norbert wrote:
David wrote:It's because the bottom five bits of the corresponding byte of "door II" (sSecondDoorEvents) should be zero.


Thanks for figuring that out. To be honest I'll have to look at the code to understand exactly what is going on.


Oh, I sort of forgot about this.
David, if I add, in "void EventRoom (int iRoom)", under "sBinarySDoors[2] = sTempBinary[5];", the following...

Code: Select all

sBinarySDoors[3] = '0';
sBinarySDoors[4] = '0';
sBinarySDoors[5] = '0';
sBinarySDoors[6] = '0';
sBinarySDoors[7] = '0';

...that'll fix it, correct?

I've added fullscreen support to apoplexy, in addition to the existing zoom functionality, so I may as well fix this event issue before releasing a next version. ;)

David
The Prince of Persia
The Prince of Persia
Posts: 1399
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Documentation (Prince of Persia 1 Special Events)

Postby David » August 10th, 2014, 9:35 am

...that'll fix it, correct?

I tried it, and that fixes it. (When I set the room of the event.)
(By the way, I see it's already done in LoadXML().)
However...
Without the fix, the event works only if the kid is standing on the button when the change happens.
With the fix, the event works only if the kid is *not* standing on the button when the change happens.

I attached a zip with two levels.dat files. "with_ones" and "with_zeroes" refer to the contents of those 5 bits.
(Problems 1. and 3. are fixed in both.)

Something related that I wanted to know: Why do you use int<->binary conversion instead of bit operations? Do you find them easier to understand?
And some less related... Why do you write "+ 2" in array declarations? Why is WriteCharByChar needed? (Perhaps these should be answered elsewhere.)
Attachments
event_43.zip
(17.18 KiB) Downloaded 18 times

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

Re: Documentation (Prince of Persia 1 Special Events)

Postby Norbert » August 10th, 2014, 11:32 am

David wrote:Do you find them easier to understand?


I do. :)

David wrote:Why do you write "+ 2" in array declarations?


It's just an old habit. A long time ago I decided to pick char[] over char*+malloc() wherever possible, for various (subjective) reasons. I subsequently ran into array overflows on a number of occasions, because: a. array index numbers start at zero while humans start counting from one, and b. sometimes explicit null character termination is essential. So, I decided: you know what, I'll just always add +2 and never run into overflow problems again. It worked! :lol:

David
The Prince of Persia
The Prince of Persia
Posts: 1399
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Documentation (Prince of Persia 1 Special Events)

Postby David » August 28th, 2014, 3:57 pm

I think I found something that is not yet documented:
When the player completes level 12 and level 13 starts:
- the kid's HP is not restored to full,
- the level number and remaining time are not shown.
Note that this happens only with the completion by the special event, and not in any of these cases:
- when exiting level 12 with shift-L,
- when completing level 12 by entering an exit door,
- when you restart level 13,
- when you load level 13 from a saved game.

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

Re: Documentation (Prince of Persia 1 Special Events)

Postby Norbert » November 6th, 2014, 9:44 pm

Another addition (mentioned by xhul): in level 12a, when the prince enters room 15 from the right and there is no sword on the second tile from the top left, his health gets fully regenerated.

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

Re: Documentation (Prince of Persia 1 Special Events)

Postby Norbert » August 7th, 2015, 1:34 pm

David wrote:* I remember there was a bug about dying on level 14, but I can't reproduce it.


I know how to reproduce it and I also more or less know what is happening.
Here are the basics:

- Die (e.g. spike).
- Press Enter or Ctrl+a (both work).
- Wait (or do stuff) for ~18 seconds: "Press Button to Continue" will appear.
- Wait (or do stuff) for ~5 more seconds: the game restarts.

What is happening is that the death/restart-timeout countdown is not stopped when restarting. In the original game, the prince cannot die in the princess level. If you wait ~10 seconds while dead and then restart the level (Enter or Ctrl+a), the time you need to wait before the "Press Button to Continue" message appears is (~18 minus ~10 =) ~8 seconds. Most keys, including Space, Shift and arrow keys, do not stop the countdown. Some do, including -, + and Ctrl+j.

Norbert wrote:I will add a note about that in the next version of this PoP1 Special Events document.


I have updated the document to both fix it and complement it with all the things mentioned after the 2013 version was published.
New download links are in the first post of this thread. Also, here is a direct link to the new PDF.

David
The Prince of Persia
The Prince of Persia
Posts: 1399
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Documentation (Prince of Persia 1 Special Events)

Postby David » August 7th, 2015, 7:28 pm

I already posted about this in May: viewtopic.php?p=16408#p16408 (the second half of the post)

Norbert wrote:What is happening is that the death/restart-timeout countdown is not stopped when restarting.

On other levels it is stopped by showing the level number.

Norbert wrote:Some do, including -, + and Ctrl+j.

Because they display some text in the status line.

Norbert wrote:In the original game, the prince cannot die in the princess level.

That's why this bug was not discovered by the authors/testers.

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

Re: Documentation (Prince of Persia 1 Special Events)

Postby Norbert » August 7th, 2015, 8:10 pm

David wrote:I already posted about this in May: viewtopic.php?p=16408#p16408 (the second half of the post)


Oh, I missed that, apparently.
Anyway, now there's a link from here to there, so some good came from it after all. ;)

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

Re: Documentation (Prince of Persia 1 Special Events)

Postby Norbert » August 21st, 2016, 11:14 pm

Attached are two simple puzzles, based on a single concept.
Both in level 13 (12b).

Spoiler: show
The solution has to do with what David wrote here (emphasis mine):

This:
David wrote:After Jaffar died, entering any room from the right will trigger the top left tile of room 24. On the original level, this opens the exit door.
Interestingly, if the tile is not a button, but its modifier refers to a door event that triggers a level door, then the level door will open.


...combined with...

This:
David wrote:One more thing: the game doesn't check whether the 2nd tile is a gate, so for example you may place a tile that already has the required modifier (80=0x50 or above), or a tile that animates itself (e.g. sword - this will make the shadow start at random times).




The video above also shows level 13 (12b).
The left room is #24.
In both rooms, all tiles in the middle row are loose tiles.
Events 1-20 each point to the loose tile that matches their number.
(For example, event 2 points to the 2nd loose tile in room 24.)

The video shows only a bunch of tiles falling.
It actually takes many minutes for all loose tiles to fall down, because of the random nature of the events triggering.
Attachments
example2.zip
example 1
(337.09 KiB) Downloaded 12 times
example1.zip
example 2
(337.12 KiB) Downloaded 13 times

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

Re: Documentation (Prince of Persia 1 Special Events)

Postby Norbert » January 8th, 2017, 6:00 pm

How could I best explain what's mentioned at the bottom of page 21 of this PDF?

SuavePrince noticed peculiar behavior of a mod and I tried to explain it as pasted below.
But he has difficulty understanding what I wrote.

- - - - - - - - - - - - - - - - - - - -
After Jaffar died, the first time you enter a room from the right, the top-left in room 24 is triggered.

That tile at the top-left in room 24 doesn't have to be a raise button.

If it is not a raise button, then it will still trigger an event.

The event it triggers is: modifier+1.

1. Click the tile in the top-left in room 24.
2. Go to the custom tiles screen (button with gear icon).
3. Look at the modifier number.
4. Modifier number + 1 = event that triggers

For your mod, after killing Jaffar if you enter a room from the right, event 3 is triggered.

Because the top-left in room 24 has a modifier with 2.
And 2+1=3. :)

If you make the top-left in room 24 a custom tile with modifier 10, then event 10+1=11 will trigger.
- - - - - - - - - - - - - - - - - - - -

User avatar
SuavePrince
Calif
Calif
Posts: 633
Joined: January 26th, 2015, 6:21 pm

Re: Documentation (Prince of Persia 1 Special Events)

Postby SuavePrince » January 8th, 2017, 6:24 pm

Norbert wrote:How could I best explain what's mentioned at the bottom of page 21 of this PDF?

SuavePrince noticed peculiar behavior of a mod and I tried to explain it as pasted below.
But he has difficulty understanding what I wrote.


- - - - - - - - - - - - - - - - - - - -

I undersatnd(i guess so)You can (or other guy)enable this event in my level dat?but remmber,dont add raise or drop in room 24..thanxs,Maybe David can help me :oops:

David
The Prince of Persia
The Prince of Persia
Posts: 1399
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Documentation (Prince of Persia 1 Special Events)

Postby David » January 14th, 2017, 8:49 pm

Norbert wrote:SuavePrince noticed peculiar behavior of a mod and I tried to explain it as pasted below.

Which mod, and what behavior?

SuavePrince wrote:You can (or other guy)enable this event in my level dat?

You don't need to enable it, it's already enabled.

SuavePrince wrote:but remmber,dont add raise or drop in room 24..

I don't understand this...


Return to “New Levels and Mods For DOS”

Who is online

Users browsing this forum: No registered users and 1 guest