udpate game conditions
Browse files- server/api/routes/chat.py +3 -3
- server/core/constants.py +1 -1
- server/core/game_logic.py +0 -1
- server/core/prompts/text_prompts.py +0 -4
- server/scripts/test_game.py +3 -2
server/api/routes/chat.py
CHANGED
@@ -3,7 +3,7 @@ from typing import Optional
|
|
3 |
import traceback
|
4 |
|
5 |
from core.session_manager import SessionManager
|
6 |
-
from core.
|
7 |
from api.models import ChatMessage, StoryResponse, Choice
|
8 |
|
9 |
router = APIRouter()
|
@@ -38,10 +38,10 @@ def get_chat_router(session_manager: SessionManager, story_generator):
|
|
38 |
game_state.radiation_level += llm_response.radiation_increase
|
39 |
|
40 |
# Check for radiation death
|
41 |
-
is_death = game_state.radiation_level >= MAX_RADIATION
|
42 |
if is_death:
|
43 |
llm_response.choices = []
|
44 |
-
llm_response.story_text += "\
|
45 |
if len(llm_response.image_prompts) > 1:
|
46 |
llm_response.image_prompts = [llm_response.image_prompts[0]]
|
47 |
|
|
|
3 |
import traceback
|
4 |
|
5 |
from core.session_manager import SessionManager
|
6 |
+
from core.constants import GameConfig
|
7 |
from api.models import ChatMessage, StoryResponse, Choice
|
8 |
|
9 |
router = APIRouter()
|
|
|
38 |
game_state.radiation_level += llm_response.radiation_increase
|
39 |
|
40 |
# Check for radiation death
|
41 |
+
is_death = game_state.radiation_level >= GameConfig.MAX_RADIATION
|
42 |
if is_death:
|
43 |
llm_response.choices = []
|
44 |
+
llm_response.story_text += "\You have succumbed to the harsh wastelands, and your journey concludes here. THE END."
|
45 |
if len(llm_response.image_prompts) > 1:
|
46 |
llm_response.image_prompts = [llm_response.image_prompts[0]]
|
47 |
|
server/core/constants.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
class GameConfig:
|
2 |
# Game state constants
|
3 |
-
MAX_RADIATION =
|
4 |
STARTING_TIME = "18:00"
|
5 |
STARTING_LOCATION = "Outskirts of New Haven"
|
6 |
|
|
|
1 |
class GameConfig:
|
2 |
# Game state constants
|
3 |
+
MAX_RADIATION = 12
|
4 |
STARTING_TIME = "18:00"
|
5 |
STARTING_LOCATION = "Outskirts of New Haven"
|
6 |
|
server/core/game_logic.py
CHANGED
@@ -14,7 +14,6 @@ from api.models import StoryTextResponse, StoryPromptsResponse, StoryMetadataRes
|
|
14 |
from core.story_generators import TextGenerator, ImagePromptsGenerator, MetadataGenerator
|
15 |
|
16 |
# Game constants
|
17 |
-
MAX_RADIATION = 4
|
18 |
STARTING_TIME = "18:00" # Game starts at sunset
|
19 |
STARTING_LOCATION = "Outskirts of New Haven"
|
20 |
|
|
|
14 |
from core.story_generators import TextGenerator, ImagePromptsGenerator, MetadataGenerator
|
15 |
|
16 |
# Game constants
|
|
|
17 |
STARTING_TIME = "18:00" # Game starts at sunset
|
18 |
STARTING_LOCATION = "Outskirts of New Haven"
|
19 |
|
server/core/prompts/text_prompts.py
CHANGED
@@ -8,11 +8,8 @@ ALWAYS write in English, never use any other language.
|
|
8 |
|
9 |
CRITICAL LENGTH RULE:
|
10 |
- The story text MUST be NO MORE than 15 words
|
11 |
-
- This is a HARD limit, never exceed 15 words
|
12 |
- Count your words carefully before returning the text
|
13 |
- Be concise while keeping the story impactful
|
14 |
-
- Never tell that you are using 15 words or any reference to it
|
15 |
-
- No (15) or (15 words) or (15 words limit) or (15 words limit) or (15 words limit) or (15 words limit)
|
16 |
|
17 |
{STORY_RULES}
|
18 |
|
@@ -25,7 +22,6 @@ IMPORTANT RULES FOR STORY TEXT:
|
|
25 |
- DO NOT include any dialogue asking for decisions
|
26 |
- Focus purely on describing what is happening in the current scene
|
27 |
- Keep the text concise and impactful
|
28 |
-
- REMEMBER: Maximum 15 words, no exceptions
|
29 |
- Never tell that you are using 15 words or any reference to it
|
30 |
|
31 |
IMPORTANT RULES FOR STORY ENDINGS:
|
|
|
8 |
|
9 |
CRITICAL LENGTH RULE:
|
10 |
- The story text MUST be NO MORE than 15 words
|
|
|
11 |
- Count your words carefully before returning the text
|
12 |
- Be concise while keeping the story impactful
|
|
|
|
|
13 |
|
14 |
{STORY_RULES}
|
15 |
|
|
|
22 |
- DO NOT include any dialogue asking for decisions
|
23 |
- Focus purely on describing what is happening in the current scene
|
24 |
- Keep the text concise and impactful
|
|
|
25 |
- Never tell that you are using 15 words or any reference to it
|
26 |
|
27 |
IMPORTANT RULES FOR STORY ENDINGS:
|
server/scripts/test_game.py
CHANGED
@@ -11,6 +11,7 @@ server_dir = Path(__file__).parent.parent
|
|
11 |
sys.path.append(str(server_dir))
|
12 |
|
13 |
from core.game_logic import GameState, StoryGenerator
|
|
|
14 |
|
15 |
# Load environment variables
|
16 |
load_dotenv()
|
@@ -26,7 +27,7 @@ def print_separator(char="=", length=50):
|
|
26 |
def print_story_step(step_number, radiation_level, story_text, image_prompts, generation_time: float, story_history: str = None, show_context: bool = False, model_name: str = None, is_death: bool = False, is_victory: bool = False):
|
27 |
print_separator("=")
|
28 |
print(f"📖 STEP {step_number}")
|
29 |
-
print(f"☢️ Radiation level: {radiation_level}/
|
30 |
print(f"⏱️ Generation time: {generation_time:.2f}s (model: {model_name})")
|
31 |
print(f"💀 Death: {is_death}")
|
32 |
print(f"🏆 Victory: {is_victory}")
|
@@ -101,7 +102,7 @@ async def play_game(show_context: bool = False):
|
|
101 |
)
|
102 |
|
103 |
# Check for radiation death
|
104 |
-
if game_state.radiation_level >=
|
105 |
print("\n☢️ GAME OVER - Death by radiation ☢️")
|
106 |
print("Sarah has succumbed to the toxic radiation...")
|
107 |
break
|
|
|
11 |
sys.path.append(str(server_dir))
|
12 |
|
13 |
from core.game_logic import GameState, StoryGenerator
|
14 |
+
from core.constants import GameConfig
|
15 |
|
16 |
# Load environment variables
|
17 |
load_dotenv()
|
|
|
27 |
def print_story_step(step_number, radiation_level, story_text, image_prompts, generation_time: float, story_history: str = None, show_context: bool = False, model_name: str = None, is_death: bool = False, is_victory: bool = False):
|
28 |
print_separator("=")
|
29 |
print(f"📖 STEP {step_number}")
|
30 |
+
print(f"☢️ Radiation level: {radiation_level}/{GameConfig.MAX_RADIATION}")
|
31 |
print(f"⏱️ Generation time: {generation_time:.2f}s (model: {model_name})")
|
32 |
print(f"💀 Death: {is_death}")
|
33 |
print(f"🏆 Victory: {is_victory}")
|
|
|
102 |
)
|
103 |
|
104 |
# Check for radiation death
|
105 |
+
if game_state.radiation_level >= GameConfig.MAX_RADIATION:
|
106 |
print("\n☢️ GAME OVER - Death by radiation ☢️")
|
107 |
print("Sarah has succumbed to the toxic radiation...")
|
108 |
break
|