ap_gen_tool Documentation

The Basics

Advanced game JSONs

ap_gen_tool is © Daivuk & Kaito Sinclaire, and is open source software released under the terms of the GNU GPL v2.
Website Source

"world_info" contains some additional controls for the Python (Archipelago-facing) side of the APWorld.

While "world_info" is technically optional, it is usually a good idea to at least specify a description, and perhaps some World Options as well. Unspecified fields will receive defaults based on the IWAD of the game.

Field Overview

"description"

This is the description of the game, as would be displayed on the "Supported Games" page on archipelago.gg. It is usually a good idea to fill this out with some basic information about the game. At some point, the description might also be displayed in the Archipelago Doom Launcher, though this is currently not the case.

The description may either be written out with a single string, or as an array of strings. If the latter is used, a new line is implicitly placed after every string.

Examples:
"description": "This is a simple, one line description."
"description": [
  "DOOM II: Hell on Earth is a first-person shooter released by id Software in 1994.",
  "The sequel to DOOM (1993), it introduces the Super Shotgun, and has larger levels and",
  "a significantly larger, more balanced monster bestiary."
]

"item_pool_ratio"

This structure controls how filler items are placed in the world. For each of the five main difficulties, where "1" is "I'm too young to die" and "5" is "Nightmare!" (or their equivalents, if changed):
  • "helpful" is the percentage of the item pool that is filled with helpful items.
  • "random" is the percentage of the item pool filed with random unweighted helpful or junk items.
Example:
"item_pool_ratio": {
  "1": { "helpful": 42, "random": 8 },
  "2": { "helpful": 39, "random": 6 },
  "3": { "helpful": 33, "random": 3 },
  "4": { "helpful": 29, "random": 1 },
  "5": { "helpful": 29, "random": 1 }
}

"helpful_item_weight"

This object contains a weighted list of items, used to determine what "helpful" items should be placed in the seed. An item with a higher weight is more likely to be selected than an item with a lower weight.

Item names are used as the keys, while the integer weights are used as the values. While any non-unique item name can be used as a "helpful" item, it is best to stick to items that are either filler, or useful.

Example:
"helpful_item_weight": {
  "Armor": 10,  // . . . . 63% chance to be selected ( 10 chances / 16 total )
  "Mega Armor": 5,  // . . 31% chance to be selected ( 5 chances / 16 total )
  "Invulnerability": 1  //  6% chance to be selected ( 1 chance / 16 total )
}

"world_options"

TODO There are many different world options available for use; to see a list of them, and available options for configuring them, see the below section on World Option Details.

Example:
"world_options": [
  { "name": "Difficulty", "preset": "Doom" },
  { "name": "Start with Maps" },
  { "name": "Capacity Upgrades" },
  { "name": "Custom Ammo Capacity" }
]

"hooks"

There are occasions where some extra code specific to this game may need to be inserted into the APWorld; for instance, workarounds for restrictive starts. Hooks provide a way to accomplish this. Note that this also gives you an unprecedented ability to break your APWorld if you aren't careful; with great power comes great responsibility.

The following hooks are available:
  • "class": Rarely used. For creating extra arbitrary methods or class vars.
  • "extra_connection_requirements": Rarely used. For creating additional options/restrictions for connections.
  • "create_item": For changing/overwriting an item's information or settings as it's being created.
  • "generate_early": For basically anything; usually used to handle easing restrictive starts or custom options.
  • "create_regions": For modifying the world's region information.
  • "set_rules": Rarely used. For changing rules on the fly.
  • "create_items": For modifying the item pool before it's finalized.
  • "fill_slot_data": Rarely used. For adding additional information to the game's slot data.
Example:
"hooks": {
  "generate_early": [
    "# If soloing MAP21-MAP30, we need to mark a weapon as early to help generation succeed",
    "if self.solo_episode(3):",
    "    early_weapon = self.random.choice([\"Super Shotgun\", \"Plasma Gun\"])",
    "    self.multiworld.early_items[self.player][early_weapon] = 1"
  ]
}

World Option Details

TODO

Difficulty

This world option specifies what difficulty options are available for the game.

The following additional fields are recognized:
  • "preset": Overrides all settings and sets up the default difficulty settings for the given game. Accepted values are "Doom" and "Heretic".
  • "skill_5_warning": This should be set to the same string the game gives when trying to choose skill 5. ("Nightmare!") This is used for a cheeky reminder that players can change the difficulty inside the Archipelago Doom Launcher if they find it too difficult.
  • "list": An array of five difficulty settings for the player to choose from. Each difficulty is an object that should contain, at minimum, a "full_name". Optionally, it may also contain an "option_name", a "description" and a list of "aliases".
Examples:
{ "name": "Difficulty", "preset": "Doom" }
// -- HacX --
{
  "name": "Difficulty", 
  "skill_5_warning": "Are you sure? You can't handle this skill, hacker!",
  "list": [
    { "full_name": "Please don't shoot!", "aliases": [ "itytd", "pds" ] },
    { "full_name": "Arrgh, I need health!", "aliases": [ "hntr", "ainh" ] },
    { "full_name": "Let's rip them apart!", "aliases": [ "hmp", "lrta" ] },
    { "full_name": "I am immportal", "aliases": [ "uv", "iai" ] },
    { "full_name": "Insanity!", "option_name": "insanity", "aliases": [ "nm" ] }
  ]
}

Start with Maps

Including this World Option adds the option to start the player with all full-map powerup items instead of shuffling them into the Multiworld, so that the player can see the entirety of the automap for every level from the beginning of the game.

The following additional fields are recognized:
  • "plural_name": Sets the pluralized item name for the full-map item, if just adding an "s" to the standard item name won't suffice.
  • "doom_type": The doomednum of the full-map powerup item. Defaults to 2026 for Doom and 35 for Heretic, and almost never needs to be changed.
Example:
{ "name": "Start with Maps" }

Invis as Trap

Including this World Option adds the option to mark all invisibility-granting items as traps. This doesn't change their behavior, but indicates to other players in the multiworld that the player would prefer not having them picked up if possible.

The following additional field is recognized:
  • "doom_type": The doomednum of the invisibility item. Almost always 2024.
Example:
{ "name": "Invis as Trap" }

Capacity Upgrades

Including this World Option adds the option to split up capacity upgrades into multiple items, and control how many of them are placed in the world. Note that this is distinct from customizing the actual ammo capacity values, which is handled by the Custom Ammo Capacity option below.

The following additional fields are recognized:
  • "combined_plural_name": Sets the pluralized item name for combined capacity upgrades used in the description, if just adding an "s" to the standard item name won't suffice.
  • "doom_type": The doomednum of the combined capacity upgrade item. Almost always 8.
  • "item_count": Sets the number of items that capacity upgrades will be split into. Defaults to 4 for Doom and 6 for Heretic, and almost never needs to be changed.
Examples:
{ "name": "Capacity Upgrades" }
{ "name": "Capacity Upgrades", "combined_plural_name": "Bags of Holding" }

Custom Ammo Capacity

Including this World Option adds the options for custom ammo capacity to the world.

No additional fields are recognized; the names, values, and ranges for each option will be automatically determined from the ammo types set in "game_info".

Example:
{ "name": "Custom Ammo Capacity" }

Custom Option

Including this World Option adds an extra, arbitrary option to the world, that you can customize the behavior of using "hooks". This World Option may be added multiple times, to add multiple such custom options.

The following additional fields are recognized:
  • "type": Required. One of "Toggle", "Choice", or "Range". Sets the type of option to be created.
  • "display_name": Required. Sets the name of the option as displayed to players in the WebHost and Options Creator.
  • "option_name": Sets the name of the option that's used in player YAMLs and in the code. Defaults to the display name converted to snake_case.
  • "option_group": Sets the group in which this option will appear. The default is "Randomizer Options".
  • "description": Sets the description of the option, usually informing the player of what the option does. It may either be written out with a single string, or with an array of multiple strings.
  • "default": Sets the default value for the option.
  • "range_start", "range_end": Range type only. Sets the lower and upper bounds of the option's range.
  • "options": Choice type only. An array of possible options that the player can choose from. Each option is an object that should contain a "name", an integer "value", and optionally a list of "aliases".
Examples:
{
  "name": "Custom Option",
  "type": "Choice",
  "display_name": "Example Choice Option",
  "description": "Quick test of a custom Choice option.",
  "options": [
    { "name": "None", "value": 0 },
    { "name": "Primary", "value": 1, "aliases": [ "first" ] },
    { "name": "Secondary", "value": 2, "aliases": [ "second" ] },
    { "name": "Tertiary", "value": 3, "aliases": [ "third" ] }
  ]
}
// -- Chex Quest 3: Vanilla Edition --
// The Super Large Zorcher is available, despite never being placed in any levels.
// So if this option is toggled on, we add it to the pool in a later hook.
{
  "name": "Custom Option",
  "type": "Toggle",
  "display_name": "Add Super Large Zorcher",
  "description": [
    "If enabled, the Super Large Zorcher will be added to be item pool,",
    "even though it is not normally obtainable."
  ]
}