Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Tools => Topic started by: Goober5000 on November 07, 2010, 03:41:55 pm

Title: Proposal: POF <--> XML
Post by: Goober5000 on November 07, 2010, 03:41:55 pm
A situation has come up repeatedly in my modding experience where it would be useful to find out the differences between two POF models.  Mostly this is because we have two models that appear identical but which have different dockpoints, or different paths, or some sort of obscure modification to the POF data that none of the modders can remember.

I thought it might be cool to create a diff tool to compare the difference between two models, but there are already a number of very good diff tools available today, and it seems a shame to create a new one from scratch.  Then I realized that if the POF were somehow converted to text format, one could simply run an existing diff tool on the text form of the POF.

So, is it possible for PCS2 or some other tool to do this?  Can the PMF format, for example, be easily saved to XML form?  XML would seem to be the best text format to use, as it most closely corresponds to the chunk tree layout of the existing binary object.

This would also allow the enterprising modder to tweak some aspect of the POF without having to load up the modelling program, in the same way that a mission can be tweaked in a text editor without loading it up in FRED.  Of course, he would need to know what he's doing. :)
Title: Re: Proposal: POF <--> XML
Post by: FUBAR-BDHR on November 07, 2010, 03:49:34 pm
Why not Collada dae?  Max has it listed as XML.
Title: Re: Proposal: POF <--> XML
Post by: Kazan on November 07, 2010, 03:49:56 pm
Collada IS XML.
Title: Re: Proposal: POF <--> XML
Post by: Goober5000 on November 07, 2010, 04:00:13 pm
Ah, well, there you go. :)

Now if I can only find a version of PCS2 that doesn't trigger the "Array out of bounds" error, I'll be all set.
Title: Re: Proposal: POF <--> XML
Post by: Spicious on November 07, 2010, 04:50:32 pm
 |
 | If it doesn't work, file a bug or something.
 V
Title: Re: Proposal: POF <--> XML
Post by: chief1983 on November 07, 2010, 05:23:05 pm
Only problem with that is that you're not guaranteed to get a 100% identical representation of the POF data in the Collada format.  For one, there isn't even any BSP info at all.  Even PMF doesn't have that.  We'd need a way to dump to an XML file that contains _all_ POF data chunks, or some other type of dump that can be compared with a text diff tool.  Or, we'd need a tool specifically for comparing the binary files.
Title: Re: Proposal: POF <--> XML
Post by: Spicious on November 07, 2010, 07:03:48 pm
I would have thought BSP info, as generated data, shouldn't matter. Collada should retain almost everything else.

Perhaps more annoying is that ordering of xml nodes is non-deterministic.
Title: Re: Proposal: POF <--> XML
Post by: chief1983 on November 07, 2010, 10:07:19 pm
It is generated info, but since it's been generated by different methods over the years, different versions of PCS2, etc, if that was the only difference between models, I'd definitely want to know that was causing any observed behavioral difference.
Title: Re: Proposal: POF <--> XML
Post by: FreeSpaceFreak on November 08, 2010, 11:51:28 am
|
 | If it doesn't work, file a bug or something.
 V

On exporting to DAE and re-importing, the "$engine_subsystem=Engine" line gets dropped from the thruster properties.
Title: Re: Proposal: POF <--> XML
Post by: Spicious on November 08, 2010, 05:12:48 pm
Is there a subsystem called Engine?
Title: Re: Proposal: POF <--> XML
Post by: FreeSpaceFreak on November 09, 2010, 02:21:41 am
There is. The bug occurs for ships with multiple engine subsystems as well.
Title: Re: Proposal: POF <--> XML
Post by: Spicious on November 09, 2010, 03:41:47 am
Is it called engine or Engine?
Title: Re: Proposal: POF <--> XML
Post by: FreeSpaceFreak on November 09, 2010, 09:45:02 am
Doesn't matter, happens regardless of capitalization. Test model (Hecate) attached.

[attachment deleted by admin]
Title: Re: Proposal: POF <--> XML
Post by: Spicious on November 09, 2010, 11:22:01 pm
It should be =$engine01 instead of =engine01 really. It shouldn't cause a problem anymore.
Title: Re: Proposal: POF <--> XML
Post by: Spicious on November 10, 2010, 06:14:04 am
Amusingly enough, wanting to compare BSP data rules PMF out of consideration. PCS2 has only been saving 4 bytes of BSP data per subobject.
Title: Re: Proposal: POF <--> XML
Post by: chief1983 on November 10, 2010, 09:54:00 am
I didn't think any BSP data was supposed to be saved in PMF.
Title: Re: Proposal: POF <--> XML
Post by: Spicious on November 10, 2010, 04:35:12 pm
Originally it wasn't saved in PMF, but was added later.
Title: Re: Proposal: POF <--> XML
Post by: chief1983 on November 10, 2010, 04:55:14 pm
O R'lyeh?  That's news to me.  Still, there's no guarantee that converting to PMF and back to POF won't somehow affect the data, so converting before comparing files might not work consistently.  We could still use some sort of analyzer that works on POF files as is I think, to meet the request in this thread at least.
Title: Re: Proposal: POF <--> XML
Post by: Spicious on November 10, 2010, 05:02:42 pm
As I mentioned earlier, while PCS2 is storing some BSP data now, it's only storing at most 4 bytes per subobject.
Title: Re: Proposal: POF <--> XML
Post by: chief1983 on November 10, 2010, 07:26:18 pm
Any reason it does, but only 4 bytes?  That a bug or something?
Title: Re: Proposal: POF <--> XML
Post by: Spicious on November 10, 2010, 08:02:29 pm
Yeah, it's a bug. It essentially does write(bsp_data, sizeof(bsp_size)) instead of write(bsp_data, bsp_size). It's a fairly simple fix but requires a PMF version bump.