Prince of Persia 1 XML Format

Threads about other remakes and ports.

Moderator: English Moderator Team

User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 3169
Joined: April 9th, 2009, 10:58 pm
Contact:

Prince of Persia 1 XML Format

Post by Norbert » July 29th, 2014, 8:37 pm

This document describes the Prince of Persia 1 XML format:

2014-08-08_PoP1_XML_Format.pdf

Also available as an ODT document. Page on popot.org here.
The level editor apoplexy can export levels to XML with: apoplexy -x

polipo
Vizier
Vizier
Posts: 89
Joined: September 6th, 2012, 8:34 am

Re: Prince of Persia 1 XML Format

Post by polipo » July 30th, 2014, 9:18 am

Dear,
i think there's an error on the <prince> tag, this will be closed

example
<prince room="<nr>" location="<nr>" direction="<nr>"> MISSED THE = "</prince>" or "/>" at the end

David
The Prince of Persia
The Prince of Persia
Posts: 1505
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Prince of Persia 1 XML Format

Post by David » July 30th, 2014, 9:20 am

[Looks like Polipo wrote a post while I was writing mine.]
There is a problem with the XML examples and with the XML files exported by Apoplexy.
They contain incorrectly written empty elements like this:

Code: Select all

<links left="2" right="9" up="0" down="0">
They have to be written like this:

Code: Select all

<links left="2" right="9" up="0" down="0" />
(You can open such a file in a browser and it will immediately show if there are any errors.)

User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 3169
Joined: April 9th, 2009, 10:58 pm
Contact:

Re: Prince of Persia 1 XML Format

Post by Norbert » July 30th, 2014, 12:07 pm

Fixed the document.

Also released a new apoplexy to fix its XML export functionality.

salvadorc17
Calif
Calif
Posts: 527
Joined: August 27th, 2011, 2:04 am

Re: Prince of Persia 1 XML Format

Post by salvadorc17 » July 30th, 2014, 10:25 pm

A new version for a bug that discovered, why not to add import xml function???

User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 3169
Joined: April 9th, 2009, 10:58 pm
Contact:

Re: Prince of Persia 1 XML Format

Post by Norbert » July 30th, 2014, 11:23 pm

salvadorc17 wrote:[...], why not to add import xml function???
As I wrote to you here: "Shouldn't be that complicated, but I need to find time to do it."
It takes time to implement. ;)

polipo
Vizier
Vizier
Posts: 89
Joined: September 6th, 2012, 8:34 am

Re: Prince of Persia 1 XML Format

Post by polipo » July 31st, 2014, 8:52 am

I will wait for your import xml functionallity.
Now i'm starting the develop of import the Apoplexy xml file into PrinceOfPersia.net

See my progress on

http://princeofpersiadotnet.blogspot.it ... ditor.html

User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 3169
Joined: April 9th, 2009, 10:58 pm
Contact:

Re: Prince of Persia 1 XML Format

Post by Norbert » July 31st, 2014, 7:53 pm

I'm currently busy implementing apoplexy's XML import functionality and ran into another small XML export bug in apoplexy.
The guards' (looking) directions are currently being exported in 'reverse' (right is left and vice versa).
That'll be fixed in the next release (the release that adds XML import functionality).

[Edit: the new apoplexy (version 2.4) is ready. Its forum thread is here. Importing is done with: apoplexy -y]

User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 3169
Joined: April 9th, 2009, 10:58 pm
Contact:

Re: Prince of Persia 1 XML Format

Post by Norbert » August 1st, 2014, 11:58 am

In a next version of this document about the XML format, I will specifically mention the <level number="(nr)"> for these five levels:
next wrote:level12a.xml has level number 12
level12b.xml has level number 13
princess.xml has level number 14
potions.xml has level number 15
demo.xml has level number 0
Anyways, what I wanted to suggest is allowing an optional hacks section - similar to the optional userdata section - in the XML, with keys and values based on CusPop's princehack.xml, since some programs that work with XML levels won't use the PRINCE.EXE files of mods. It would look something like:

Code: Select all

<hacks changes="(nr)">
	<hack key="starting hit points" value="4" />
	<hack key="environment level 2" value="1" />
	<hack key="Older version cheat code" value="megahit2" />
	((nr) fields total)
</hacks>
Although maybe this shouldn't be added for now, to prevent things from becoming too complicated too fast. Also, the CusPop keys (names) appear to be somewhat inconsistent. (See, for example, the upper and lower case in the sample XML code above.) And maybe it should work with ids instead. Anyhow, I'm just trowing this out here to see what you folks think.

polipo
Vizier
Vizier
Posts: 89
Joined: September 6th, 2012, 8:34 am

Re: Prince of Persia 1 XML Format

Post by polipo » August 5th, 2014, 11:19 am

Dear,
into the XML file of Level1.xml, i don't understand
this events, location =18 is a block/wall.
Why?? the events can be applied ONLY to pressplate and upressplate.


<event number="38" room="1" location="18" next="0" />
<event number="39" room="1" location="18" next="0" />
<event number="40" room="1" location="18" next="0" />

User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 3169
Joined: April 9th, 2009, 10:58 pm
Contact:

Re: Prince of Persia 1 XML Format

Post by Norbert » August 5th, 2014, 2:20 pm

Hi polipo, in the XML export, the events' information needs to be changed.

number="" must be -1 everywhere
location="" must be +1 everywhere

Example:
<event number="4" room="9" location="14" next="0" />
needs to become
<event number="3" room="9" location="15" next="0" />

I need to change apoplexy and I will clarify certain things in the PoP1 XML Format document.
I'll work on this today.

I know it may seem weird that event numbers should start at 0, but this is the only way to keep the modifiers of tiles consistent.
Also, I know it may seem weird that the apoplexy export still contains errors, but this is because I personally never ran into problems because of how apoplexy functions internally.
Thank you for bringing up this events related problem.

David
The Prince of Persia
The Prince of Persia
Posts: 1505
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Prince of Persia 1 XML Format

Post by David » August 5th, 2014, 3:16 pm

polipo wrote: into the XML file of Level1.xml, i don't understand
this events, location =18 is a block/wall.
The unused events of the original levels are filled with junk values, and Apoplexy just exported that.
Norbert wrote: <event number="4" room="9" location="14" next="0" />
needs to become
<event number="3" room="9" location="15" next="0" />
Wait, that is the exit door of level 1.
If you start counting tiles from 0, then it's tile 13. If you start from 1 then it's tile 14.
But how can it be tile 15?
Norbert wrote: I know it may seem weird that event numbers should start at 0, but this is the only way to keep the modifiers of tiles consistent.
It's not weird for someone who knows the level format.
Actually, numbering them differently from what the game uses, that might confuse people: viewtopic.php?p=14795#p14795

User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 3169
Joined: April 9th, 2009, 10:58 pm
Contact:

Re: Prince of Persia 1 XML Format

Post by Norbert » August 5th, 2014, 4:30 pm

David wrote:
Norbert wrote: <event number="4" room="9" location="14" next="0" />
needs to become
<event number="3" room="9" location="15" next="0" />
Wait, that is the exit door of level 1.
If you start counting tiles from 0, then it's tile 13. If you start from 1 then it's tile 14.
But how can it be tile 15?
See the attached files.
Attachments
level1_room9.txt
level 1, room 9
(887 Bytes) Downloaded 18 times
level1_room9.png
level 1, room 9
level1_room9.png (7.89 KiB) Viewed 1118 times

David
The Prince of Persia
The Prince of Persia
Posts: 1505
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Prince of Persia 1 XML Format

Post by David » August 6th, 2014, 9:28 am

Norbert wrote: See the attached files.
I looked at them.
The txt only strengthens my opinion.
First, look at room 9:

Code: Select all

		<room number="9">
			<tile element="47" modifier="3" /> (location 1, open button)
			<tile element="0" modifier="0" /> (location 2)
			<tile element="0" modifier="255" /> (location 3)
			<tile element="0" modifier="0" /> (location 4)
			<tile element="0" modifier="0" /> (location 5)
			<tile element="0" modifier="2" /> (location 6)
			<tile element="0" modifier="0" /> (location 7)
			<tile element="0" modifier="0" /> (location 8)
			<tile element="0" modifier="0" /> (location 9)
			<tile element="52" modifier="0" /> (location 10, wall)
			<tile element="35" modifier="0" /> (location 11, pillar)
			<tile element="33" modifier="1" /> (location 12, floor)
			<tile element="51" modifier="0" /> (location 13, torch)
			<tile element="48" modifier="0" /> (location 14, level door left)
			[...]
		</room>
In the events section, events 0,1,2 refer to the gate in room 12.
That gate is in the top-right corner.
If the top-left corner is location 1, then the top-right corner is location 10.

Code: Select all

	<events>
		<event number="0" room="12" location="11" next="0" />
		<event number="1" room="12" location="11" next="0" />
		<event number="2" room="12" location="11" next="0" />
		<event number="3" room="9" location="15" next="0" />
		[...]
	</events> 
About the image:
Some tiles, like torches and level doors appear one tile right from their actual position.
Take a look at the screenshot below:
Attachments
level1_room9_apoplexy.PNG

User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 3169
Joined: April 9th, 2009, 10:58 pm
Contact:

Re: Prince of Persia 1 XML Format

Post by Norbert » August 6th, 2014, 12:49 pm

Hah, you are right. :) The perspective was confusing me, good thing apoplexy uses that green stuff.
So, since you also wrote, about the event numbers, "Actually, numbering them differently from what the game uses, that might confuse people", I guess apoplexy doesn't need to be changed after all?
Should the modifiers of raise and drop tiles be +1? Then they point to the correct events, but their values would no longer be consistent with other modifiers; artificially-inflated.

Post Reply