How to program your own PoP1 Level Editor?

Post Reply
DridiSara123
Sheikh
Sheikh
Posts: 27
Joined: June 17th, 2018, 1:56 pm

How to program your own PoP1 Level Editor?

Post 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?
dmitry_s
Developer
Developer
Posts: 148
Joined: July 27th, 2021, 7:22 am

Re: How to program your own PoP1 Level Editor?

Post 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
David
The Prince of Persia
The Prince of Persia
Posts: 2848
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: How to program your own PoP1 Level Editor?

Post 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?
Post Reply