About the parrying skills of guards

Discuss PoP1 for DOS here.
Post Reply
Falcury
Calif
Calif
Posts: 565
Joined: June 25th, 2009, 10:01 pm

About the parrying skills of guards

Post by Falcury »

You know how guards will always be hit if you block their attack, then strike immediately after waiting just a fraction of a second?
Or, similarly, how guards will never defend themselves if you keep hitting them in quick succession?

It looks like this is because of this code in parry():

Code: Select all

seg005:0EA5 81 7E FE 98 00                       cmp     [bp+opp_frame], 152
seg005:0EAA 75 25                                jnz     short return
C code (SDLPoP):

Code: Select all

if (opp_frame != frame_152_strike_2) return;
If this code is removed, guards suddenly become a lot more challenging!

Essentially, guards can only execute the parry maneuver while the kid's animation is on one specific frame (152); however, under some circumstances the animation will already be at frame 153, so the parry gets canceled and the guard never stands a chance...

All of this is independent of the "guard skill" (all guards are tragically handicapped like this...)

I tried to create an assembly hack using CusAsm, however I don't really understand Turbo Assembler yet...
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: About the parrying skills of guards

Post by Norbert »

I'm guessing this requires a guard with a "Re-striking After Block Prob." and/or "Blocking Strike Prob." that's higher than 0?
Because I quickly tried this with the first guard in level 2, and there's no noticeable difference.
[Edit: Changed him to 9, but still no noticeable difference. I can push him into a wall and even if I give him 20+ hitpoints I can just "keep hitting them in quick succession".]
Falcury
Calif
Calif
Posts: 565
Joined: June 25th, 2009, 10:01 pm

Re: About the parrying skills of guards

Post by Falcury »

Norbert wrote:I'm guessing this requires a guard with a "Re-striking After Block Prob." and/or "Blocking Strike Prob." that's higher than 0?
Because I quickly tried this with the first guard in level 2, and there's no noticeable difference.
[Edit: Changed him to 9, but still no noticeable difference. I can push him into a wall and even if I give him 20+ hitpoints I can just "keep hitting them in quick succession".]
Sorry, I should have tested the assembly hack... :? I'll see if I can get it to work. The procedure needs to be prevented from returning immediately if [bp+opp_frame] does not equal 152. Perhaps changing that "jump if not zero" instruction to an unconditional jump (jmp) will do the trick.

Edit: I found a change that works for me:

Code: Select all

Turbo Debugger Log
CPU 80486
0E57:0E9D 837EF600       cmp    word ptr [bp-0A],0000       
0E57:0EA1 75C4           jne    0E67                        
0E57:0EA3 EB15           jmp    0EBA                        
0E57:0EA5 817EFE9800     cmp    word ptr [bp-02],0098       
0E57:0EAA EB0C           jmp    0EBA  ; <--- modified instruction
0E57:0EAC EB0C           jmp    0EBA                        
0E57:0EAE 817EFCA700     cmp    word ptr [bp-04],00A7       
0E57:0EB3 751C           jne    0ED1                        
0E57:0EB5 C746F83D00     mov    word ptr [bp-08],003D       
0E57:0EBA C606224301     mov    byte ptr [4322],01          
0E57:0EBF FF76F8         push   word ptr [bp-08]            
0E57:0EC2 0E             push   cs                          
0E57:0EC3 E844F1         call   000A                        
0E57:0EC6 837EFA00       cmp    word ptr [bp-06],0000  
For testing, the fat guard and Jaffar are good opponents :) The guard in level 8 should be tougher as well. Yeah, the change is most noticeable for guards that already have a high probability of blocking.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: About the parrying skills of guards

Post by Norbert »

Falcury wrote:Sorry, I should have tested the assembly hack... :?
Err, you wrote about the C code that if it's removed the guards behave differently.
That's what I tested and commented on. :)
_Zaphod_
Beylerbey
Beylerbey
Posts: 60
Joined: January 13th, 2006, 12:01 am
Location: USA

Re: About the parrying skills of guards

Post by _Zaphod_ »

I'm beginning to suspect this is intentional.

Main reason is Jafar battle in SNES version (a highly accurate port except for the extensions).

Jafar has 100% strike after parry and parries 100% if you restrike after parry. You cannot EVER counterstrike him. every other enemy in the game will eventually mess up an let your hit get through. Once i got into a counterstrike fight with him for an entire minute! you will not get through his guard that way.

the ONLY way to ever land a hit on him is to delayed strike or anticipate his strike and swing just before he does and hit first.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: About the parrying skills of guards

Post by Norbert »

_Zaphod_ wrote:the ONLY way to ever land a hit on him is to delayed strike or anticipate his strike and swing just before he does and hit first.
Yes, the way I always defeat him is by constantly pressing up to parry (block) and every now and then in between all these parries I attack once.
This way Jaffar can never get a hit in and the attacks are random enough that they occasionally get through to him.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: About the parrying skills of guards

Post by David »

Falcury wrote:

Code: Select all

0E57:0EA5 817EFE9800     cmp    word ptr [bp-02],0098       
0E57:0EAA EB0C           jmp    0EBA  ; <--- modified instruction
0E57:0EAC EB0C           jmp    0EBA                        
JMP-s are relative, so your EB 0C at 0EAA can't be correct... It should be EB 0E.
Or just use 90 90 (2×NOP).

As for the differences: guard fights always seem random to me, so I can't really see any difference... :)
User avatar
Coco
Sultan
Sultan
Posts: 130
Joined: February 1st, 2013, 3:58 pm

Re: About the parrying skills of guards

Post by Coco »

I'm just gonna post here, since it is somewhat similar question. Is there any way to know how many times (maximum) can a guard parry? It would be cool to have an editor that could determine whether the guard will move in a fight, or stand still, parry better (like modification above) or not, and how many times. Heck, maybe even to reprogram it to move backwards under certain conditions, to lure you into counterattack.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: About the parrying skills of guards

Post by Norbert »

Coco wrote: May 6th, 2018, 10:38 pmIs there any way to know how many times (maximum) can a guard parry?
If you use a recent apoplexy, you can press F2 to check/modify guard details via the "Edit guard details" link.
For DOS, guard "a" (10) has both re-strike and block probability 255 (out of 255), so if it blocks this one parries forever.

The same goes for SNES' female, fat, red/blue knight, and Jaffar.
(Also F2 with apoplexy. For Pr1SnesLevEd, use menu Guards -> Settings...)
Coco wrote: May 6th, 2018, 10:38 pmIt would be cool to have an editor that could determine whether the guard will move in a fight, or stand still, [...]
The advance probability for DOS guards 7 (e.g. first guard in level 8) and 8 is 0, so they wait for your attack.
The same goes for SNES' shadow and Kali.
Several others have their advance set to 255 (max).

For settings between min and max it's (also) a probability.
This means that, while there is randomness, the likelihood of occurrence, with enough tests, will eventually be the probability.
(The law of large numbers, or, perhaps more accurately, the central limit theorem.)
Therefore, unless you start combining values, I don't think there's much else to calculate...
dmitry_s
Developer
Developer
Posts: 148
Joined: July 27th, 2021, 7:22 am

Re: About the parrying skills of guards

Post by dmitry_s »

This is an old thread and but I found it useful for the skill 10 guard (Jaffar). One you get into a striking battle with him, it is impossible to strike him. However, he is still susceptible to 2 types of attacks.

1. Just standing still and striking him when he starts to advance
2. Trapping him next to a wall or a gate and striking continuously

When those attacks are applied, skill level 10 suddenly becomes easy.

Randomly parrying all 3 frames (151-153) instead of just 152 makes fighting more challenging and really shows the guard's skill level.
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: About the parrying skills of guards

Post by Norbert »

Also, the guard skills are customizable.
At least through apoplexy ("Edit guard details." after F2) and CusPop (all the "Set up guards" sections).
And SDLPoP picks up on those customizations since version 1.22; also has them in SDLPoP.ini.

I don't think many modders have experimented with this.
Even though it's probably possible to create very distinct guards.
Maybe even one that is immortal because of his epic skills? (I haven't tested...)
dmitry_s
Developer
Developer
Posts: 148
Joined: July 27th, 2021, 7:22 am

Re: About the parrying skills of guards

Post by dmitry_s »

From my limited experimentation, there are some placed in the code that can still allow you to hit a guard while moving back and forth, or switching places even with the skills maxed out.

For example, there is no check for parrying here so sometimes a guard tries to strike instead of defending himself in certain situations.
https://github.com/NagyD/SDLPoP/blob/98 ... 005.c#L975

And as Falcury mentions probabilities will not change the fact that guards can only block 1 out 3 frames which makes them vulnerable to standing still attacks unless you prevent them from attacking like the level 8 guard.
User avatar
VelCheran
Vizier
Vizier
Posts: 127
Joined: May 28th, 2020, 7:26 pm

Re: About the parrying skills of guards

Post by VelCheran »

dmitry_s wrote: September 10th, 2021, 7:34 am This is an old thread and but I found it useful for the skill 10 guard (Jaffar). One you get into a striking battle with him, it is impossible to strike him. However, he is still susceptible to 2 types of attacks.

1. Just standing still and striking him when he starts to advance
2. Trapping him next to a wall or a gate and striking continuously

When those attacks are applied, skill level 10 suddenly becomes easy.

Randomly parrying all 3 frames (151-153) instead of just 152 makes fighting more challenging and really shows the guard's skill level.
Jaffar has skill 9, not 10 (but I guess it depends if you start by 0 or 1 so we're probably talking about the same thing), and I'm able to hit him during a parry/riposte fight. Maybe I misunderstood what you meant?



By the way, there is another trick which works all the time with any kind of guard: parry his strike, wait a little bit and strike back. The time between parry and strike is always the same, after training a bit you'll get it all the time.
dmitry_s
Developer
Developer
Posts: 148
Joined: July 27th, 2021, 7:22 am

Re: About the parrying skills of guards

Post by dmitry_s »

I meant to say Jaffar's (or a guard's) skill needs to be changed from 9 to 10 which is defined with 100% parrying defense for the changes to be effective. Guards with a lesser skill will not benefit too much from this change as they intentionally do not defend a certain percentage of strikes.

Striking after parrying seems to be prevented by the changes. You can notice that Jaffar's blocking motion at the elbow looks slightly different since he is blocking a different strike frame.


This change alone will not make the guard 100% strike proof because there are places in the code where a guard tries to strike and does not call the parry logic. But it covers the obvious weaknesses.
User avatar
VelCheran
Vizier
Vizier
Posts: 127
Joined: May 28th, 2020, 7:26 pm

Re: About the parrying skills of guards

Post by VelCheran »

My bad, I replied to your message without reading the thread from the start :oops:
Post Reply