Command-line tools for map making



  • Hello everyone,
    Here are some tools I used to make our new map Over the Top (see https://forums.triplea-game.org/topic/2495/over-the-top-new-wwi-mod), available now in the game.

    https://github.com/jdimeo/triplea-map-tools

    They're definitely a bit rough around the edges, since I only worked on them for what I needed them for, so please feel free to file issues with bugs or suggestions if you try using them.

    Once cloned, you can run mvn package and it will create a .exe and an executable .sh (for Mac/Linux) with the following usage:

    Usage: triplea-tools [COMMAND]
    Commands:
      help            Displays help information about the specified command
      excel           Synchronizes the game file with an Excel spreadsheet to edit
                        the unit and territory attachments and initial placements
      cp-notes        Copy game notes into our out of the game file to a separate
                        HTML file for easier editing
      template        Plugin a matrix of values into a template
      connections     Automatically generate connections from polygons.txt
      railroads       For games that use canals through land as a railroad system,
                        this will automate much of the boilerplate
      vars            Create a few standard/convenience variables automatically
                        (like a all land territories) for use in triggers
      fix-file-names  Fix capitilzation of files in a folder, even on Windows
      tile-join       Joins image tile back into the full size original image
      tile-quantize   Quantize (standardize) the colors in an image to black
                        (borders), white (land) and blue (sea) for base tile images
      tile-split      Splits an image into equally sized square tile images
    

    Some highlights:

    • The Excel sync is a really powerful way to edit unit attachments, territories, and starting placements. You can run quick calculations for faction balancing or compare one attachment e.g. offense easily across all units and then sync it back in to the game file.
      Warning: I'm using JAXB to re-write the game file if you make a change the Excel and for awhile it was preserving comments and whitespace, but the JAXB runtime libraries that work with Java 11+ seem to have regressed in this area
    • If the new-ish for-each ability doesn't work for you, you can create templates and inject any variables into them with any level of nesting
    • The connection finder uses powerful polygon math from the JTS topology suite (https://github.com/locationtech/jts) and requires very little hand-correction (because it dilates each territory and then measures the area of overlap)
    • For games that use railroads, this creates canals for every sea zone with a "RR" prefix (since you have to own the land territory to use the railroad)
    • Can take an HTML game notes file with a <style> block at the top and copy the notes into the CDATA block and inline the style at the same time
    • Can quantize a base tile image to force all pixels to one of 3 colors (since some modern software "helpfully" antialiases/smooths images, but that's bad for your base tiles)

Log in to reply