ArchipelagoMW / Archipelago

Archipelago Multi-Game Randomizer and Server
https://archipelago.gg
Other
515 stars 671 forks source link

Core: add item and location metadata to worlds #4187

Open drtchops opened 1 week ago

drtchops commented 1 week ago

What is this fixing or adding?

This adds item_metadata and location_metadata as class vars to worlds. These can be used to specify extra information describing how items and locations work to better inform users and other worlds. The main use case I'm targeting is vague hints, but this could also be used to help inform new players, improve other worlds' display of remote items, or help with building new external tools.

Right now this data is only available at generation time. It might be too large to add the the datapackage, but maybe it can be made available to clients somehow.

Example metadata for Hollow Knight

    item_metadata = {
        "Mantis_Claw": {
            "short_name": "Claw",
            "description": "Allows wall jumping, giving access to significant parts of the map.",
            "visual_tags": ["claw"],
            "functional_tags": [CommonFunctionalTags.MOVEMENT],
            "default_classification": ItemClassification.progression,
            "usefulness": 100,
        },
        "Shade_Soul": {
            "description": "Progressive Vengeful Spirit/Shade Soul, allows killing Baldurs and doing fireball skips.",
            "visual_tags": [CommonVisualTags.SPELL],
            "functional_tags": [CommonFunctionalTags.COMBAT, CommonFunctionalTags.MOVEMENT],
            "default_classification": ItemClassification.progression,
            "usefulness": 75,
        },
        "Grub": {
            "description": "Adorable!",
            "functional_tags": [CommonFunctionalTags.MACGUFFIN],
            "usefulness": 101,
        },
    }

    location_metadata = {
        "Mothwing_Cloak": {
            "description": "Defeat Hornet in Greenpath",
            "area": "Greenpath",
            "difficulty": 25,
        },
        "King_Fragment": {
            "description": "On the body at the very end of White Palace.",
            "area": "White Palace",
            "difficulty": 90,
        },
        "Sly_1": {
            "description": "One of the purchases from Sly in Dirtmouth",
            "area": "Dirtmouth",
            "difficulty": 10,
        },
    }

Example using location metadata for Witness vague hints

    if world.options.vague_hints:
        area = world.multiworld.get_location_metadata(hint.location.game, location_name).get("area")
        if area:
            chosen_group, group_type = area, "Group"
        else:
            chosen_group, group_type = try_getting_location_group_for_location(world, hint.location)

Main question: is this something people would actual use? If there's no desire for it there's no point figuring out specifics.

How was this tested?

hasn't yet

If this makes graphical changes, please attach screenshots.

N/A