From 76d1460d0f46eb9d041e24bf0db36645011995db Mon Sep 17 00:00:00 2001 From: black-sliver <59490463+black-sliver@users.noreply.github.com> Date: Thu, 7 Oct 2021 19:41:29 +0200 Subject: [PATCH] add api.md work-in-progress v3 --- docs/api.md | 489 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 489 insertions(+) create mode 100644 docs/api.md diff --git a/docs/api.md b/docs/api.md new file mode 100644 index 00000000..46c08eb4 --- /dev/null +++ b/docs/api.md @@ -0,0 +1,489 @@ +# Archipelago API + +This document tries to explain some internals required to implement a game for +Archipelago's generation and server. Once generated a client or mod is +required to send and receive items between game and the server. + +Client implementation is out of scope of this document. Please refer to an +existing game that provides a similar API to yours or read the +[network protocol.md](https://github.com/ArchipelagoMW/Archipelago/blob/main/docs/network%20protocol.md) + +Archipelago will be abbreviated as "AP" below. + + +## Language + +AP uses python3 for generation, server and web host. The seed generation will be +written in python3, the client that connects to the server to sync items can be +in any language that allows using websockets. + + +## Codeing style + +AP follows all the PEPs. When in doubt use an IDE with coding style +linter, for example PyCharm Community Edition. + + +## Doc strings + +Doc strings are strings attached to an object in python that describe what the +object is supposed to be. Certain doc strings will be picked up and used by AP. +They are assigned by writing a string without any assigment right below a +defition. e.g. +```python +class MyGameWorld(World): + """This is the description of My Game that will be displayed on the AP + website.""" +``` + + +## Definitions + +### 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. + +### 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.option_name[self.player]`. A dict +of valid options has to be provided in `self.options`. More on that later. + +### World options + +Any AP installation can provide settings for a world, for example a ROM file, +accessible through `Utils.get_options()['_options']['