Skip to content

Latest commit

 

History

History
73 lines (64 loc) · 5.07 KB

README.md

File metadata and controls

73 lines (64 loc) · 5.07 KB

Examples & Utilities

This folder contains some examples and utilities that do useful things and also illustrate how to manipulate city data.

Things

  • city_report.py: Command line utility to print a summary of the city to stdout.

    Command line arguments:

    • -i/--input: input .sc2 to open and generate the report on.
  • city_preview.py: Command line utility to create a full-resolution preview image of a city.
    Currently very much a work in progress, but things are generally working, though there are still bugs and tweaks/features needed.

    Command line arguments:

    • -i/--input: input .sc2 to open and generate the image of.
    • -o/--output: where to save the output png. Just the filename, will append extension itself.
    • -s/--sprites: directory containing the sprites. Currently only works with large (32 x 17px tile size) sprites. These can be generates using sprite_parse.py.
    • -t/--transparent: if set, draw city with a transparent background.
    • --sign: Draw signs in city. Does not draw neighbour connection signs. Needs (included) W95FA.otf font.
  • city_minimaps.py: Command line utility to generate minimaps for a city, kinda like the ones in the game. Note that the minimaps in the game aren't 128x128, but are scaled by the UI. This generates square 128x128 minimaps.

    Command line arguments:

    • -i/--input: input .sc2 to open and generate the minimaps on.
    • -o/--output: Directory to create the minimaps in. Will overwrite any existing ones.
    • -p/--palette: Full path to the PAL_MSTR.BMP file to use for the palette.
    • -d/--debug: Draw debug minimaps that don't exist in the game and aren't particularly useful except for debugging purposed.

    Currently generated minimaps:

    • Structures: Only shows where structures are, base minimap in game.
    • Zones: shows zones.
    • Highlighted buildings:
      • Police stations
      • Fire stations
      • Colleges
      • Schools
    • Road network
    • Rail network
    • Subway network
    • Pipe network and water supply
    • Power network and power supply
    • Growth Rate
    • Crime
    • Fire Power
    • Police Power
    • Pollution
    • Traffic
    • Land Value
  • city_tools.py: Command line utility to edit simple things about a city. This is mostly used to test editing and re-saving a city, but more things could be added here as needed.

    • -i/--input: input .sc2 to open and generate the minimaps on.
    • -o/--output: where to save the resulting file.
    • -m/--money: Set an amount of money. Clamped to the maximum the game supports.
    • -t/--terrain: Put the city into terrain edit mode, instead of city build mode.
    • -p/--pause: Pause the game.
    • -n/--no-sound: Turn off music and sound effects.
    • --fix-offset: In certain cases when editing the terrain, there can be an "offset" in the cursor on land. This appears to be due to the depth of water being set on land. This mode experimentally fixes this part of ALTM, so that the cursor properly highlights the tile it's on top of.
  • make_news.py: Command line utility to generate a single newspaper article. It is also useful as a library to generate news stories. Should be complete, barring some minor formatting issues. (One of which is token mappings changing between the headline and story.)

    • -i: input JSON file to open, generated by data_usa_parse.py.
    • -o: where to save the resulting file. Optional, if not specified, writes to stdout.
    • -s: Story ID to generate, between 0 and 66 inclusive. Optional, generates a random story otherwise.
    • -m: Mayor's name, optional, uses a default.
    • -c: City name, optional, uses a random default.
    • -t: Sports team name, optional, uses a random default.
  • scenario_tools.py: Command line utility to display information about a scenario. Also allows editing of an existing scenario, or creation of a completely new scenario.

    • -i/--input: input .sc2 to open and generate the minimaps on.
    • -o/--output: where to save the resulting scenario file. Don't specify if not creating a new scenario.
    • -s/--save-img: Optional. If used, specifies a path to save a PNG version of the image from the scenario's PICT segment at.
    • -n/--new-img: Optional. Specifies an image to use for the scenario's image (PICT). Required to create a new scenario.
    • -p/--palette: Optional. Needed if loading or saving an image. Path to the palette file to use. This should be PAL_MSTR.BMP in all situations.
    • -d/--desc-text: Optional, but required for scenario creation/editing. This is the text that shows up once the scenario is loaded, in a small window in game.
    • -t/--text: Optional, but required for scenario creation/editing. This is the text that shows up in the scenario selection window.
    • -c/--conditions: Optional, but required for scenario creation/editing. This specifies the 17 scenario win conditions, and all must be specified as comma separated values after the flag. Example: -c 1, 63, 63, 60, 0, 0, 0, 0, 20000, 0, 0, 0, 0, 0, 0, 0, 0. Values in the file format specification document.