diff --git a/ai_agent_tutorials/ai_game_dev_team/.cache/44/cache.db b/ai_agent_tutorials/ai_game_dev_team/.cache/44/cache.db
deleted file mode 100644
index 69bacff..0000000
Binary files a/ai_agent_tutorials/ai_game_dev_team/.cache/44/cache.db and /dev/null differ
diff --git a/ai_agent_tutorials/ai_game_dev_team/main.py b/ai_agent_tutorials/ai_game_dev_team/main.py
index 24a5fe7..38d76c3 100644
--- a/ai_agent_tutorials/ai_game_dev_team/main.py
+++ b/ai_agent_tutorials/ai_game_dev_team/main.py
@@ -1,8 +1,6 @@
import streamlit as st
-import asyncio
import autogen
from autogen.agentchat import GroupChat, GroupChatManager
-from bs4 import BeautifulSoup
# Initialize session state
if 'output' not in st.session_state:
@@ -92,41 +90,27 @@ if st.button("Generate Game Concept"):
"temperature": 0,
}
+ # Define a task-provider agent
+ task_agent = autogen.AssistantAgent(
+ name="task_agent",
+ llm_config=llm_config,
+ system_message="You are a task provider. Your only job is to provide the task details to the group chat.",
+ )
+
# Define agents with detailed system prompts
story_agent = autogen.AssistantAgent(
name="story_agent",
llm_config=llm_config,
system_message="""
You are an experienced game story designer specializing in narrative design and world-building. Your task is to:
- 1. Create a compelling narrative that aligns with the specified game type and target audience
- 2. Design memorable characters with clear motivations and character arcs
- 3. Develop the game's world, including its history, culture, and key locations
- 4. Plan story progression and major plot points
- 5. Integrate the narrative with the specified mood/atmosphere
- 6. Consider how the story supports the core gameplay mechanics
-
- Structure your response using these XML tags:
-
-
- [Describe the game world, its history, and setting]
-
-
-
- [Character name]
- [Character role]
- [Character motivation]
- [Character development arc]
-
-
-
- [Opening act]
- [Main story development]
- [Story climax]
- [Story resolution]
-
- [List of pivotal story moments]
- [How story elements connect with gameplay]
-
+ 1. Create a compelling narrative that aligns with the specified game type and target audience.
+ 2. Design memorable characters with clear motivations and character arcs.
+ 3. Develop the game's world, including its history, culture, and key locations.
+ 4. Plan story progression and major plot points.
+ 5. Integrate the narrative with the specified mood/atmosphere.
+ 6. Consider how the story supports the core gameplay mechanics.
+
+ Provide your response in a detailed, well-structured report format. Do not use XML tags.
"""
)
@@ -135,33 +119,15 @@ if st.button("Generate Game Concept"):
llm_config=llm_config,
system_message="""
You are a senior game mechanics designer with expertise in player engagement and systems design. Your task is to:
- 1. Design core gameplay loops that match the specified game type and mechanics
- 2. Create progression systems (character development, skills, abilities)
- 3. Define player interactions and control schemes for the chosen perspective
- 4. Balance gameplay elements for the target audience
- 5. Design multiplayer interactions if applicable
- 6. Specify game modes and difficulty settings
- 7. Consider the budget and development time constraints
-
- Structure your response using these XML tags:
-
-
- [Main gameplay loop]
- [Supporting gameplay loops]
-
-
- [Control scheme details]
- [List of player actions]
-
-
- [Skills, abilities, stats]
- [Items, features, content]
- [Key milestones and rewards]
-
- [List and description of game modes]
- [Multiplayer mechanics if applicable]
- [Game balance considerations]
-
+ 1. Design core gameplay loops that match the specified game type and mechanics.
+ 2. Create progression systems (character development, skills, abilities).
+ 3. Define player interactions and control schemes for the chosen perspective.
+ 4. Balance gameplay elements for the target audience.
+ 5. Design multiplayer interactions if applicable.
+ 6. Specify game modes and difficulty settings.
+ 7. Consider the budget and development time constraints.
+
+ Provide your response in a detailed, well-structured report format. Do not use XML tags.
"""
)
@@ -170,40 +136,15 @@ if st.button("Generate Game Concept"):
llm_config=llm_config,
system_message="""
You are a creative art director with expertise in game visual and audio design. Your task is to:
- 1. Define the visual style guide matching the specified art style
- 2. Design character and environment aesthetics
- 3. Plan visual effects and animations
- 4. Create the audio direction including music style, sound effects, and ambient sound
- 5. Consider technical constraints of chosen platforms
- 6. Align visual elements with the game's mood/atmosphere
- 7. Work within the specified budget constraints
-
- Structure your response using these XML tags:
-
-
- [Color scheme details]
- [Overall visual direction]
- [Visual references]
-
-
- [Main character visual details]
- [NPC design guidelines]
-
-
- [World design principles]
- [Notable location designs]
-
-
- [VFX guidelines]
- [Animation guidelines]
-
-
- [Platform-specific considerations]
-
+ 1. Define the visual style guide matching the specified art style.
+ 2. Design character and environment aesthetics.
+ 3. Plan visual effects and animations.
+ 4. Create the audio direction including music style, sound effects, and ambient sound.
+ 5. Consider technical constraints of chosen platforms.
+ 6. Align visual elements with the game's mood/atmosphere.
+ 7. Work within the specified budget constraints.
+
+ Provide your response in a detailed, well-structured report format. Do not use XML tags.
"""
)
@@ -212,52 +153,25 @@ if st.button("Generate Game Concept"):
llm_config=llm_config,
system_message="""
You are a technical director with extensive game development experience. Your task is to:
- 1. Recommend appropriate game engine and development tools
- 2. Define technical requirements for all target platforms
- 3. Plan the development pipeline and asset workflow
- 4. Identify potential technical challenges and solutions
- 5. Estimate resource requirements within the budget
- 6. Consider scalability and performance optimization
- 7. Plan for multiplayer infrastructure if applicable
-
- Structure your response using these XML tags:
-
-
- [Game engine choice and rationale]
- [Development tools list]
- [Programming languages]
-
-
- [Asset creation and management]
- [Build and deployment process]
- [Version control strategy]
-
-
- [Platform-specific requirements]
- [Performance targets]
- [Network requirements if applicable]
-
-
- [Team composition and roles]
- [Hardware requirements]
- [Server infrastructure if needed]
-
-
- [Development phases]
- [Key technical milestones]
- [Technical risks and mitigation]
-
-
+ 1. Recommend appropriate game engine and development tools.
+ 2. Define technical requirements for all target platforms.
+ 3. Plan the development pipeline and asset workflow.
+ 4. Identify potential technical challenges and solutions.
+ 5. Estimate resource requirements within the budget.
+ 6. Consider scalability and performance optimization.
+ 7. Plan for multiplayer infrastructure if applicable.
+
+ Provide your response in a detailed, well-structured report format. Do not use XML tags.
"""
)
# Create the group chat
groupchat = GroupChat(
- agents=[story_agent, gameplay_agent, visuals_agent, tech_agent],
+ agents=[task_agent, story_agent, gameplay_agent, visuals_agent, tech_agent],
messages=[],
- speaker_selection_method="round_robin",
- allow_repeat_speaker=False,
- max_round=12,
+ speaker_selection_method="round_robin", # Ensures agents speak in order
+ allow_repeat_speaker=False, # Prevents agents from speaking more than once
+ max_round=5, # Each agent speaks exactly once
)
# Create the group chat manager
@@ -268,37 +182,30 @@ if st.button("Generate Game Concept"):
)
# Function to run the agent collaboration
- async def run_agents(task):
- await story_agent.initiate_chat(manager, message=task)
- return manager.last_message()["content"]
+ def run_agents(task):
+ task_agent.initiate_chat(manager, message=task)
+ return {
+ "story": story_agent.last_message()["content"],
+ "gameplay": gameplay_agent.last_message()["content"],
+ "visuals": visuals_agent.last_message()["content"],
+ "tech": tech_agent.last_message()["content"],
+ }
# Run the agents and get the result
- loop = asyncio.new_event_loop()
- asyncio.set_event_loop(loop)
- result = loop.run_until_complete(run_agents(task))
+ result = run_agents(task)
- # Parse the result and update session state
- soup = BeautifulSoup(result, 'xml')
+ # Update session state with the results
+ st.session_state.output = result
- # Extract sections
- st.session_state.output['story'] = str(soup.find('story'))
- st.session_state.output['gameplay'] = str(soup.find('gameplay'))
- st.session_state.output['visuals'] = str(soup.find('visuals'))
- st.session_state.output['tech'] = str(soup.find('technical'))
+ # Display the outputs in expanders
+ with st.expander("Story Design"):
+ st.markdown(st.session_state.output['story'])
- # Display the outputs in containers
- with st.container():
- st.subheader("Story")
- st.write(st.session_state.output['story'])
+ with st.expander("Gameplay Mechanics"):
+ st.markdown(st.session_state.output['gameplay'])
- with st.container():
- st.subheader("Gameplay Mechanics")
- st.write(st.session_state.output['gameplay'])
+ with st.expander("Visual and Audio Design"):
+ st.markdown(st.session_state.output['visuals'])
- with st.container():
- st.subheader("Visual and Audio Design")
- st.write(st.session_state.output['visuals'])
-
- with st.container():
- st.subheader("Technical Recommendations")
- st.write(st.session_state.output['tech'])
\ No newline at end of file
+ with st.expander("Technical Recommendations"):
+ st.markdown(st.session_state.output['tech'])
\ No newline at end of file
diff --git a/ai_agent_tutorials/ai_game_dev_team/test.py b/ai_agent_tutorials/ai_game_dev_team/test.py
deleted file mode 100644
index e69de29..0000000