Sunday, March 19, 2017

Using PSThar to convert levels from MapTemp to GameMaps

Today I had a chance to demonstrate PSThar in a practical way. For reasons that will become clear in time, a PCKF member needed to convert a TED5-style MAPTEMP file to the Carmackized usable GAMEMAPS version. One approach would have been to write a small console program to load one format and save in the other. Or, Abiathar could open the old format, export a bunch of ASLEVs, then load them into a project file using the new format.

Since PSThar has access to all Abiathar internals and the two formats use the same class in FleexCore 2, the easiest approach - which I ended up using - was to whack the MapType value of the file configuration to Carmack by script, then do a normal save to write out the maps with the new format.

$fc = $Abiathar.FileConfig['Core']
$fc.MapType = 'Carmack'
$fc.MapFiles.GameMaps = 'GAMEMAPS.CK4'

Note that this simple technique wouldn't work for other level format conversions, since Huffman maps and MapTemp/MapTHead maps are processed by different classes. For those, the GalaxyLevel objects would need to be transplanted into a different level set object of the appropriate type.

No comments:

Post a Comment