Guide to Prince of Persia tricks (Large Topic)

Discuss PoP1 for DOS here.
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: Guide to Prince of Persia tricks (Large Topic)

Post by atrueprincefanfrom18 »

Norbert wrote: April 1st, 2021, 8:45 am David could likely tell you the technical details.
I was interested too! But I don't think the width is the difference. If the width is the reason, there can be many more tricks.
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Guide to Prince of Persia tricks (Large Topic)

Post by Norbert »

atrueprincefanfrom18 wrote: April 1st, 2021, 9:11 amBut I don't think the width is the difference.
I'm pretty much 100% sure it is.
Changing the image dimensions has all kinds of unexpected consequences.
I ran into the same issue when I created the somersault animations.
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: Guide to Prince of Persia tricks (Large Topic)

Post by atrueprincefanfrom18 »

Norbert wrote: April 1st, 2021, 10:25 am
atrueprincefanfrom18 wrote: April 1st, 2021, 9:11 amBut I don't think the width is the difference.
I'm pretty much 100% sure it is.
Changing the image dimensions has all kinds of unexpected consequences.
I ran into the same issue when I created the somersault animations.
Nice animations! Interesting, let's wait for David's technical explanation...
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
eien86
Sheikh
Sheikh
Posts: 23
Joined: March 25th, 2021, 5:44 pm

Re: Guide to Prince of Persia tricks (Large Topic)

Post by eien86 »

YURA wrote: April 1st, 2021, 7:27 am Norbert! A question for you or someone else can answer, why does trick 83 only work with a raincoat, and without a raincoat you can't repeat it?
This can be replicated on vanilla Level 9, but you can only reach the correct position if you came from the left (which defeats the purpose).



By normal means you can at most end up ONE pixel too far (which explains why caped prince can do this via it's 1-extra pixel cape). It'd be phenomenal if someone found a way to get one pixel closer, but I think crem's tool would've found that already if possible.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Guide to Prince of Persia tricks (Large Topic)

Post by David »

Norbert wrote: April 1st, 2021, 8:45 am
YURA wrote: April 1st, 2021, 7:27 am[...], why does trick 83 only work with a raincoat, and without a raincoat you can't repeat it?
I think it's because the caped prince (by Veke) is actually a wider image.
See the attached comparison.
David could likely tell you the technical details.
The first part: Why is the prince pushed through the gate?

It happens in check_gate_push(): https://github.com/NagyD/SDLPoP/blob/78 ... 004.c#L504

I added this debug printout before changing Char.x:

Code: Select all

			printf("check_gate_push: var_4 = %d, tile_col = %d\n", var_4, tile_col);
When the caped prince is pushed through a gate, this is the output:
(I tried this on level 9, in room 16.)

Code: Select all

check_gate_push: var_4 = 0, tile_col = 9
As the comment says: "// push Kid left if var_4 <= tile_col, gate at char's tile"
0 ≤ 9, but 0 is meant in the current room, while 9 is meant in the room to the left.
The problem is (again) that the two column indices are meant in different rooms, and thus they cannot be compared properly.

This is why trick 83 works only if the gate is on the edge between two rooms.
If the gate is anywhere else, the prince is pushed to the right.

Another consequence of this bug can be seen even with the original KID.DAT:
Suppose there is a closing gate on the edge between two rooms, and the prince it crouching near it.
If the gate touches him, he will always be pushed to the left.
You can try this with the first gate of the original level 4:
gate_pushing_prince.p1r
(4.02 KiB) Downloaded 127 times

The second part: Why does this depend on the width of the image?

The width of the prince's image is used in set_char_collision(): https://github.com/NagyD/SDLPoP/blob/78 ... 006.c#L942
Here, the variables char_x_left_coll and char_x_right_coll are set to the coordinates of left and right edges of the prince's sprite.
Then they are used in get_row_collision_data(): https://github.com/NagyD/SDLPoP/blob/78 ... 004.c#L125

I added this debug printout:

Code: Select all

		printf("column = %d, right_wall_xpos = %d, char_x_left_coll = %d\n", column, right_wall_xpos, char_x_left_coll);
Output with the original prince:

Code: Select all

column = -1, right_wall_xpos = 64, char_x_left_coll = 64
Output with the caped prince:

Code: Select all

column = -1, right_wall_xpos = 64, char_x_left_coll = 63
In the latter case, right_wall_xpos > char_x_left_coll will become true, and thus the prince is considered to be colliding with the gate.
The consequences of this can be seen in the first part above.
User avatar
dmitrys
Developer
Developer
Posts: 195
Joined: October 1st, 2020, 6:05 am

Re: Guide to Prince of Persia tricks (Large Topic)

Post by dmitrys »

It seems to be caused by the same issue that I have fixed with guards flying into the other room when hitting a closed gate off-screen. The "tile_col" variable is getting calculated for the room on the left. Its value is used to shift kid in a different room on the right.

It can be easily tested by using "[", "]" keys in debug cheat mode. Kid slides rights through a gate on the very left of a room (col 9 of the room on the left) when his back is turned towards the gate. The bug technically works with the default sprite as well but it might be impossible to position kid "correctly" using arrow keys in the game because it is not as wide.

The same fix would work. But you only need the second part of the if statement where the "curr_room" is on the left of "Char.room" because gates on the right side of the room are located in the same room. The first part of the if statement would make things worse when kid is collided with the gate on the right of the room but is already in the next room behind the gate.
https://github.com/NagyD/SDLPoP/blob/78 ... 002.c#L922

Edit: there is also need to be a x-coordinate check to ensure kid does not get bumped back from the next room. Here is the code that seems to work in the "check_gate_push" before setting "Char.x" to push kid into the correct direction and going through the gate backwards.

Code: Select all

if (curr_room == level.roomlinks[Char.room - 1].left && tile_col == 9) {
	left_x = 60;
	if (Char.direction == dir_0_right) {
		left_x += 6;
	}
	if (Char.x > left_x) {
		tile_col -= 10;
	}
}
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Guide to Prince of Persia tricks (Large Topic)

Post by David »

User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: Guide to Prince of Persia tricks (Large Topic)

Post by atrueprincefanfrom18 »

I found another trick! Check the p1r file. If you go through the chomper and the gate similar to Trick 37, if you are at a specific pixel with respect to the gate, you can press right and hit the gate and the gate will push you and you can fall down in a proper way to be then able to go through the wall. Cool trick! :)

replay.zip
(1.59 KiB) Downloaded 128 times
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Guide to Prince of Persia tricks (Large Topic)

Post by Norbert »

atrueprincefanfrom18 wrote: April 18th, 2021, 6:39 am I found another trick! Check the p1r file. If you go through the chomper and the gate similar to Trick 37, if you are at a specific pixel with respect to the gate, you can press right and hit the gate and the gate will push you and you can fall down in a proper way to be then able to go through the wall. Cool trick! :)


replay.zip
Is it okay if I add to 37: "The trick can be expanded to subsequently go through the lower-floor wall, as demonstrated here." ?
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: Guide to Prince of Persia tricks (Large Topic)

Post by atrueprincefanfrom18 »

Norbert wrote: April 18th, 2021, 4:12 pm Is it okay if I add to 37?
Well, maybe not. Since players might be searching for tricks to go through wall, this might not show up or may be shown wrongly. Better a new trick I would suggest. But again, upto you.
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: Guide to Prince of Persia tricks (Large Topic)

Post by atrueprincefanfrom18 »

Norbert wrote: November 5th, 2014, 9:37 pm There are still two tricks that I don't know how to do:
- http://www.youtube.com/watch?v=asNckj9O53M#t=119
- http://www.youtube.com/watch?v=-4_K4vbCwkY
I think the first one is very difficult. The second one is easy, but someone who can do it will need to describe in words what to do after sliding forward...
I'm quite late, but it seems you still didn't figure out how to perform the first trick?

Here's the video:


Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: Guide to Prince of Persia tricks (Large Topic)

Post by atrueprincefanfrom18 »

Found another one:

forward_without_close_butto.p1r
(3.22 KiB) Downloaded 124 times
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
NITM-T
Sultan
Sultan
Posts: 182
Joined: July 29th, 2017, 12:10 am

Re: Guide to Prince of Persia tricks (Large Topic)

Post by NITM-T »

Sup, guys! I like to talk about trick 164.
I didn't answer on SNES thread 'cause I thought I'd see the real trick for that one once Norbert led KneeTie to the modder. So, thanks to atrueprincefanfrom18, there's a trick now which, I didn't do it, hahaha. I mean, maybe I'm doing wrong, but, I think DOS's chomper is slower than SNES n' I think the Prince there goes further left than on SNES. Or is just, I'm getting the wrong timing.

So, the 1st is what's happening n' the other 2, are to show how I knocked down that loose:

Image

Image

Image

The 3 of them starts at the same way. The 2nd, is the same trick I use to skip crushers. Or course, crushers are slow. So, you need to do that once. But chompers n' guillotine are faster then, you need to get the right time for that.
Some time later doing my mods, I learned an easier way by getting the frame with Select. It's what you see in the 3rd.

Anyway, I just wanted to share that. We know both versions has differents ways to do tricks n' even, exclusive ones for each. I'll stick with the 3rd one :P
May the Moon light your path.
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: Guide to Prince of Persia tricks (Large Topic)

Post by atrueprincefanfrom18 »

Yeah, I think SNES chompers are not the same as DOS ones, but good thing is the trick is possible in SNES. Maybe Norbert can append this to the trick video or simply create another trick. There's definitely gonna be one person who would try to perform same actions and would give up at the end. No wonder this trick is superb and difficult ;)

Edit: 1st one is actually bad because the Prince is aligned a bit right and the game thinks chomper can cut him. On DOS the Prince is a bit to the left and the game doesn't think the chomper can cut him, so he survives.
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Guide to Prince of Persia tricks (Large Topic)

Post by Norbert »

atrueprincefanfrom18 wrote: May 4th, 2021, 8:58 am[...] or simply create another trick.
Agreed, and done.

Thanks for the useful information, NITM-T.
I've added a link to your forum post under the new trick at PoPOT.
Post Reply