Prince of Persia Dev Log

I have decided to document the making of Prince of Persia - a game by PPOT and @clintonium-119. Amongst other things, this dev log will hopefully keep us motivated to continue and (possibly) complete the game!

Oct 2, 2022: Hopefully the start of something big!

I have the Arduboy rendering from the level map created from the Tile graphics prepared by @Clintonium-119. So far I have only rendered the foreground and the background in two separate passes. The objects will be a third pass but yet to be implemented.

I have done some basic movements of the player. What you are seeing below is controlled by the buttons and I have implemented turning around, running, jumping from a stand-still and jumping while running. At present there is no left / right movement of the actual player. I will need to come back and add these movements a lookup table based on the image frame being shown. This will also allow me to adjust the image a pixel or two left / right and up / down to make the movements look a little more fluid.

ArduboyRecording

Long, long way to go … just wanted to show you some progress!

The movements come from some sample code I made for the Pokitto. I use a stack and push the image indexes onto it. So if you start running, I push all the image indexes that take you from a stand still to running. The stack is then exhausted over the coming frames … if you are still holding the button to make it continue running then I load up those image indexes that complete a running step. Seems to work well.

The big time effort will be spent making the actions look smooth and ensuring that you cannot do something that the scenery prevents. Like jumping when there is an overhead and so on …

11 Likes

Oct 9, 2022: Climbing up and down levels.

Had some more time to play this weekend.

ArduboyRecording(1)

Have the climbing up and down from levels sorted. If you are near an ‘edge tile’ (within 6px), the prince will step towards it if needed and climb up. Likewise, if they are within 6px the will move towards the edge and climb down. This will happen if they are facing the correct way or the other way - the prince will turn around if necessary.

This is taking a little time to get right but I think its important to get the movements right.

I am struggling a bit with the longer jumps - that from a a standstill and that while running - as its possible you can hit a wall mid-flight and truncate the action. As I mentioned, I push all the movements into a queue when the player presses a button and pop them out over subsequent frames.

I am not sure whether to try to calculate the collision up front and push a series of images that includes the collision and fall to the ground or to push the images for a ‘correct’ jump and calculate the collision on each frame. When a collision is detected, I would then clear the stack and push in the required frames to simulate the collision at that point.

The good news is that if I get the jumps sorted out properly, I will be well on the way to making this game a reality. There is still a long way to go but its moving along :slight_smile:

3 Likes

Oct 13, 2022: Collapsible floors.

ArduboyRecording(2)

More progress … Note how the falling tile ripples as you land on the ground near it. This is how the original worked!

I couldn’t resist adding the PPOT and Prince Of Persia title screens. The title screen needs a little more work but the idea is there.

3 Likes

Oct 16, 2022: Power up!

Had some fun with this one! Need to check with the original to see if the game flashes as the health is restored.

ArduboyRecording(4)

2 Likes

Oct 23, 2022: HUD Tweaks

I added the health indicators on the bottom of the screen as @Mr.Blinky had done in the original thread. It was really hard to see so I moved it to the side of the screen. The arrows didn’t make sense so I swapped them for rectangles and added the time at the lower right.

ArduboyRecording(5)

When fighting an enemy, I will remove the time so we can see both the player’s and the enemy’s health on the screen.

The little ‘D2’ in the top corner is the distance to the edge of the current tile and is used for debugging. Every movement should end with a distance of 2, 6 or 10 but I have a couple of combinations that leave the player in a different spot. Need to sort these out!

1 Like

Oct 26, 2022: Title tweaks (Part 1)

@Vampirics helped with the title graphics. What we had originally was sampled off the original graphics but left a lot to be desired. The scrolling to reveal the game options looks good but would be more effective with a larger scroll.

ArduboyRecording(7)

Oct 27, 2022: More title tweaks (Part 2)

ArduboyRecording(8)

And another tweak … the castle scrolls a bit better now. Thanks @vampirics!

Oct 29, 2022: Swords and button floors

I feel like I am avoiding the hard task of working out how to handle collisions with walls mid air. I also need to tackle the points where the prince should fall. I have implemented some but not al! At the moment the prince can run off a platform into mid air and not fall … not really realistic.

I was doing a course over the last week at work and progress on the game has slowed down. I quickly implemented the scene where the prince picks up a sword to feel like I have made some progress! I also added a little icon in the HUD to show that the sword has been picked up.

ArduboyRecording(10)

Also implemented is the two buttons states of the floor that open and close gates respectively.

ArduboyRecording(11)

4 Likes

This is looking fantastic!
Thanks for sharing the progress; it’s really insightful - and a nice teaser for the game :smiley:
Could you share a bit more about how the FX chip has been necessary/ used?

Without the FX chip, this game would not be possible.

Each level consist of 2 layers of data - foreground and background - each layer around a 1K each. Multiply that by 10 levels and suddenly half of your PROGMEM is gone! I haven’t looked into compression but would assume that I might be able to compress a little using RLE but due to the number of different tile types needed for all levels, would not be able to store two tiles per byte. Why look at compression when you have an FX?

Currently there are over 200 images of the prince and these are duplicated for left and right hand versions. We also have some large screen images including the title and (hopefully) some of the cut scenes used between levels. The FX library supports transparency - if we were to move those images back to PROGMEM and use the standard libraries, I would need masking images as well. Having said that, the transparency layer in the FX makes the images larger but I am not sure whether it is twice the size of the original - in which case it would be the same size as an image and mask.

Currently every image is in the FX. If we find we have some memory left over, it may make sense to move some of the common images back to PROGMEM however as soon as I do this, I will need to incorporate the Sprites library … so it may not be worth it.

I do not anticipate having any PROGMEM left over :slight_smile:

5 Likes

Nov 1,2020: Exit Scene

Not much achieved today other than this exit scene.

ArduboyRecording(15)

Unfortunately, the prince needs to be standing in the exact position for it to work and coming in from the left side. Not sure how to integrate this into a running sequence or if the player comes in from the right.

Quite tricky getting some of these graphics right. I have noticed that in the original PoP the player sometimes ‘jumps’ from one position to the next to make these graphics work. I am trying to avoid this magic but may have to do the same if I cannot get it to work reliably.

7 Likes

Amazing job done filmote. It’s really amazing to be able to do so nice animations. This game will be amazing too… Yes, i wrote alot amazing because it’s and i don’t find better words to describe that i feel when i see that…

1 Like

I really hope I can achieve- or even better ~ the original.

2 Likes

It’s great you are putting so much care into the feel and controls.
When I was a kid, this is what killed my enthusiasm instantly – it was so finicky about positioning, to make the jumps and even climbing down, etc.
No doubt the PPOT remake will be the definitive version! :wink:

3 Likes
1 Like

How good is that! I wish I could do that on the Arduboy.

2 Likes

Nov 10, 2020: Refactoring Code

Not much new to show visually. I have spent a lot of time refactoring some code and trying to make the engine a little more robust than it was. Most of the effort has gone into streamlining the way a player behaves when the start to fall or hit a wall mid-air. If they were running or walking they need to fall in a graceful arc however, if they fall down a hole with walls on either side (a chute!) then they must fall almost vertically.

I have implemented that now!

I did read this great blog about Mr.Sid who ported Prince of Persia from the Apple II to the Commodore 64. He did not have any of the source code and simply took a snapshot of the memory from the Apple II as the game was being played and started working out what each byte was for. Its like a treasure hunt … oh this memory could be graphics, this looks like code and this over here looks like the image cross reference table that Mechner had documented in his journals. Amazing but tedious work!

6 Likes

Nov 11, 2020: Jump, Jump

[Flashbacks to Kris Kross in the earl '90s.]

ArduboyRecording(22)

I have been playing with the ‘running jump’ action but cannot get it to behave as responsively as I want using all of the frames in the Mechner original. The issue is simply that lag between pressing the jump button and the number of frames to be rendered / the distance travelled before the player actually leaves the ground.

I have pruned a few frames out and the responsiveness is much, much better … but I feel bad about dropping some of the frames from the original.

The animation above show the longest jump the Prince an perform - over four blank tiles to a lower level - and a gratuitous death scene!

7 Likes

Also starting to look at the cut scenes … not 100% sure about these:

POP_BG

PoP_FG

POP_BG copy

(That’s background, foreground, combined.)

1 Like

Looks great to me! Are they tiled or full backgrounds?