Native Engine Reimplementation

Prince of Persia
Time Run · Relooped

Windows & Android Port · Spark2 Engine in C++20 · Original Game Scripts · Soft-Mods System

A native Windows and Android port of Prince of Persia: Time Run, Ubisoft's endless runner for iOS. There is no emulator and no compatibility layer for the phone it came from: this project rebuilds Ubisoft's Spark2 engine in C++20 with Lua 5.1, OpenGL and SDL2, and runs the game's own scripts on top of it. The game itself is not included: you play it with your own copy.

Core Engineering Highlights

A Rebuilt Spark2 Engine

The original only ran on iOS. Its entity-component system, virtual file system, task scheduler, math library and render pipeline are reimplemented natively in C++20, as a 64-bit Windows program and an Android app.

Original Game Scripts

Rules, menus, levels and balance are Ubisoft's own Lua 5.1 bytecode, run unmodified. Where something has to behave differently on a PC, a small class override is layered on top.

Native OpenGL Renderer

Draws the 3D world with the game's own shaders (fog, lighting, world bending, weather presets), with skeletal animation, particles, the Prince's shadow and post effects, plus MSAA up to 8x and a render scale of up to 200%.

Fills Any Screen

Made for a tall 9:16 phone, now at home on windows and phones of other shapes: the 3D scene fills the screen (up to 16:9) and the always-visible HUD moves to its edges. Nothing is stretched.

Android Build

The same source runs on 64-bit ARM phones through SDL2 and gl4es on OpenGL ES, with touch swipes, the intro video, and its own first-run extraction and settings screen.

Keyboard, Gamepad, Mouse & Touch

Rebindable keys and controller buttons, with rewind on its own key. During a run the keys call the same handlers as touch swipes, so there is no input lag from emulated gestures.

Soft-Mods System

Optional runtime changes that never touch the game files: all skins unlocked, parkour rings in quests, visual fixes, particle scaling on slow devices and your own character models.

Offline, With No Shop

Ads, tracking and social features are gone, energy is removed, and buying currency with money is replaced by a gem and orb exchange. The Weekly Hunt works offline and changes with your system date.

Engine Reimplementation Architecture

YOUR COPY OF THE GAME

Prince of Persia: Time Run v2.0.5

game/data/ Lua scripts, 3D models, textures, shaders, audio & video unpacked from your .ipa
Native Function Calls (Lua C API)
REIMPLEMENTED ENGINE SUBSYSTEMS
lua_host Runs the game scripts and offers them the engine's native functions
spark2_bridge Native side of the engine's global functions
renderer 3D scenes with the game's shaders, 2D menus, screen fit and post effects
skeletal Decodes and blends the game's animations and skins the character meshes
particles & text Sparks, smoke and leaves; the game's fonts turned into on-screen text
physics Overlap world of boxes, with ray and box tests against ramp meshes
audio Software mixer for music, ambience and effects, decoded on a worker thread
vfs Maps the engine's virtual paths onto the extracted game files and mods
Platform Calls
NATIVE PLATFORMS

Windows x64 & Android arm64

SDL2 Window, Input & Audio OpenGL 2.1+ (Windows) gl4es on OpenGL ES (Android) System Video Decoding XInput / Game Controllers

Virtual File System Search Order

Scripts ask for files by their engine names, as if the game still lived inside the iOS app. The first folder under game/data/ that has the file wins:

Order Folder Description
1 mods/custom_skins/ Your replacement models and textures (only while the Custom Skins mod is on)
2 CosmosOverrides The game's own override scripts
3 extracted_PoPRunner The game's main package
4 Loose project files Files shipped outside the packages
5 extracted_Spark2Engine The engine's files

Dedicated Retro Launcher & Configurator

1-Click Asset Extractor

Self-Contained IPA Setup

Pick your .ipa or drag it onto TimeRun_Launcher.exe. The original App Store file works as it is, no Python, Java or other tools are needed, and a failed extraction leaves no half install behind.

Visual Fidelity Controls

Display Settings

Borderless fullscreen or a window of any size, VSync, a frame rate limit from 30 to 240 FPS, anti-aliasing up to MSAA 8x, a 3D render scale of 75% to 200%, and Fill the window.

Controls, Mods & Sound

Everything in One Place

Rebind the keys, switch each soft-mod on or off and set the music and effects volume. Settings are saved to game/config.ini; Android has a matching settings screen.

Soft-Mods

Mod Default What it does
UnlockAllSkins On Every character skin and weapon is available from the start
QuestSweetSpotRings On Quest runs show where the parkour moves are, as the endless run does
DahakaLightningDepth On Home screen: the lightning comes out of the Dahaka's hand and follows it
CarpetFollowsFeet On Carpet ride: the carpet stays under the rider's feet
AdaptiveParticles On Fewer ambient leaves and embers when the device is too slow
CustomSkins Off Your own character models and textures, made with the included skin tool

Mods only change what the running game does and shows: switching one off gives you your real progress back. Details are in the soft-mods guide, and the model and texture workflow in the skin tool guide.

Default Controls Scheme

Keys can be changed in the Launcher; keys and buttons in game/config.ini
Action Keyboard Default Gamepad Default Mouse / Touch
Switch Lane Left A or ← D-Pad Left Swipe left
Switch Lane Right D or → D-Pad Right Swipe right
Jump / Vault W or ↑ or Space D-Pad Up / A Button Swipe up
Slide / Roll S or ↓ or Left Shift D-Pad Down / B Button Swipe down
Rewind Time R X Button Tap the rewind button
Fly (Carpet Ride) Hold Space Hold A Button Hold the screen
Pause (During a Run) P Start Button Tap the pause button
Back Escape (Shift + Escape quits) Back Button On-screen buttons

Setup & Installation Guide

01

Requirements

- 64-bit Windows with OpenGL 2.1 or newer, or a 64-bit ARM phone with Android 8.0 or newer
- On Windows "N" editions, the Media Feature Pack
- About 500 MB of free space for the game data
- Your own iOS .ipa of Prince of Persia: Time Run v2.0.5

02

Windows

Download the Windows x64 .zip from GitHub Releases and unpack it into a folder you can write to. Start TimeRun_Launcher.exe, click Extract Game Assets, choose your .ipa, then launch the game.

03

Android

Install the arm64 .apk from GitHub Releases. On its first start the app asks for your .ipa, extracts it and restarts into the game. For settings, long-press the app icon and choose Settings.

Current state: menus, shop, quest runs, the 3D scenes, animation and sound are playable. The physics is a simplified replacement of the original engine's, controller sticks are not read yet, and Android has been tested on one phone so far. See what works, or build it from source.