From cf5af8f4a3958ca1a6f0632899fc88986991649d Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Sat, 22 Jun 2024 18:50:38 -0500 Subject: [PATCH] set default actions and systems, fix more yaml extensions --- Dockerfile | 2 +- README.md | 52 ++++++++++--------- docs/guides/admin.md | 22 ++++---- taleweave/main.py | 10 ++++ .../systems/environment/weather/system.py | 3 +- taleweave/utils/world.py | 2 +- 6 files changed, 52 insertions(+), 39 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5389894..c62a9c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,6 @@ RUN pip install --no-cache-dir -r requirements/base.txt COPY taleweave/ /taleweave/taleweave/ COPY prompts/ /taleweave/prompts/ -COPY config.yml /taleweave/config.yml +COPY config.yaml /taleweave/config.yaml CMD ["python", "-m", "taleweave.main"] diff --git a/README.md b/README.md index 8b26b5a..7bbd0a3 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,20 @@ TaleWeave AI is an open-source game engine designed for creating rich, immersive ![TaleWeave AI logo with glowing sunrise over angular castle](https://docs-cdn.taleweave.ai/taleweave-github-1280.png) +TaleWeave AI is meant for gamers, developers, and researchers. It is a: + +- multiplayer text adventure +- Discord role-playing game +- emergent behavior laboratory +- life simulator +- survival game +- game engine +- world generator +- human-machine interface +- multi-user dungeon +- cross-platform gaming experience +- behavioral experiment + ## Contents - [TaleWeave AI](#taleweave-ai) @@ -22,20 +36,6 @@ TaleWeave AI is an open-source game engine designed for creating rich, immersive ## Features -TaleWeave AI is meant for gamers, developers, and researchers. It is a: - -- multiplayer text adventure -- Discord role-playing game -- emergent behavior laboratory -- life simulator -- survival game -- game engine -- world generator -- human-machine interface -- multi-user dungeon -- cross-platform gaming experience -- behavioral experiment - TaleWeave AI does a few things out of the box: - Generate a world from a brief text prompt @@ -47,24 +47,26 @@ TaleWeave AI does a few things out of the box: TaleWeave AI can: -- Be modified in almost every way - everything is a plugin, including the planning and action stages that drive the simulation -- Be run locally - does not require any cloud services, but does play nicely with them +- Be modified in almost every way - everything is a plugin, including the planning and action stages that drive the + simulation +- Run locally - does not require any cloud services, but does play nicely with them - Connect to your data - game systems can fetch data for RAG, making responses richer and more consistent - Export training data - for analysis, visualization, and fine tuning of character models -- Plug in to your workflow - run the simulation step by step in Jupyter notebooks using the TaleWeave AI engine as a Python library -- Connect to your server and vice versa - the Discord bot is a plugin and can be replaced with your favorite chat platform +- Plug in to your training workflow - run the simulation step by step in Jupyter notebooks using the TaleWeave AI engine + as a Python library +- Chat with you anywhere - the Discord bot is a plugin and can be replaced with your favorite chat platform ### Game Actions TaleWeave AI has in-game actions for: -| Core | Life Sim | RPG | -| ------------ | --------------- | --------- | -| Planning | Hunger & Thirst | Combat | -| Conversation | Hygiene | Crafting | -| Movement | Sleeping | Magic | -| Exploration | | Movement* | -| | | Writing | +| Core | Life Sim | RPG | +| ------------ | ----------------- | --------- | +| Planning | Cooking | Combat | +| Conversation | Eating & Drinking | Crafting | +| Movement | Sleeping | Magic | +| Exploration | Washing | Movement* | +| | | Writing | 1. The core exploration actions provide ways for characters to expand the world by finding new rooms and items. 2. The RPG movement actions provide additional situational movement like crawling, climbing, and jumping. diff --git a/docs/guides/admin.md b/docs/guides/admin.md index a69c8e0..9924b5b 100644 --- a/docs/guides/admin.md +++ b/docs/guides/admin.md @@ -303,7 +303,7 @@ DISCORD_TOKEN=YOUR_TOKEN ### Configure the Discord bot -Copy the `config.yml` file to a file named `custom_config.yml` and edit the `bot` section to use your desired +Copy the `config.yaml` file to a file named `custom_config.yaml` and edit the `bot` section to use your desired parameters for the Discord bot. Make sure the list of `channels` includes one or more valid channels in the servers to which you invited the bot. By default, this is a channel named `taleweave`. @@ -323,7 +323,7 @@ The `name_*` fields are used by the bot to refer to itself in messages. _Note:_ This step is _required_ if you are using the `--render` or `--render-generated` command-line arguments. If you launched ComfyUI, do this step too. -In your `custom_config.yml`, edit the `render` section to use your desired parameters for image generation. Make sure +In your `custom_config.yaml`, edit the `render` section to use your desired parameters for image generation. Make sure the `checkpoints` are valid file names in your checkpoints folder. If you provide more than one checkpoint, one will be randomly selected for each batch of images. Adjust the `sizes` as needed to match the checkpoint and control your memory usage. @@ -356,7 +356,7 @@ render: _Note:_ You only need to do this step if you want to change the host or port where the websocket server will listen. -In your `custom_config.yml`, edit the `server` section to change the host and port where the websocket server will +In your `custom_config.yaml`, edit the `server` section to change the host and port where the websocket server will listen for connections: ```yaml @@ -373,7 +373,7 @@ front of the websocket server. _Note:_ You only need to do this step if you want to change the size of the world during generation. -In your `custom_config.yml`, edit the `world` section to change the size of the rooms and character inventory while +In your `custom_config.yaml`, edit the `world` section to change the size of the rooms and character inventory while generating the world. ```yaml @@ -432,7 +432,7 @@ world: The world prompt has two parts: the main theme and the secondary flavor text used by the dungeon master and world builder to make a more unique and interesting world. -Some world templates are provided in the [`taleweave/prompts.yml` file](../../taleweave/prompts.yml), which you can +Some world templates are provided in the [`taleweave/worlds.yaml` file](../../taleweave/worlds.yaml), which you can use to get started, or create your own prompt and generate a unique world. Example world templates include: @@ -468,10 +468,10 @@ server: ```bash # Start the TaleWeave AI engine python3 -m taleweave.main \ - --config config.yml \ - --prompts prompts/llama-base.yml prompts/llama-quest.yml prompts/discord-en-us.yml \ + --config config.yaml \ + --prompts prompts/llama-*.yaml prompts/discord-en-us.yaml \ --world worlds/outback-animals-1 \ - --world-template ./worlds.yml:outback-animals \ + --world-template ./worlds.yaml:outback-animals \ --discord \ --render \ --render-generated \ @@ -479,8 +479,8 @@ python3 -m taleweave.main \ --rooms 3 \ --turns 30 \ --optional-actions \ - --actions taleweave.systems.sim:init_actions \ - --systems taleweave.systems.sim:init_logic + --actions taleweave.actions.core taleweave.actions.optional taleweave.systems.sim:init_actions \ + --systems taleweave.systems.core taleweave.systems.sim:init_logic ``` This will generate a relatively small world with 3 rooms or areas, run for 30 steps, then save the game and shut down. @@ -490,7 +490,7 @@ another file named `worlds/outback-animals-1.state.json`. The world can be stopp although the step in progress will be lost. The saved state can be resumed and played for any number of additional steps by running the server again with the same arguments. -> Note: `module.name:function_name` and `path/filename.yml:key` are patterns you will see repeated throughout TaleWeave AI. +> Note: `module.name:function_name` and `path/filename.yaml:key` are patterns you will see repeated throughout TaleWeave AI. > They indicate a Python module and function within it, or a data file and key within it, respectively. The optional actions are actions that allow characters to explore and expand the world during the game, diff --git a/taleweave/main.py b/taleweave/main.py index 6fe6f28..b4261ae 100644 --- a/taleweave/main.py +++ b/taleweave/main.py @@ -113,18 +113,28 @@ def parse_args(): type=str, nargs="*", help="Extra actions to include in the simulation", + default=[ + "taleweave.actions.core", + ], ) parser.add_argument( "--prompts", type=str, nargs="*", help="The file to load game prompts from", + default=[ + "prompts/discord-en-us.yaml", + "prompts/llama-*.yaml", + ], ) parser.add_argument( "--systems", type=str, nargs="*", help="Extra systems to run in the simulation", + default=[ + "taleweave.systems.core", + ], ) # generation arguments diff --git a/taleweave/systems/environment/weather/system.py b/taleweave/systems/environment/weather/system.py index bd389c3..b7a6f74 100644 --- a/taleweave/systems/environment/weather/system.py +++ b/taleweave/systems/environment/weather/system.py @@ -1,5 +1,6 @@ from functools import partial from logging import getLogger +from os import path from typing import List from packit.agent import Agent @@ -17,7 +18,7 @@ logger = getLogger(__name__) LOGIC_FILES = [ - "./taleweave/systems/environment/weather/logic.yaml", + path.join(".", "taleweave", "systems", "environment", "weather", "logic.yaml"), ] diff --git a/taleweave/utils/world.py b/taleweave/utils/world.py index 944130a..7bb764d 100644 --- a/taleweave/utils/world.py +++ b/taleweave/utils/world.py @@ -33,7 +33,7 @@ def describe_character( def describe_static(entity: WorldEntity) -> str: attribute_descriptions = format_attributes(entity) logger.info( - "describing entity: %s, attributes: '%s'", + "describing entity: %s, attributes: %s", entity.name, attribute_descriptions, )