Network: add RoomInfo -> Games

Allows clients to only download relevant parts of the datapackage, or to keep ID lookups per-game, and for Bounce to tell if there will be a receiving end.
This commit is contained in:
Fabian Dill 2021-10-22 04:46:00 +02:00
parent 0f4d285223
commit 8e35372aad
2 changed files with 7 additions and 5 deletions

View File

@ -489,6 +489,7 @@ async def on_client_connected(ctx: Context, client: Client):
'cmd': 'RoomInfo',
'password': bool(ctx.password),
'players': players,
'games': [ctx.games[x] for x in range(1, len(ctx.games)+1)],
# tags are for additional features in the communication.
# Name them by feature or fork, as you feel is appropriate.
'tags': ctx.tags,

View File

@ -57,8 +57,9 @@ Sent to clients when they connect to an Archipelago server.
| hint_cost | int | The amount of points it costs to receive a hint from the server. |
| location_check_points | int | The amount of hint points you receive per item/location check completed. ||
| players | list\[NetworkPlayer\] | Sent only if the client is properly authenticated (see [Archipelago Connection Handshake](#Archipelago-Connection-Handshake)). Information on the players currently connected to the server. See [NetworkPlayer](#NetworkPlayer) for more details. |
| games | list\[str\] | sorted list of game names for the players, so first player's game will be games\[0\]. Matches game names in datapackage. |
| datapackage_version | int | Data version of the [data package](#Data Package Contents) the server will send. Used to update the client's (optional) local cache. |
| datapackage_versions | dict[str, int] | Data versions of the individual games' data packages the server will send. |
| datapackage_versions | dict\[str, int\] | Data versions of the individual games' data packages the server will send. |
| seed_name | str | uniquely identifying name of this generation |
#### forfeit
@ -247,7 +248,7 @@ Requests the data package from the server. Does not require client authenticatio
#### Arguments
| Name | Type | Notes |
| ------ | ----- | ------ |
| exclusions | list[str] | Optional. If specified, will not send back the specified data. Such as, ["Factorio"] -> Datapackage without Factorio data.|
| exclusions | list\[str\] | Optional. If specified, will not send back the specified data. Such as, \["Factorio"\] -> Datapackage without Factorio data.|
### Bounce
Send this message to the server, tell it which clients should receive the message and
@ -256,9 +257,9 @@ the server will forward the message to all those targets to which any one requir
#### Arguments
| Name | Type | Notes |
| ------ | ----- | ------ |
| games | list[str] | Optional. Game names that should receive this message |
| slots | list[int] | Optional. Player IDs that should receive this message |
| tags | list[str] | Optional. Client tags that should receive this message |
| games | list\[str\] | Optional. Game names that should receive this message |
| slots | list\[int\] | Optional. Player IDs that should receive this message |
| tags | list\[str\] | Optional. Client tags that should receive this message |
| data | dict | Any data you want to send |