27 April 2022

How Prince of Persia was made

Recently, I came across Jordan Mechner's video in which he explains how he used rotoscoping to animate the characters in Prince of Persia. It was his brother who did a lot of the jumping.  Prince of Persia also won six Guinness World Records, among which one was that it was the first motion-capture animation used in a video game. It reminded me of some of the games I created. Especially Digger Forever, for which I painstakingly drew animations on paper and typed out each pixel into the program. You can scroll down the code here (starting from line 593) to see the animations. During those days I considered rotoscoping to be "cheating". At that time I expected people to simulate human motion via algorithms.


You can play the game online if you like. There appear to be some downloads that could probably be used via dosbox.

One other pleasant surprise was that the princess we rescued, was also played by a real person: Christina Marie LaDeau "Tina" Ciccone. She was an 18 year old at the time, and the daughter of Jordan's colleague. Here's the hug sequence being played by the two shy youngsters.


When you think about it, the dungeon and palace that the prince has to run through, is rather amusing. You have lonely guards standing at odd places with swords drawn the whole night. You have spikes, unstable flooring, tiles floating in the air, metal jaws operated without electricity, potions kept at odd places, deep pits, guards who show no weakness after being struck by the sword, and the "horror" of fighting a sword-fighting skeleton. 

 

Plump guard in level six. This is where I learnt to use the up arrow key for defence

Floating tiles

So who brings the guards their food? If they were to visit the canteen, do they have to run and jump to catch hold of some ledge and then clamber up and down? Do they have to navigate the spikes and metal jaws when they go to pee? There's no toilet in the palace or dungeon either :-) There's even a big, friendly neighbourhood mouse that not only knows its way around the palace, it also knows who the prince is, and it knows how to open gates. Toward the end, Jaffar does not even bother having a few guards to protect him. Quite amazing how we ignore these to be able to solve puzzles and save the graceful princess.

Preparing to fight Jaffar

Anyway, it was indeed a lovely game. Quite challenging to figure out the puzzles (jumping through the mirror in the fourth level, using "ahimsa" against the shadow Prince in the level twelve, using the slow-fall potion in level seven, figuring out how to run over invisible tiles in level twelve). I managed to do it without referring to any walkthrough and without using cheat codes. I still remember a lot about how to get through the game. Carefree days. *sigh*


Message shown after completing the game


Prince of Persia on other platforms and re-makes

David X Newton created a video that shows how Prince of Persia was ported onto various platforms, the new ideas and bugs that they had.

Variations on various platforms

 
Reaching "hell" in the lower sections

Anime cut-scenes in the CD version

A change in scenery

Some kind of a demon or god who drops things on you

Another one of David's videos reveals a surprisingly good looking 3D look of the game. This version allows you to do back-flips too.


 

3D princess and an amusing ticking hourglass

Stunningly brilliant scenery and lighting

 

The prince being pushed into the dungeon initially by the guard

 

Some people have posted about "secret levels", which are just bugs that show up when you use cheat codes to revive a dead prince. People have even created custom levels and mods.

That's quite an impressive amount of effort and time put into this iconic game!

Update: July 2023: A person with the alias n3cr0ph0b1a on 9gag, used the pixelated princess image and used AI to create this beauty:




02 April 2022

Examining the source code of a Firefox addon / extension

When using a Firefox extension created by someone, you grant access to various websites you visit and to the content of the websites. How do you know if the extension can be trusted?

I recently wanted to check an addon, and it was possible to do it this way:

First, right click the "Add to Firefox" button and copy the link.


The link I copied is: https://addons.mozilla.org/firefox/downloads/file/3915177/i_dont_care_about_cookies-3.3.7-an+fx.xpi

Open a terminal and use the following command to download the addon:

curl -L https://addons.mozilla.org/firefox/downloads/file/3915177/i_dont_care_about_cookies-3.3.7-an+fx.xpi > theAddon.xpi

 

The downloaded addon is an XPI file (pronounced as "zippy") which can be extracted using your existing unzip program. 

Just right-click the file and extract.

 

Once extracted, you can examine the source code of the addon. Note that some authors may have minified their code, which not only makes it difficult to read, it also slows down the text editor, when you open the file, because all the source code will be in a single line.

So, before opening minified code, first un-minify it using a pretty-printer or an un-minification tool.


That's it. Examine the source code and see for yourself if the extension is trust-worthy.