ai-dungeon-cli
ai-dungeon-cli copied to clipboard
Support multiplayer mode
Seems pretty easy to do: just an hardcoded scenario-id
different than the one for single player.
But how to connect with other known users?
Also, should we prompt user every time or assume single player and enable multiplayer w/ a cli option?
My library supports multiplayer, but it's not really documented... The general idea is, create the adventure as usual from a multiplayer scenario id, obtain the public adventure id and share it with other players. Then, there is a query
mutation ($adventurePlayPublicId: String) {
addUserToAdventure(adventurePlayPublicId: $adventurePlayPublicId)
}
to add the current user to add it to the adventure. The query returns an adventure content id that can be used as usual.
In my library this is implemented here and there is also this client function to connect to a public adventure (it does the transaction required automatically)
If you want to connect to an existing adventure it's also possible to do:
api_client = AiDungeonApiClient()
api_client.adventure_id = 'adventure:31914999'
ai_dungeon = AiDungeonGame(api_client, conf, io)
ai_dungeon.login()
ai_dungeon.start_game()
Thanks for the input both of you.
I've just added cli options capabilities (w/ argparse
) which was a prerequisite for this feature.
Indeed, I guess we'd enable precising the (existing) adventure_id with a command line argument.
Basic implem with only support for public adventure id: https://github.com/Eigenbahn/ai-dungeon-cli/commit/493a45a5e648984ba46574a22f20991f8f129c2c
I'll do some code cleanup before tagging.