From 6c949c3a527766191c3c7b5e1576b2225719bcbb Mon Sep 17 00:00:00 2001 From: black-sliver <59490463+black-sliver@users.noreply.github.com> Date: Sat, 9 Oct 2021 00:49:47 +0200 Subject: [PATCH] api.md: Apply first batch of suggestions from code review Co-authored-by: Hussein Farran --- docs/api.md | 95 +++++++++++++++++++++++++++-------------------------- 1 file changed, 48 insertions(+), 47 deletions(-) diff --git a/docs/api.md b/docs/api.md index 5a3ace6a..2332df9c 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1,14 +1,14 @@ # 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. +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 or read the [network protocol.md](https://github.com/ArchipelagoMW/Archipelago/blob/main/docs/network%20protocol.md) -Archipelago will be abbreviated as "AP" below. +Archipelago will be abbreviated as "AP" from now on. ## Language @@ -18,18 +18,19 @@ written in python3, the client that connects to the server to sync items can be in any language that allows using websockets. -## Codeing style +## Coding style AP follows all the PEPs. When in doubt use an IDE with coding style linter, for example PyCharm Community Edition. -## Doc strings +## Docstrings -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. +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 class MyGameWorld(World): """This is the description of My Game that will be displayed on the AP @@ -39,29 +40,30 @@ class MyGameWorld(World): ## Definitions -### World class +### World Class -A world class is the class with all the specifics of a certain game to be +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 +### 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. +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 +### 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. +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 +### World Options Any AP installation can provide settings for a world, for example a ROM file, accessible through `Utils.get_options()['_options']['