PrinceJS: all levels implemented

Prince of Persia

Too much time without post here. These past weeks i have been quietly progressing in the development of the game. Currently it is possible to ‘play’ all levels, both dungeons land palace levels. Most of the special blocks are implemented (spikes, loose floors, gates, exit door, potions, etc …) and the kid can move across rooms like in the original game … or at least as close as possible … I’m quite happy with the current feeling, although there are details to polish.

The hardest and time consuming part has been the collision detection system. Basically the game checks barriers (gates, walls, tapestries, …) and floors for collision detection. At first it seems easy but it is not. In fact it is a hell because of the huge number of different situations that you need to take into account: if you collide while running you need to bump, if you start to run in front of a barrier you have to take a step ( this step is relative to the distance of the barrier), if you collide while jumping you have to ‘fall’ down, when you collide with the floor, depending on the height of the fall, you need to make a soft-land, a med-land or hard-land (a.k.a. splash & die), you can also grab the edge of the floor if you’re falling and close enough … and so on, I think you can get an idea how complex it is.

There are still many things missing: no guards, no deaths (yes, you can not die, sorry), missing chomper, potions have no effects, there are  thousands of bugs here and there, and hundreds of other features to implement… but time to time.

For now, enough talk. If you want to test the current state of the game click here. You can play with the arrow keys, use the shift key to step, take the sword or potions, and grab ledges. You can also forward or backward levels with the Q and W keys, or press the R key to restart the level. Indeed, the level 0 is the original game demo level and level 15 is the potions level used in the original game as copy protection. Both are playable, good luck!

8 thoughts on “PrinceJS: all levels implemented

    1. Sort of… Sometimes following the original source code is very dificult so i also used the source code of the SDL port and, sometimes, direct gameplay observation (through gif capture and frames extraction 🙂 )

      Liked by 1 person

Leave a comment