Skip to content

Commit

Permalink
set default actions and systems, fix more yaml extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Jun 22, 2024
1 parent d76bcf0 commit cf5af8f
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
52 changes: 27 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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.
Expand Down
22 changes: 11 additions & 11 deletions docs/guides/admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -468,19 +468,19 @@ 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 \
--server \
--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.
Expand All @@ -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,
Expand Down
10 changes: 10 additions & 0 deletions taleweave/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion taleweave/systems/environment/weather/system.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -17,7 +18,7 @@


LOGIC_FILES = [
"./taleweave/systems/environment/weather/logic.yaml",
path.join(".", "taleweave", "systems", "environment", "weather", "logic.yaml"),
]


Expand Down
2 changes: 1 addition & 1 deletion taleweave/utils/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down

0 comments on commit cf5af8f

Please sign in to comment.