Home

Awesome

SDLPoP

An open-source port of Prince of Persia, based on the disassembly of the DOS version, extended with new features.

Links

Authors

Author:

Contributors:

Usernames on the list above refer to either GitHub users or users from forum.princed.org.

GENERAL

What is this?

This is an open-source port/conversion of the DOS game Prince of Persia. It is based on the disassembly of the original PoP1 for DOS.

Note, however, that SDLPoP has many new features not found in the original game. These are marked as such in the command-line and the keys sections below.

Where can I download that disassembly?

Here: https://forum.princed.org/viewtopic.php?f=68&t=3423

Sources which helped in making the disassembly:

LICENSE

This program is open source under the GNU General Public License terms, see COPYING and src/GPLv3.h.

The following files are external libraries with their own licenses: src/opl3.c, src/opl3.h, src/stb_vorbis.c. See their contents for license information.

USAGE

Running the game

Windows

GNU/Linux

Arch Linux
Debian/Ubuntu

macOS

Compiled versions

What command-line options are there?

The following don't exist in the original game:

Environment variables

Which keys can I use?

Controlling the kid

Sword fight:

You can also use the numeric keypad.

Gamepad equivalents

If SDLPoP does not work correctly with your gamepad, it might help if you download gamecontrollerdb.txt and configure SDLPoP to use it. See SDLPoP.ini for details.

Since version 1.23 SDLPoP now detects controllers plugged in while the game is already running. (hotplug)

Controlling the game

The following don't exist in the original game:

Viewing or recording replays:

Replays don't exist in the original game.

Cheats:

The following don't exist in the original game:

Debug cheats

These don't exist in the original game.

Intended use of Shift+F9:

Where is the music?

Since version 1.13, the game supports loading music from the data/music folder.

Until 1.15, music was not included in releases because it is very big, and it does not change between SDLPoP versions. You need to get the music from here: (38 MB) https://www.popot.org/get_the_games/various/PoP1_DOS_music.zip It's the last link here: https://www.popot.org/get_the_games.php?game=1 Copy the OGG files to the data/music folder.

Since version 1.15, music is included.

Since version 1.18, SDLPoP can play music from the MIDISND*.DAT files and OGG files are not included.

Using custom music

You can still copy OGG files to data/music or mods/<modname>/music to override music for the original game or a mod, respectively. To use the music in data/music for all mods as well, enable the always_use_original_music option in SDLPoP.ini.

The possible file names can be found in data/music/names.txt. The file name has to be the part after the equals sign, followed by .ogg.

You can find an example alternate music set in the ZIP mentioned above, in the ogg_MT-32 folder.

MODS

Can I play mods?

Since version 1.02, the game supports LEVELS.DAT, and since version 1.03, the game can use all .DAT files. You can either copy the modified .DAT files to the folder of the game, or the game to the mod's folder.

Since version 1.17, the game can also load from mod folders that have been placed in the "mods/" directory. If you use this method, only the files different from the original V1.0 data are required in the mod's folder.

To choose which mod to play from the mods/ folder, do one of the following:

Hall-of-Fame and saved game files will also be placed in the mod's folder.

Another way to play a mod is to start the game while the current directory is the mod's directory. You can do this from the command line, or with batch files / shell scripts. This is useful if you want to compare the behavior of this port and the original DOS version (to find bugs). Especially if you're editing the level and don't want to copy LEVELS.DAT from one place to the other.

Since version 1.19, SDLPoP can recognize most changes made with CusPoP in a DOS mod's PRINCE.EXE. Since version 1.16, you can configure some options in SDLPoP.ini: starting time, level types, etc. In addition, since version 1.17, mods in the "mods/" folder can use a custom configuration file "mod.ini". Options in this file can override (most of) the gameplay-related options in SDLPoP.ini.

Beware, some mods (especially the harder ones) might rely on bugs that are fixed in SDLPoP.

Furthermore, SDLPoP opens up new possibilities for mod making. For example:

Additional tiles

See doc/tiles.md for documentation on tiles added by SDLPoP.

REPLAYS

Replays don't exist in the original game.

How do replays work?

Starting from version 1.16, you can capture or view replays in SDLPoP. To start recording, press Ctrl+Tab on the title screen or while in game. To stop recording, press Ctrl+Tab again. Your replays get saved in the "replays/" directory as files with a .P1R extension. You can change the location where replays are kept using the setting 'replays_folder' in SDLPoP.ini.

If you want to start recording on a specific level, you can use the command prince record <lvl_number>, where <lvl_number> is the level on which you want to start.

To view a replay, you can press Tab while on the title screen. To cycle to the next replay (in reverse creation order), press Tab again. You can also double-click on a replay file (and tell the OS that the file needs to be opened with the SDLPoP executable). SDLPoP will then immediately play that replay. Dragging and dropping onto the executable also works.

While viewing a replay, you can press F to skip forward to the next room, or Shift+F to skip to the next level.

Your settings specified in SDLPoP.ini (including whether you are playing with bugfixes on or off) are remembered in the replay. It shouldn't matter how SDLPoP.ini is set up when you are viewing the replay later. Note that any cheats you use do not get saved as part of the replay.

To print out information about the replay from the command-line, you can use the 'validate' command-line parameter. Example usage: prince validate "replays/replay.p1r"

Since version 1.21 you can re-record if you make a mistake: While recording, make a quicksave to mark your place, and press quickload to return to that place.

COMPILING

Prerequisites for all platforms

Windows

Dev-C++

You need the MinGW Development Libraries of SDL2:

To install these, just extract the contents of the i686-w64-mingw32 folder from each archive to:

You need to "merge" the contents of the bin, include, etc. folders in the archives into the existing folders with the same name in the MinGW64 folder.

To compile, open one of the .dev files and click the compile icon.

Visual Studio

CMake

GNU/Linux

Install SDL2 + SDL2 image

Arch Linux
pacman -S sdl2_image
Debian/Ubuntu
apt-get install libsdl2-image-dev
Manually

I recommend this if your distro does not have the newest SDL version, because sound may be garbled in SDL versions older than 2.0.4 if the sound output is not 8-bit.

Download the SDL2 and SDL2 image sources:

Build and install these libraries according to their documentation.

Then build the game:

make all

Create a desktop/menu icon with:

sudo make install

Remove it with:

sudo make uninstall

macOS

Install SDL2 + SDL2 image

With Homebrew
brew install sdl2 sdl2_image pkg-config
With Port

Install "port" from https://www.macports.org/, then:

sudo port install libsdl2 libsdl2_image pkgconfig

Install development tools

  1. Install Xcode.
  2. Install the "command line developer tools" by typing xcode-select --install at the prompt.
  3. Using terminal, in the '/src' directory of SDLPoP, type: make

Start the game

Tested on OSX 10.9.5, OSX 10.11.2, macOS 10.13 and 10.14.

  1. In the project root directory. Type ./prince or ./prince full.
  2. Hit Ctrl+Q to quit.