XProger / OpenLara

Classic Tomb Raider open-source engine
http://xproger.info/projects/OpenLara/
BSD 2-Clause "Simplified" License
4.69k stars 359 forks source link

Idea: OpenLara level pack format support #468

Open ionlight4096 opened 1 year ago

ionlight4096 commented 1 year ago

Hello, great project you have here.

So I have an idea: Maybe create an OpenLara specific level pack format?

Instead of hard coding levels' names and level progressions and searching for lots of separate files at the game's startup (and answering zillions of questions "where should I put my data? what format is required? why are some files missing?"), the engine could be started with a single param pointing to the desired level pack. Like this: ./openlara -pack tr1.zip

What I came up with (still WIP): Basically a zip file with a manifest file and a fixed directory structure. Inside zip file there are levels, fmvs, load screens/credits pictures and language files in gettext format. Manifest contains game info, levels info (level title, level file, exits to other levels (will come in handy for TR4), inventory modifications on level enter) and subtitles, which can be shown when a corresponding audio/video file is played. Subtitles can also be localized with gettext. Here's an example of directory structure:

manifest.xml
audio/
    002.ogg
    003.ogg
    ...
languages/
    en_US.mo
    ru.mo
    ...
levels/
    level1.phd
    cut1.phd
    snow.avi
    ...
pix/
    gym.png
    title.png
    cred1.png
    cred2.png
    ...

Here's an example manifest for TR1 (incomplete): example_manifest.txt I chose XML because it's fully platform independent, easy to read and edit, it can be validated and transformed on the go with XSD and XSLT (and because I just like it :) ) If that sounds interesting, I could also assist in creating a separate multiplatform tool for validating and editing level packs (maybe not in C++ since I'm more familiar with Java and Python, but as long as it builds to a binary executable, it's fine).

Of course with a dedicated level pack format it will be easier to pack custom levels or even custom TR-based games.

XProger commented 1 year ago

Hi, it's great idea, but the original game data is under copyright protection, so the user should provide the data from his own copy ;)