Cutscenes and bug hunting

Prince of Persia

The lasts weeks i have been bussy fixing some bugs ( thanks to David from the Princed forums for his extensive testing) and implementing new features. This is the changelog for the new version:

[BUG] Pillar and arch tiles do not act as space
[BUG] Tapestries tiles do not act as barriers
[BUG] Prince sprite is cropped when falling after a jump up
[BUG] Prince sprite cropped incorrectly on exit level animation
[BUG] Upper level loose board do not fall when prince jumps up
[BUG] Potion bubbles has no colors
[BUG] Large potion bubbles shows at incorrect position
[REFACTOR] Redesigned game manager to separate level logic and level design
[REFACTOR] Implemented a class for every tile object
[FEATURE] Chopper implemented
[FEATURE] Title screens, credits, intro cutscene and in-game cutscenes implemented.

Image from intro cutscene

From the list, the most noticiable feature is the implementation of the cutscenes. In preparation for the development of the guards AI i decided to investigate how to implement the behaviour of the actors in the cutscenes between levels (princess and vizier scenes). At the end i finally developed a very simple virtual machine, with a reduced instruction set, that let me program the behaviour of the actors for every scene. So, the next script represent the intro cutscene of the game:

{ "i": "ADD_ACTOR", "p1": 0, "p2": 5, "p3": 62, "p4": 167, "p5": -1 },
{ "i": "ADD_ACTOR", "p1": 1, "p2": 6, "p3": 140, "p4": 167, "p5": -1 },
{ "i": "START" },
{ "i": "ACTION", "p1": 0, "p2": "stand" },
{ "i": "ACTION", "p1": 1, "p2": "stand" },
{ "i": "WAIT", "p1": 20 },
{ "i": "ACTION", "p1": 0, "p2": "alert" },
{ "i": "WAIT", "p1": 6 },
{ "i": "ACTION", "p1": 1, "p2": "walk" },
{ "i": "WAIT", "p1": 6 },
{ "i": "ACTION", "p1": 1, "p2": "stop" },
{ "i": "WAIT", "p1": 20 },
{ "i": "ACTION", "p1": 1, "p2": "walk" },
{ "i": "WAIT", "p1": 30 },
{ "i": "ACTION", "p1": 1, "p2": "stop" },
{ "i": "WAIT", "p1": 35 },
{ "i": "ACTION", "p1": 1, "p2": "raise" },
{ "i": "WAIT", "p1": 1 },
{ "i": "ACTION", "p1": 0, "p2": "stepback" },
{ "i": "WAIT", "p1": 10 },
{ "i": "EFFECT" },
{ "i": "ADD_OBJECT", "p1": 0, "p2": 0, "p3": 152, "p4": 141 },
{ "i": "WAIT", "p1": 25 },
{ "i": "ACTION", "p1": 1, "p2": "exit" },
{ "i": "START_OBJECT", "p1": 0 },
{ "i": "WAIT", "p1": 43 },
{ "i": "ACTION", "p1": 0, "p2": "slump" },
{ "i": "WAIT", "p1": 20 },
{ "i": "END" } ]

The script is JSON formatted, and every line is an instruction. For example, the first instruccion adds on screen an actor (the princess has code 5 in-game) on position (62,167) and facing left (-1). So, every cutscene has an script like this, and is very easy to write them. The cutscene manager implements a very simple virtual machine that reads an instruction every tick and execute it.

This system is also suitable for script the special events of the game ( gate closed on first level, mouse help, shadow on mirror level, falling floors on lasts levels, etc…) and for the guards AI i’m still undecided: perhaps i will use the same method (an script for every guard type) or perhaps i will try some sort of state machine like machina.js

Well, enough for now. You can try the last version here. Have fun!!


One thought on “Cutscenes and bug hunting

  1. Would it be possible to add hardcore 4D PoP levels in the future — ?

    Have you heard about CRT shaders, e.g. ? One can get this retro feeling even when playing on a modern LCD screen.

    Do you plan to support CGA and EGA modes of PoP —,%20EGA%20and%20VGA%20graphics/ ? It would be nice. Changing modes is like playing a new game each time. 🙂

    Keep up good work!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s