Documentation (Prince of Persia 1 Guard Types)

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

Moderator: English Moderator Team

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

Documentation (Prince of Persia 1 Guard Types)

Post by Norbert » November 14th, 2012, 12:46 am

I have created a document that describes the skills of guards in PoP1:

2015-08-06_PoP1_Guard_Types.pdf

The source document (.odt; OpenDocument) is also available, here.
Its main page on PoPOT.org is here.
Feedback is welcome. Just post it in this thread or send an e-mail.

[Edit: Updated the links. Several times.]
Last edited by Norbert on November 16th, 2012, 11:39 pm, edited 2 times in total.

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

Re: Documentation (Prince of Persia 1 Guard Types)

Post by Norbert » November 14th, 2012, 1:20 am

In case anyone is wondering where I got all these numbers from: it's from the original Apple II (6502 assembly) source code.
I'm assuming that Lance Groody used the same values, since I don't see a reason why he wouldn't.

Code: Select all

*-------------------------------
*
* Fighter params (indexed by guardprog #)
*
* strikeprob = probability x255 of striking from ready posn
* restrikeprob = prob x 255 of restriking after blocking
* blockprob  = prob x255 of blocking opponent's strike
* advprob = of advancing to within striking range
* refractimer = length of refractory period after being hit
*
*               0   1   2   3   4   5   6   7   8   9   10  11

strikeprob
 db 075,100,075,075,075,050,100,220,000,060,040,060
restrikeprob
 db 000,000,000,005,005,175,020,010,000,255,255,150
blockprob
 db 000,150,150,200,200,255,200,250,000,255,255,255
impblockprob
 db 000,075,075,100,100,145,100,250,000,145,255,175
advprob
 db 255,200,200,200,255,255,200,000,000,255,100,100
refractimer
 db 020,020,020,020,010,010,010,010,000,010,000,000
specialcolor
 db 000,000,000,001,000,001,001,000,000,000,000,001
extrastrength
 db 000,000,000,000,001,000,000,000,000,000,000,000

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

Re: Documentation (Prince of Persia 1 Guard Types)

Post by Norbert » November 14th, 2012, 1:30 pm

Alrighty then, I've updated the links in the first post.
The document now specifies which guard numbers are used by apoplexy and RoomShaker.
It should now be easy to read/use for everyone.

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

Re: Documentation (Prince of Persia 1 Guard Types)

Post by Norbert » November 16th, 2012, 2:58 am

I think I've found both the guard type for the skeleton that comes alive (type 2, in RoomShaker #3) and the shadow that fights the prince (type 3, in RoomShaker #4), by looking through David's disassembly. :)

For the skeleton:
- - - - - - - - - -
mov ax, 58h ; 'X' ; skel wake up
push ax
call seqtbl_offset_char
call play_seq
mov ax, 2Ch ; ','
push ax ; resource
call play_sound
mov guard_skill, 2
mov char_alive, 0FFh
- - - - - - - - - -

For the shadow:
- - - - - - - - - -
do_init_shad proc far ; CODE XREF: check_shadow+4A^Yp
; level12_shadow+24^Yp

seq_index = word ptr 6
source = word ptr 8

push bp
mov bp, sp
mov ax, 7
push ax ; count
push [bp+source] ; source
mov ax, offset char_frame
push ax ; dest
call memcpy
add sp, 6
push [bp+seq_index]
call seqtbl_offset_char
mov char_charid, 1
mov demo_time, 0
mov guard_skill, 3
mov ax, 4
mov guardhp1, ax
mov guardhp2, ax
mov guardhp3, ax
call saveshad
pop bp
retf 4
do_init_shad endp
------

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

Re: Documentation (Prince of Persia 1 Guard Types)

Post by Norbert » November 16th, 2012, 3:12 am

Also found the disassembled DOS code for the probabilities and they are a little different from the original game (h means it's hexadecimal).
Looks like I need to update the document again; will look into it tomorrow.
[Edit: Made the new document and updated the links in the first post.]

Code: Select all

strikeprob  dw    3Dh,   64h,   3Dh,   3Dh,   3Dh,   28h, 64h,  0DCh, 0,   30h,   20h,   30h
          ; DATA XREF: guard_strike+4C^Xr
restrikeprob  dw  0,     0,     0,     5,     5,  0AFh, 10h,   8, 0,  0FFh,  0FFh,   96h
          ; DATA XREF: guard_strike+37^Xr
blockprob dw  0,   96h,   96h,  0C8h,  0C8h,  0FFh,  0C8h,  0FAh, 0,  0FFh,  0FFh,  0FFh
          ; DATA XREF: guard_block+48^Xr
impblockprob  dw  0,   3Dh,   3Dh,   64h,   64h,   91h, 64h,  0FAh, 0,   91h,  0FFh,  0AFh
          ; DATA XREF: guard_block+33^Xr
advprob   dw   0FFh,  0C8h,  0C8h,  0C8h,  0FFh,  0FFh,  0C8h,   0, 0,  0FFh,   64h,   64h
          ; DATA XREF: guard_advance+1D^Xr
refractimer dw    10h,   10h,   10h,   10h,     8,     8,   8,   8, 0,     8,     0,     0
          ; DATA XREF: guard_refra+27^Xr
extrastrength dw 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ; DATA XREF: get_guard_hp+6^Xr

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

Re: Documentation (Prince of Persia 1 Guard Types)

Post by David » December 17th, 2012, 12:34 pm

Some notes:
Why are the last two guard types marked with "Not available in the DOS version"? The DOS version has 12 skills, as it can be seen in the disassembly above. They are not available in RoomShaker or Apoplexy, though.

I have noticed an interesting thing about the differences between the numbers in the Apple II and the DOS versions:
For example, Apple II says that the first "strikeprob" is 075.
Now, if we interpret it as an octal number, it will mean 61 - which matches the DOS number 3Dh!
The other numbers also match:
060 -> 48
050 -> 40
040 -> 32
020 -> 16
010 -> 8

I feel that the author of the DOS version simply copied the db lines into C code, but C interprets a number with a leading zero as octal.
I found a page about this problem here: http://sundry.wikispaces.com/octal-zero-prefix

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

Re: Documentation (Prince of Persia 1 Guard Types)

Post by David » December 24th, 2012, 8:41 pm

I got curious and I went through all versions of PoP1 I know of, and extracted the tables from them.

Amiga, Apple II, Atari ST, C64, DOS 1.1/1.3/1.4, Macintosh, PC98

Code: Select all

 75 100  75  75  75  50 100 220   0  60  40  60 strikeprob
  0   0   0   5   5 175  20  10   0 255 255 150 restrikeprob
  0 150 150 200 200 255 200 250   0 255 255 255 blockprob
  0  75  75 100 100 145 100 250   0 145 255 175 impblockprob
255 200 200 200 255 255 200   0   0 255 100 100 advanceprob
 20  20  20  20  10  10  10  10   0  10   0   0 refractime
  0   0   0   1   0   1   1   0   0   0   0   1 color (only Apple II, Atari ST, C64 and PC98)
  0   0   0   0   1   0   0   0   0   0   0   0 extrastrength (missing in C64 and Macintosh)
(the last two rows are swapped in the PC98 version)
ATM Turbo, DOS 1.0, SEGA CD, Sharp X68000

Code: Select all

 61 100  61  61  61  40 100 220   0  48  32  48 strikeprob
  0   0   0   5   5 175  16   8   0 255 255 150 restrikeprob
  0 150 150 200 200 255 200 250   0 255 255 255 blockprob
  0  61  61 100 100 145 100 250   0 145 255 175 impblockprob
255 200 200 200 255 255 200   0   0 255 100 100 advanceprob
 16  16  16  16   8   8   8   8   0   8   0   0 refractime
  0   0   0   0   1   0   0   0   0   0   0   0 extrastrength
SEGA Genesis

Code: Select all

255 200 200 200 255 255 255 255 advanceprob
 75 100  75  75  75 220  50  60 strikeprob
  0   0   0   5   5  10 175 175 restrikeprob
  0 150 150 200 200 250 255 255 blockprob
  0  75  75 100 100 250 145 145 impblockprob
  2   2   2   2   1   1   1   1 refractime (in different units)
SNES

Code: Select all

Dpu Ske Bsk Gsk Gir Fat Sha Gre Gbl Blu Red Pur Bfa Rkn Bkn Mon Jaf Dead
  0  75  75  75  60  60 220  75 100  75  75  75  50  60  60   0  40   0 200 strikeprob
  0   5   5   5 255 255  10   0   0   0   5   5 175 255 255   0 255   0 200 restrikeprob
  0 200 200 200 255 255 250   0 150 150 200 200 255 255 255   0 255   0 200 blockprob
  0 100 100 100 145 145 250   0  75  75 100 100 145 145 175   0 255   0 200 impblockprob
  0 200 200 200 255 255   0 255 200 200 200 255 255 255 100   0 100   0 200 advanceprob
  0  20  20  20  20  20  20  20  20  20  20  20  20  20  20   0  20   0  20 refractime
  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0 ?
  0 255   1   9   6   8   4   3   4   5   6   7   8  10  12  13  15   0   4 hitpoints
Amstrad CPC, Enterprise 32

Code: Select all

 75 100  75  75  75  50 100 220   0  60  40 strikeprob
  0   0   0   5   5  25  20  10   0  40  40 restrikeprob
  0 150 150 200 200 255 200 250   0 255 255 blockprob
255 200 200 200 255 255 200   0   0 255 100 advanceprob
  4   4   4   4   2   2   2   2   0   2   0 refractime (in different units)
(Similar to Apple II, but: impblockprob is not present, the last guard type is not present)
I couldn't find the table in these versions: ZX spectrum, Game Boy, Game Boy Color, Sega Master System, SAM Coupé, PC Engine, NES

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

Re: Documentation (Prince of Persia 1 Guard Types)

Post by Norbert » December 24th, 2012, 11:21 pm

That must've been quite a bit of work...
I'll add it to the next version of the document, on a second page, will credit you ("David from the Princed Forum").

By the way, David, I'm going off-topic here, but did you ever create a PoP2 level editor?
If so, do you still have the latest package? I always thought RoomShaker II is the only PoP2 editor out there.

User avatar
robert
Sultan
Sultan
Posts: 188
Joined: August 27th, 2011, 7:16 pm
Location: Argentina

Re: Documentation (Prince of Persia 1 Guard Types)

Post by robert » May 14th, 2013, 2:48 am

Nice work! I now understand why level 9 makes the guard do nothing! But one thing I would like to know is how can I make a guard have skill 11 or 12. Roomshaker (the POP level editor I only use) doesn't allow those skills...
Image
This will be my face if you can't win any of my mods

User avatar
yaqxsw
Wizard Scribe
Wizard Scribe
Posts: 703
Joined: June 18th, 2012, 3:35 pm
Location: Germany

Re: Documentation (Prince of Persia 1 Guard Types)

Post by yaqxsw » July 31st, 2013, 5:53 pm

And it is possible to make the guard that he for one blow can kill the prince with 10 HP?

And it is possible to make the guard that had the maximum skills - all 255? its nice to test :D
http://www.popot.org/documentation/docu ... _Types.pdf

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

Re: Documentation (Prince of Persia 1 Guard Types)

Post by Norbert » August 6th, 2015, 10:59 pm

I've updated the document, and I've updated the links in the first post of this thread.

Very minor changes:
- changed the publication date (obviously),
- changed the contents of the last two cells about apoplexy and RoomShaker guard 'numbers', and
- added a clickable URL to David's post above about other PoP versions.

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

Re: Documentation (Prince of Persia 1 Guard Types)

Post by Norbert » November 22nd, 2015, 10:11 pm

Does anyone know what exactly "impblockprob" is? (Pages 20 and 21 of) Mechner's 1989 document doesn't say.
It's some kind of blocking probability. Improper? Imperfect, impaired, maybe even improved?
I can't seem to figure out the difference between 0 and 255 when I combine those with various strike/re-strike/block/advance probabilities.

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

Re: Documentation (Prince of Persia 1 Guard Types)

Post by David » November 28th, 2015, 7:07 pm

Norbert wrote:Does anyone know what exactly "impblockprob" is?
The Apple II source says "impaired": https://github.com/jmechner/Prince-of-P ... UTO.S#L786
It is used (instead of blockprob) if justblocked is true.

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

Re: Documentation (Prince of Persia 1 Guard Types)

Post by Norbert » November 28th, 2015, 8:58 pm

David wrote:The Apple II source says "impaired": https://github.com/jmechner/Prince-of-P ... UTO.S#L786
Hm, okay.
David wrote:It is used (instead of blockprob) if justblocked is true.
It's still difficult for me to truly notice the difference in-game. Supposedly it's about additional blocking, after the first block, right? So, if I set block prob. to 255, then try 0 and 255 as imp. block prob, I should notice a difference after the guard's first block? I don't really see it, to be honest.

User avatar
kj-5349
Vizier
Vizier
Posts: 118
Joined: January 26th, 2010, 11:43 am

Re: Documentation (Prince of Persia 1 Guard Types)

Post by kj-5349 » June 22nd, 2016, 7:51 pm

Hi Norbert, I've recently tried out your apoplexy 3.0 RC2.

Just a small thing to mention:
- Apoplexy type 9 is Roomshaker type 9, not 10. Numbers in the PDF aside, I did recall there is a consistent blocking-attacking chain with the default Jaffar and he rarely improper blocks.
- Apoplexy type 8 (the passive non-attacking guard) is unavailable in Roomshaker, and thus, not 9.
- Apoplexy type b is Roomshaker type 10. Behaviour-wise it is a combination of the Fat Guard & Apoplexy type 6.
- Apoplexy type a is not in Roomshaker. This is the "worst" but most fearsome guard type as he is similar to the SNES Jaffar, and the only way of defeating him is to block, then a short delay and attack (still not sure of the technique's name). Examples I've seen are in robert's The Tricky Tower and princeomkar's Guard Revolt.

Post Reply