# Archipelago API This document tries to explain some internals required to implement a game for Archipelago's generation and server. Once a seed is generated, a client or mod is required to send and receive items between the game and server. Client implementation is out of scope of this document. Please refer to an existing game that provides a similar API to yours. Refer to the following documents as well: - [network protocol.md](https://github.com/ArchipelagoMW/Archipelago/blob/main/docs/network%20protocol.md) - [adding games.md](https://github.com/ArchipelagoMW/Archipelago/blob/main/docs/adding%20games.md) Archipelago will be abbreviated as "AP" from now on. ## Language AP worlds are written in python3. Clients that connect to the server to sync items can be in any language that allows using WebSockets. ## Coding style AP follows all the PEPs. When in doubt use an IDE with coding style linter, for example PyCharm Community Edition. ## Docstrings Docstrings are strings attached to an object in Python that describe what the object is supposed to be. Certain docstrings will be picked up and used by AP. They are assigned by writing a string without any assignment right below a definition. The string must be a triple-quoted string. Example: ```python from worlds.AutoWorld import World class MyGameWorld(World): """This is the description of My Game that will be displayed on the AP website.""" ``` ## Definitions This section will cover various classes and objects you can use for your world. While some of the attributes and methods are mentioned here not all of them are, but you can find them in `BaseClasses.py`. ### World Class A `World` class is the class with all the specifics of a certain game to be included. It will be instantiated for each player that rolls a seed for that game. ### WebWorld Class A `WebWorld` class contains specific attributes and methods that can be modified for your world specifically on the webhost. `settings_page` which can be changed to a link instead of an AP generated settings page. `theme` to be used for your game specific AP pages. Available themes: | dirt | grass (default) | grassFlowers | ice | jungle | ocean | partyTime | |---|---|---|---|---|---|---| | | | | | | | | `bug_report_page` (optional) can be a link to a bug reporting page, most likely a GitHub issue page, that will be placed by the site to help direct users to report bugs. `tutorials` list of `Tutorial` classes where each class represents a guide to be generated on the webhost. `game_info_languages` (optional) List of strings for defining the existing gameinfo pages your game supports. The documents must be prefixed with the same string as defined here. Default already has 'en'. ### MultiWorld Object The `MultiWorld` object references the whole multiworld (all items and locations for all players) and is accessible through `self.world` inside a `World` object. ### Player The player is just an integer in AP and is accessible through `self.player` inside a World object. ### Player Options Players provide customized settings for their World in the form of yamls. Those are accessible through `self.world.[self.player]`. A dict of valid options has to be provided in `self.options`. Options are automatically added to the `World` object for easy access. ### World Options Any AP installation can provide settings for a world, for example a ROM file, accessible through `Utils.get_options()['_options']['