From 0859bca2fd814998f3ab46ccd9d8e99fda6baee1 Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Sun, 19 May 2024 17:13:16 -0500 Subject: [PATCH] add weather system for outdoor rooms, fix logic paths --- adventure/render/prompt.py | 3 +- adventure/systems/rpg/__init__.py | 27 ++++++++++++ adventure/systems/rpg/weather_logic.yaml | 54 ++++++++++++++++++++++++ adventure/systems/sim/__init__.py | 10 ++--- 4 files changed, 88 insertions(+), 6 deletions(-) create mode 100644 adventure/systems/rpg/__init__.py create mode 100644 adventure/systems/rpg/weather_logic.yaml diff --git a/adventure/render/prompt.py b/adventure/render/prompt.py index e242651..be6bd07 100644 --- a/adventure/render/prompt.py +++ b/adventure/render/prompt.py @@ -160,7 +160,8 @@ def generate_prompt_from_scene(scene: str, example_prompts: List[str]) -> str: "Here are some example prompts:\n" "{examples}\n" "Reply with a comma-separated list of keywords that summarize the visual details of the scene." - "Make sure you describe the location, characters, and any items present. Be creative with the details." + "Make sure you describe the location, all of the characters, and any items present using keywords and phrases. " + "Be creative with the details. Avoid using proper nouns or character names. Describe any actions being taken. " "Do not include the question or any JSON. Only include the list of keywords on a single line.", examples=example_prompts, scene=scene, diff --git a/adventure/systems/rpg/__init__.py b/adventure/systems/rpg/__init__.py new file mode 100644 index 0000000..35aa6a8 --- /dev/null +++ b/adventure/systems/rpg/__init__.py @@ -0,0 +1,27 @@ +from .crafting_actions import action_craft +from .language_actions import action_read +from .magic_actions import action_cast +from .movement_actions import action_climb + +from adventure.logic import load_logic + +LOGIC_FILES = [ + "./adventure/systems/rpg/weather_logic.yaml", +] + + +def init_actions(): + return [ + # crafting + action_craft, + # language + action_read, + # magic + action_cast, + # movement + action_climb, + ] + + +def init_logic(): + return [load_logic(filename) for filename in LOGIC_FILES] diff --git a/adventure/systems/rpg/weather_logic.yaml b/adventure/systems/rpg/weather_logic.yaml new file mode 100644 index 0000000..21767c8 --- /dev/null +++ b/adventure/systems/rpg/weather_logic.yaml @@ -0,0 +1,54 @@ +rules: + # weather logic + - group: weather + match: + type: room + outdoor: true + weather: sunny + chance: 0.1 + set: + weather: cloudy + + - group: weather + match: + type: room + outdoor: true + weather: cloudy + chance: 0.1 + set: + weather: rainy + + - group: weather + match: + type: room + outdoor: true + weather: rainy + chance: 0.1 + set: + weather: sunny + + - group: weather + match: + type: room + outdoor: true + weather: cloudy + chance: 0.1 + set: + weather: sunny + +labels: + - match: + type: room + weather: sunny + backstory: The sun is shining brightly. + description: The sun is shining brightly. + - match: + type: room + weather: cloudy + backstory: The sky is overcast. + description: The sky is overcast. + - match: + type: room + weather: rainy + backstory: Rain is falling from the sky. + description: Rain is falling from the sky. diff --git a/adventure/systems/sim/__init__.py b/adventure/systems/sim/__init__.py index 33341bb..591602a 100644 --- a/adventure/systems/sim/__init__.py +++ b/adventure/systems/sim/__init__.py @@ -5,11 +5,11 @@ from .sleeping_actions import action_sleep from adventure.logic import load_logic LOGIC_FILES = [ - "./adventure/sim_systems/environment_logic.yaml", - "./adventure/sim_systems/hunger_logic.yaml", - "./adventure/sim_systems/hygiene_logic.yaml", - "./adventure/sim_systems/mood_logic.yaml", - "./adventure/sim_systems/sleeping_logic.yaml", + "./adventure/systems/sim/environment_logic.yaml", + "./adventure/systems/sim/hunger_logic.yaml", + "./adventure/systems/sim/hygiene_logic.yaml", + "./adventure/systems/sim/mood_logic.yaml", + "./adventure/systems/sim/sleeping_logic.yaml", ]