Karateka of Persia?

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

Moderator: English Moderator Team

endriuw
Sheikh
Sheikh
Posts: 22
Joined: February 21st, 2017, 5:51 pm

Karateka of Persia?

Post by endriuw » March 15th, 2017, 6:25 pm

Hi guys!

I am Andrea and, since I was born in 1982 I started playing videogames
very early. I think PoP1 is my favorite game, even if compared with
the super realistic games used nowadays....

But before playing PoP1, when I was still 6-8 years old, I was playing
Karateka, another videogame from Mechner you surely know!

I noticed that, even if karateka is way more "primitive" than PoP1,
they have still some similarities, like the way the kid runs, the fact
that if he is hit when he is not in a "combat" position he will die
immediately, ecc.

Do you think the two characters (karateka and prince) have been
represented using similar .DAT files?

If yes, do you think it would be possible to modify the KID.DAT file
by taking the data from Karateka, in order to make the prince look
like karateka? And maybe the enemies as well, and the characters
may be drawn in a way such that instead of using the sword they
just do karate punches or kicks (for example the middle kick in
Karateka is very similar to a sword hit in PoP1!)

What do you think? I tried to play the original Karateka, but now
that I am 34 years old it looks very easy and boring, just some
people to fight and that's all.... but since PoP1 is more exciting,
if we could put the Karateka characters in the PoP1 levels, that
would be wonderful!

What do you think? Do you think it is something possible? Clearly,
since Karateka has no swords, the level 1 probably should have
no enemies so that from level 2, where usually the prince already
has the sword, we could replace the sword hits with karate kicks
or something similar....

What do you think guys?

I attach a YouTube link with a walkthrough for the original
Karateka, as you can see it has many similar things, even the
princess to be saved and the way they hug at the end :)

... and now that I look at it better, as I said the middle kick looks
like a standard sword hit, and the high punch is very similar
to the high sword hit, then we could use the high punch to
stop middle kicks exactly like the high sword hit which is used
to stop the standard sword hit :)

https://www.youtube.com/watch?v=jIT4qEtJlNU

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

Re: Karateka of Persia?

Post by Norbert » March 15th, 2017, 9:02 pm

Your idea, I like it; very interesting.
Especially doing karate kicks instead of attacking with a sword.
Although that would probably also be the most difficult thing to modify.
More difficult than, for instance, changing the scenery to match Karateka.

A problem is that neither SDLPoP nor MININIM allow easy modification of all graphics.
Certainly a lot easier than modifying the original DOS game.
But, if you browse through their images (download their packages, check the data/ directories) you will see that:
- the sword is still separate from the humans,
- the dimensions of images that belong to the same animation aren't static but shrink and grow based on what's required to fit the original prince, [Edit: And even the x/y offset changes for each image.]
- there's no extra, reserved space around images to allow modders to draw outside the original outlines, (e.g. giving the prince a hat means you need to start resizing images because they cut off exactly where his head ends)
- images aren't double sized (for the larger displays nowadays), which means the available drawing room - the number of pixels - remains limited.

endriuw
Sheikh
Sheikh
Posts: 22
Joined: February 21st, 2017, 5:51 pm

Re: Karateka of Persia?

Post by endriuw » March 15th, 2017, 9:18 pm

Hi Norbert,

many thanks for your reply! I am happy that you find this interesting,
and I acknowledge that it may be difficult as you say. The PR program
would be needed to edit the images, right? I tried to use its
import/export functionalities, it looks very interesting.

I think there are two possible approaches to manage doing this...

First approach

One way to do it (but it will require a lot of time!) is to do the
following steps:

1. Downloading (or recording) a video of karateka and getting all the frames
from the video in formats which are compatible with PoP1...

2. Using programs capable to apply the same actions to many images
automatically (for example the Phatch free program) to cut and resize
all the frames in order to try to get all the images of the karateka.

3. Modifying all those files ONE BY ONE to do several things, for example
to add transparency or to decide which prince frame should be replaced
by each karateka frame.

Second approach

Maybe this second approach is simpler, it would consists of the following
steps.

1. Keeping the PoP original images for the kid! Actually the karateka is
substantially identical, it is just like the prince but with a low
quality graphics :)

2. Editing just those pictures in which he attacks with the sword, trying
to trasform them into pictures in which he is kicking.

3. Reusing the images in which the prince does high hits with the sword,
because without the sword they just look like punches! Then if we
just make the sword transparent, maybe we may manage to reduce
the effort of graphics editing ....

What do you think? If it is possible to do it, it would be a great tribute
to both Jordan Mechner's games! :)

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

Re: Karateka of Persia?

Post by Norbert » March 15th, 2017, 9:59 pm

> The PR program would be needed to edit the images, right?

No, you can use SDLPoP (or MININIM) and just edit the images in the data/ directory.
One of several advantages this brings is that there are no (16 color) palette limits.

You will understand the obstacles better if you download SDLPoP and look at the images in, for example, its data/PRINCE/ folder. The sword images are not attached to the humans, the image dimensions are all over the place, and the x/y coordinates where they are displayed in-game also differ constantly.

The fighting prince images and sword images first need to be combined into a single image, with a clearly marked border. (This would not be a square, it would be the rectangle of the prince with attached to it the rectangle of the sword.) Then the karateka needs to be pasted/replicated on this combined image - never outside the marked border, and afterwards the portions that previously had the sword and prince should be split again into their exact dimensions. It is possible to modify the image sizes and such, but then things become even more complicated and take more time.

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

Re: Karateka of Persia?

Post by Norbert » March 17th, 2017, 7:00 pm

I just played Karateka for a while.
What an annoying game...
Made it to that freaking gate twice, and it killed me twice, even though I was inching forward towards it.

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

Re: Karateka of Persia?

Post by Norbert » March 17th, 2017, 8:37 pm

Attached are some of the frames. Just screenshots for now.
Not cut out or transparent yet, nor using the precise colors yet.
running/running.txt explains which frames the game displays.
Attachments
Karateka_frames.zip
(1.28 MiB) Downloaded 10 times

endriuw
Sheikh
Sheikh
Posts: 22
Joined: February 21st, 2017, 5:51 pm

Re: Karateka of Persia?

Post by endriuw » March 17th, 2017, 11:51 pm

Wow Norbert, this is wonderful!! :)

I am so grateful for this starting contribute!

Then now it should be cut and part of the leg should be put in the
sword file, right? I think the middle kick is perfect to replace the
attack with sword, because they look very similar!

To replace the defense with sword, I suggest to use either the high
kick or the high punch or the middle punch... (which have not been
captured for now). To do the high punch you have to press the 'Q'
key, and to do the middle punch you have to press the 'A' key (using
the american keyboard for example). Maybe the high punch or the
middle punch are better, because it would look like you are stopping
the middle kick with your hands :-) Maybe the high punch is better,
because it looks similar to the defence with sword (you move the
sword upwards when you do it).

Regarding the moving, I think that your "moving slow" is very similar
to how the Prince moves when he is fighting, and maybe
"moving fast" cannot be used because there is nothing similar in PoP...

I also liked that you captured the karateka while running!

I think building the "KID.DAT" file will take much time, but it would
be so wonderful, I think even Jordan would like the idea! :)

Again thanks for sending this Norbert!!! :)

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

Re: Karateka of Persia?

Post by Norbert » March 18th, 2017, 12:20 am

Here are the punches.
Again, not cut out or transparent yet, nor using the precise colors yet.
Attachments
Karateka_frames_2.zip
(143.38 KiB) Downloaded 11 times

endriuw
Sheikh
Sheikh
Posts: 22
Joined: February 21st, 2017, 5:51 pm

Re: Karateka of Persia?

Post by endriuw » March 18th, 2017, 12:51 am

That is so great, thanks again!!

Regarding the "athletic" movements, that is climbing or jumping...

Karateka only climbs once, at the very beginning of the game, but I
think it is useless to capture that climbing because the mountain
wall hides the first part of the climbing and you see only the end...

Regarding jumps, unfortunately the karateka never jumps...

But I think we can do like this: since the prince and the karateka
look very similar, we just make sure the karateka has the same
size as the prince, and when he needs to jump or to climb we
use the original prince, just modifying it a little bit to look more
like the karateka (for example the skin color, and we color his
whole suit white like karateka... but wait, the prince is also
wearing a white suit! :) )

What do you think?

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

Re: Karateka of Persia?

Post by Norbert » March 18th, 2017, 2:23 am

Attached the same frames, but now with proper colors.
Also resized and partially cut.
Still to do: transparency for non-prince pixels.
endriuw wrote:What do you think?
Sounds all right.
endriuw wrote:maybe "moving fast" cannot be used because there is nothing similar in PoP...
It can be used.
Taking a small step in PoP is 12 frames.
This is close to Karateka's "moving fast", which is 10 frames.
We could either duplicate two frames of the animation itself, or start and end with the neutral fighting stance, or interpolate frames.
Attachments
Karateka_proper_colors.zip
(34.42 KiB) Downloaded 10 times

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

Re: Karateka of Persia?

Post by Norbert » March 18th, 2017, 2:47 am

Norbert wrote:
endriuw wrote:maybe "moving fast" cannot be used because there is nothing similar in PoP...
It can be used.
Taking a small step in PoP is 12 frames.
This is close to Karateka's "moving fast", which is 10 frames.
We could either duplicate two frames of the animation itself, or start and end with the neutral fighting stance, or interpolate frames.
To get a very rough idea of what this will look like, put the files inside the attached KID.zip in SDLPoP 1.17's data/KID/ directory.
Then start the program and make the prince take a small step.
All I did is flip the images horizontally.
And I decided to go with the "start and end with the neutral fighting stance" variant.
Of course, it would still need full transparency, better alignment and such.

The prince's neutral stance should probably become Karateka's neutral fighting stance.
Attachments
KID.zip
(6.41 KiB) Downloaded 8 times

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

Re: Karateka of Persia?

Post by Norbert » March 18th, 2017, 1:01 pm

We now need to measure the distances the Karateka moves during the animation, from the lower left of his body.

The reason is: we need to replicate these offsets in Prince of Persia, and the original prince's movement is not the same.
(The images of the original prince are shown in-game in different x/y locations.)

To use "moving fast" as an example.

We start (and end) with 186, which is the neutral fighting stance.
We moved, measured (in pixels, px) from the starting position:

frame 1: fighting stance start: x:0px / y:0px
frame 2: 252: x:0px / y:0px
frame 3: 261: x:4px / y:0px
frame 4: 270: x:21px / y:0px
frame 5: 276: x:26px / y:0px
frame 6: 288: x:28px / y:0px
frame 7: 300: x:28px / y:0px
frame 8: 312: x:32px / y:0px
frame 9: 321: x:32px / y:0px
frame 10: 333: x:28px / y:0px
frame 11: 345: x:24px / y:0px
frame 12: fighting stance end: x:24px / y:0px (same as frame above)

Attached an example image of how to measure.

Next up, I will measure how the Karateka is currently moving in Prince of Persia when he's doing this "moving fast" animation. I will post the overview in a future post, and then you'll see some manual adjustment is required to make the animation show up properly. This all comes back to my very first reply in this thread, but hopefully it'll be easier to understand for everyone reading along what's currently required for this kind of modding. :)
Attachments
measure_1.png

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

Re: Karateka of Persia?

Post by Norbert » March 18th, 2017, 1:34 pm

Norbert wrote:Next up, I will measure how the Karateka is currently moving in Prince of Persia when he's doing this "moving fast" animation. I will post the overview in a future post, and then you'll see some manual adjustment is required to make the animation show up properly. This all comes back to my very first reply in this thread, but hopefully it'll be easier to understand for everyone reading along what's currently required for this kind of modding. :)
In Prince of Persia (SDLPoP), currently:

frame 1: fighting stance start: x:0px / y:0px
frame 2: 252: x:1px / y:0px
frame 3: 261: x:4px / y:0px
frame 4: 270: x:25px / y:0px
frame 5: 276: x:37px / y:0px
frame 6: 288: x:42px / y:0px
frame 7: 300: x:35px / y:0px
frame 8: 312: x:36px / y:0px
frame 9: 321: x:41px / y:0px
frame 10: 333: x:29px / y:0px
frame 11: 345: x:25px / y:0px
frame 12: fighting stance end: x:25px / y:0px
Attachments
measure_2.png

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

Re: Karateka of Persia?

Post by Norbert » March 18th, 2017, 1:52 pm

Anyway, I know how much work this whole project would be if done properly. And if I'd do it (or helped), I'd do it properly. Which is also why I won't be doing it. ;) Currently, neither SDLPoP nor MININIM allow easy modification of all graphics. If the images of in-game PoP animations wouldn't jump around (the offsets, x/y coordinates, where the images are actually shown) and the sword would be attached to humans, and so on, then this would be an easier project. In theory, we could pull this off the hard way, by just struggling with all this until it's done. But then the next person who'd like to do a similar kind of modification would have to go through the struggle all over again. This is not the proper path to take. The modding tools, in particular the programs SDLPoP and MININIM, would need to be modified to allow for this kind of extensive graphical modding. Lots of other projects I'm working on. :)

endriuw
Sheikh
Sheikh
Posts: 22
Joined: February 21st, 2017, 5:51 pm

Re: Karateka of Persia?

Post by endriuw » March 18th, 2017, 9:07 pm

Many thanks for this Norbert! :) Seeing Karateka waliking inside the PoP rooms is already a great emotion for me, so grateful! :)

Then you think I should not try to do it during my free time? (which would start in the first days of April unfortunately...)

What about the people who modified the kid and the other characters for mods 0000020 and especially 0000122 ? Do you think they struggled much to do those changes? Many thanks again, you are great! :))))

Post Reply