Page 1 of 1

How to program your own PoP1 Level Editor?

Posted: July 7th, 2022, 12:09 pm
by DridiSara123
Hi.

Well, I'm already familiar with the C# programming language and I'm using the Windows Forms application as a platform (And that with Visual Studio 2019). Only I want to create my own Prince of Persia Level Editor with it. Unfortunately I have no idea how to read and write LEVEL.DAT?
When I open the Levels.DAT in the text editor, I only see a lot of confused text that I don't understand what's there.

Does anyone know what basics I need to know to be able to program my own Pop1 Level Editor myself?

Re: How to program your own PoP1 Level Editor?

Posted: July 7th, 2022, 6:40 pm
by dmitry_s
Check out the PR editor that imports/exports resources from DAT files.
https://www.popot.org/other_useful_tools.php?tool=PR

Re: How to program your own PoP1 Level Editor?

Posted: July 10th, 2022, 10:54 am
by David
DridiSara123 wrote: July 7th, 2022, 12:09 pm Unfortunately I have no idea how to read and write LEVEL.DAT?
You can find a document about the format of PoP DAT files here: https://www.popot.org/documentation.php ... ifications
DridiSara123 wrote: July 7th, 2022, 12:09 pm When I open the Levels.DAT in the text editor, I only see a lot of confused text that I don't understand what's there.
LEVELS.DAT is not a text file, it's a binary file.
I'm not sure how familiar are you with binary files. So if anything is unclear, just ask.

You can open LEVELS.DAT in a hex editor, and then follow Section 3.1 (or specifically 3.1.2) of the FormatSpecifications document to find where each level is within the file.
After you familiarized yourself with the format, you can write program code to do the same thing.

Alternatively, you can use PR to extract the levels (as apoplexy does), then you only need to handle the extracted PLV files.
Their format is described in Section 5, PLV v1.0 Format Specifications.

If you use the --raw option of PR, then the extracted files won't even have PLV headers, and you can go straight to Section 3.4, Levels.

The extracted levels (whether PLV or raw) are still binary files.


Why do you want to make your own level editor, by the way?