Author Topic: FOClassic-Map-Converter  (Read 2894 times)

Offline Slowhand

  • Go for the eyes, Boo! Go for the eyes!
FOClassic-Map-Converter
« on: November 25, 2022, 05:58:18 pm »
FOClassic-Map-Converter

This is a tool I made to convert map files from other versions of FOnline that are not compatible with FOClassic/SDK2238/Reloaded versions.

Open source in Java on GitHub: https://github.com/Sasabmeg/foclassic-map-converter

For those too laze to try it, or only need it to convert the TLA mk2 maps, here are the converted samples with pictures of each map for convenience:
Maps: https://github.com/Sasabmeg/foclassic-map-converter/tree/main/sample/out
Pics: https://github.com/Sasabmeg/foclassic-map-converter/tree/main/sample/pics

Detailed description of the tool Soon TM.

First, you need to have JRE8 installed. The tool is written in Java, you can run it from console. (f.e.: java -jar foclassic-map-converter.jar -h )

The conversion is a 3 step process:
  • Generate item proto mapping file from generic proto files usually found at /server/proto/items/ for both source and target.
    • This is the more important proto mapping, because this handles more than 90% of an average map. Everything in the fomap file that is in the [Tiles] section and in [Objects] section but does not start with 'MapObjType 0' is not a Critter, so it falls into items proto category.
    • The Item proto mapping is strongly checked against FOClassic structure and will warn in log file if unknown attributes are found.
    • The output of this conversion in a proto mapping file, containing the proto ID's to map in first two columns. It is also verbose, as it contains the art path and filename, to supply information for manual changes if necessary. If you run the covnert.bat this file will be named items_verbose.mapping
    • Example: java -jar foclassic-map-converter.jar -gipm out\items_verbose.mapping -pms resources\tlamk2\proto\items\ammo.fopro resources\tlamk2\proto\items\armor.fopro -pmt resources\foclassic\proto\items\ammo.fopro resources\foclassic\proto\items\armor.fopro -lp out -ll error
      • -gipm --generateItemProtoMappingFile filename and relative path to generate the item proto mapping to.
      • -pms --protoMultipleSources item proto mapping source files (map/convert proto from), you can give multiple source files.
      • -pmt --protoMultipleTargets item proto mapping target files, (map/convert proto to) you can give multiple target files.
      • -lp --logPath logs will be created in this folder.
      • -ll --logLevel can be info, warning or error.
  • Generate critter proto mapping file from critter proto files usually found at /server/proto/critters/ for both source and target.
    • This is the less important proto mapping, because critters are more personalized for target maps and also because it's almost impossible to get a good pivot point to connect the two sdk versions. Everything in the fomap file that is in the [Objects] section and does  start with 'MapObjType 0' is a Critter, so it falls into this proto category.
    • The critter proto mapping is not checked against FOClassic structure and it will copy over most attributes. The pivot point are two attributes: ST_BASE_CRTYPE and ST_BODY_TYPE
    • The output of this conversion in a proto mapping file, containing only the proto ID's to map in first two columns. If you run the covnert.bat this file will be named critters.mapping
    • Example: java -jar foclassic-map-converter.jar -gcpm out\critters.mapping -pms resources\tlamk2\proto\critters\ammo.fopro resources\tlamk2\proto\critters\armor.fopro -pmt resources\foclassic\proto\critters\ammo.fopro resources\foclassic\proto\critters\armor.fopro -lp out -ll error
      • -gcpm --generateCritterProtoMappingFile filename and relative path to generate the critter proto mapping to.
      • -pms --protoMultipleSources item proto mapping source files (map/convert proto from), you can give multiple source files.
      • -pmt --protoMultipleTargets item proto mapping target files, (map/convert proto to) you can give multiple target files.
      • -lp --logPath logs will be created in this folder.
      • -ll --logLevel can be info, warning or error.
  • Use the two proto mapping files above to convert the fomap file.
    • Example: java -jar foclassic-map-converter.jar -ms resources/tlamk2/maps/barter_ground.fomap -mt out/barter_ground_converted.fomap -ipm out/items_verbose.mapping -cpm out/critters.mapping[/color -lp out -mph remove -ll error
      • -ms --mapSourceFile filename and relative path to fomap file to be converted.
      • -mt --mapTargetFile filename and relative path to conversion result.
      • -ipm --itemProtoMapping item proto mapping file to be used for conversion.
      • -cpm --critterProtoMapping critter proto mapping file to be used for conversion.
      • -lp --logPath logs will be created in this folder.
      • -mph --missingProtoHandling can be ignore, remove or replace. Replace not features atm and remove is strongly recommended.
      • -ll --logLevel can be info, warning or error.

You can use the convert.bat or convert_all.bat to do the whole process in one go. Make sure the follow the folder structure regarding resources and output.
Examples:
  • convert.bat resources\tlamk2\maps\barter_ground.fomap resources\tlamk2\proto resources\foclassic\proto out
  • convert.bat resources\tlamk2\maps\barter_ground.fomap resources\tlamk2\proto resources\foclassic\proto out
  • Notes:
    • Both assume that critter and item proto files have fopro textension. In case of FOClassic critters, this is not true, so you might want to rename them manually before setting up this folder structure.

« Last Edit: November 26, 2022, 04:59:08 pm by Slowhand »

Re: FOClassic-Map-Converter
« Reply #1 on: November 26, 2022, 11:56:54 am »
God bless. This saved me a bunch of work right now.