GameConfigIdea / app.py
kwabs22
Some changes and flie splitting
a69d738
raw
history blame
82.9 kB
import gradio as gr
import json
import textwrap
from gradio_client import Client
#Imported Long Variables - comment for each move to search
from relatively_constant_variables import *
from leveraging_machine_learning import *
from jsconfig_idea_support import *
from timeline_and_UI_generation_functions import *
from my_text_game_engine_attempt import *
from file_explorer_and_upload import *
from state_prompt_fileman_UI_functions import *
from ui_gr_media_management import *
LinPEWFprevious_messages = []
def LinPEWFformat_prompt(current_prompt, prev_messages):
formatted_prompt = textwrap.dedent("""
Previous prompts and responses:
{history}
Current prompt:
{current}
Please respond to the current prompt, taking into account the context from previous prompts and responses.
""").strip()
history = "\n\n".join(f"Prompt {i+1}: {msg}" for i, msg in enumerate(prev_messages))
return formatted_prompt.format(history=history, current=current_prompt)
#-----------------------------------------------------------------------------------------------------------------------------------
def TestGradioClientrandommodel(text):
try:
# client = Client("Qwen/Qwen2-72B-Instruct")
# result = client.predict(
# query=text, #"Hello!!",
# history=[],
# system="You are a helpful assistant.",
# api_name="/model_chat"
# )
client = Client("huggingface-projects/gemma-2-9b-it")
result = client.predict(
message=text, #"Hello!!",
max_new_tokens=1024,
temperature=0.6,
top_p=0.9,
top_k=50,
repetition_penalty=1.2,
api_name="/chat"
)
#print(result)
#print(result[1][0]) #All messages in the conversation
#print(result[2]) # System prompt
except Exception as e:
result = str(e)
return result #result[1][0][1] # If supporting conversations this needs to return the last message instead
#-----=------------------=--------------------=--------------------=----------------------=----
ConfigConversionforExporttoPlatformselector = gr.Dropdown(choices=["playcanvas", "unreal", "gamemaker", "flutter", "2d map related space", "existing game"])
def ConfigConversionforExporttoPlatform(platform, config):
FinalOutput = ""
FinalOutputExplanation = ""
if platform == "playcanvas":
FinalOutput = ""
FinalOutputExplanation = "as the config is for 1d? and the demo has teleport, the conversion to 3d is based location as backdrops for 2d interfaces to essentially use the config in the exact same way for now"
elif platform == "unreal":
FinalOutput = ""
FinalOutputExplanation = ""
elif platform == "gamemaker":
FinalOutput = ""
FinalOutputExplanation = ""
elif platform == "flutter":
FinalOutput = ""
FinalOutputExplanation = ""
elif platform == "2d map related space":
FinalOutput = ""
FinalOutputExplanation = ""
elif platform == "existing game":
FinalOutput = "Mods / Custom creator already in the game"
FinalOutputExplanation = ""
FinalOutput = ""
return FinalOutputExplanation, FinalOutput
#---------------------------------------
def find_and_visualize_json_errors(json_string):
error_positions = []
start = 0
while start < len(json_string):
try:
json.loads(json_string[start:])
break # If no error, we're done
except json.JSONDecodeError as e:
position = start + e.pos
if not error_positions or position > error_positions[-1] + 10:
error_positions.append(position)
start = position + 1
# Insert newlines at error positions
result = ""
last_pos = 0
for pos in error_positions:
result += json_string[last_pos:pos] + "\n"
last_pos = pos
result += json_string[last_pos:]
return result
def join_lines_after_correct_json_errors(lines, separator='\n'):
return separator.join(lines)
def testgroupingUIremotely():
with gr.Accordion("Mini-Tutorial for this space", open=False) as testui:
gr.HTML("https://huggingface.co/spaces/fffiloni/tts-hallo-talking-portrait, https://huggingface.co/spaces/fudan-generative-ai/hallo")
gr.HTML("Cant figure how to make a live version yet so will use video")
gr.HTML("Live portrait for the explanations and slide show / screen record for the tutorial (when UI is changed have to remake so need stable workflow / order independent video)")
gr.HTML("""<div style="width: 100%; text-align: center">Main End Goal is Rapid prototypes for education and training purposes eg. Degree of the future is game score with asecondary goal of boilerplate for context to plan stateful game mechanics (eg. power up or down in sunlight etc.) <br>A way to prototype basic non-3D parts of a game while trying to understand where models can streamline workflow - Doubles up a game developer quest giver (every decision point can be turned into minigame) <br>Game Studio 'Studio' = Config -- Assets -- Weak Playtest -- Port </div>""")
return testui
#-----------------------------------------------------------------------------------------------------------------------------------
with gr.Blocks() as demo:
testgroupingUIremotely()
ui_gr_media_management_acc()
with gr.Tab("Test"):
with gr.Accordion("New Config Errors", open=False):
gr.HTML("Currently the fastest option I know for config = https://huggingface.co/spaces/KwabsHug/SimpleGameConfigIdea | End goal is to use NLP to suggest points to base intertaction on so that text stories can be supported as input as well")
with gr.Row():
with gr.Column():
gr.Interface(find_and_visualize_json_errors, inputs=["text"], outputs=["text"], description="Splits the JSON where suppected errors are - Remove extra double quotes and non-pair symbols")
with gr.Column():
gr.Interface(join_lines_after_correct_json_errors, inputs=["text"], outputs=["text"], description="needs one line to load in the game section")
with gr.Row():
with gr.Column(scale=1):
NewConfErrorinput = gr.Textbox(label="Enter a new config here")
NewConfErrorinputbtn = gr.Button("Find Error")
NewConfErroroutput = gr.Code(language="json")
with gr.Column(scale=2):
NewConfErrorEditedSplitinput = gr.TextArea()
NewConfErrorEditedSplitinputbtn = gr.Button("Remove seperate lines after edit")
NewConfErrorinputbtn.click(find_and_visualize_json_errors, inputs=[NewConfErrorinput], outputs=[NewConfErrorEditedSplitinput])
NewConfErrorEditedSplitinputbtn.click(join_lines_after_correct_json_errors, inputs=[NewConfErrorEditedSplitinput], outputs=[NewConfErroroutput])
with gr.Accordion("My Previous Quick Config Attempts", open=False):
for experimetal_config_name, experimetal_config in ExampleGameConfigs.items():
with gr.Tab(experimetal_config_name):
gr.Code(json.dumps(experimetal_config, default=lambda o: o.__dict__, indent=2), label=experimetal_config_name) #str(experimetal_config)
with gr.Tab("Demo of 'Finished Product Example'"):
gr.HTML("Incomplete")
with gr.Tab("Original with media"):
with gr.Row():
with gr.Column(scale=2):
fpewadescription = gr.Textbox(label="Current Situation", lines=4, value=fpeinitgameinfo[0])
fpewamediabool = gr.State(value=True)
fpewamedia = gr.State([]) #"testmedia/Stable Audio - Raindrops, output.wav"])
@gr.render(inputs=fpewamedia)
def dynamic_with_media(media_items):
print(media_items)
with gr.Group() as fpewamediagrouping:
gr.HTML("Placeholder to load all media tests - still need to test clearing media on ")
if media_items == []:
gr.Markdown("No media items to display.")
else:
for item in media_items:
render = create_media_component(item)
return fpewamediagrouping
fpewagame_session = gr.State(value=fpeinitgameinfo[3])
with gr.Column(scale=1):
fpewachoices = gr.Radio(label="Your Choices", choices=fpeinitgameinfo[1])
fpewasubmit_btn = gr.Button("Make Choice")
fpewagame_log = gr.Textbox(label="Game Log", lines=20, value=fpeinitgameinfo[2])
fpewagme_restart = gr.Button('Restart Game')
fpewacustom_configstate = gr.State(value=json.dumps(finished_product_demo, default=lambda o: o.__dict__, indent=2))
#Placeholders
#fpewacustom_config = gr.State()
fpewaerror_box = gr.State()
fpewasubmit_btn.click(
make_choice,
inputs=[fpewachoices, fpewagame_session, fpewamediabool],
outputs=[fpewadescription, fpewachoices, fpewagame_log, fpewagame_session, fpewamedia]
)
fpewagme_restart.click(load_game, inputs=[fpewacustom_configstate, fpewamediabool], outputs=[fpewaerror_box, fpewagame_log, fpewadescription, fpewachoices, fpewacustom_configstate, fpewagame_session, fpewamedia])
with gr.Tab("After Extention / Enhancement Attempt"):
gr.HTML("")
with gr.Tab("Manual - Paste Config"):
gr.HTML("Placeholder as not complete yet (3D not supported, and time (esp need for audio)")
with gr.Row():
with gr.Column(scale=2):
gr.Markdown("# Text-based Adventure Game")
wamediabool = gr.State(value=True)
wamedia = gr.State(["testmedia/Stable Audio - Raindrops, output.wav"])
@gr.render(inputs=wamedia)
def dynamic_with_media(media_items):
print(media_items)
with gr.Group() as wamediagrouping:
gr.HTML("Placeholder to load all media tests - still need to test clearing media on ")
if media_items == []:
gr.Markdown("No media items to display.")
else:
for item in media_items:
render = create_media_component(item)
return wamediagrouping
wadescription = gr.Textbox(label="Current Situation", lines=4, value=initgameinfo[0])
wachoices = gr.Radio(label="Your Choices", choices=initgameinfo[1])
wasubmit_btn = gr.Button("Make Choice")
wagame_log = gr.Textbox(label="Game Log", lines=20, value=initgameinfo[2])
wagame_session = gr.State(value=initgameinfo[3])
wasubmit_btn.click(
make_choice,
inputs=[wachoices, wagame_session, wamediabool],
outputs=[wadescription, wachoices, wagame_log, wagame_session, wamedia]
)
with gr.Column(scale=1):
gr.Markdown("# Debugging")
waerror_box = gr.Textbox(label="Path Errors - Incomplete debug process", lines=4, value=path_errors)
with gr.Accordion("Config (Game Spoiler and Example for llm to remix)", open=False):
wacustom_config = gr.Textbox(label="Custom Configuration (JSON)", value=json.dumps(all_states, default=lambda o: o.__dict__, indent=2), lines=8)
wacustom_configbtn = gr.Button("Load Custom Config")
wacustom_configbtn.click(
load_game,
inputs=[wacustom_config, wamediabool],
outputs=[waerror_box, wagame_log, wadescription, wachoices, wacustom_config, wagame_session, wamedia]
)
with gr.Tab("Manual - With Asset generation and state change options"):
gr.HTML("Edit Complexity - Story Cohesion + Valid JSON formating + Correct branching to further match the story")
with gr.Row():
with gr.Column(scale=2):
gr.Markdown("# Text-based Adventure Game")
edwamediabool = gr.State(value=True)
edwamedia = gr.State(["testmedia/Stable Audio - Raindrops, output.wav"])
@gr.render(inputs=edwamedia)
def dynamic_with_media(media_items):
print(media_items)
with gr.Group() as edwamediagrouping:
gr.HTML("Placeholder to load all media tests - still need to test clearing media on ")
if media_items == []:
gr.Markdown("No media items to display.")
else:
for item in media_items:
render = create_media_component(item)
return edwamediagrouping
edwadescription = gr.Textbox(label="Current Situation", lines=4, value=initgameinfo[0])
edwachoices = gr.Radio(label="Your Choices", choices=initgameinfo[1])
edwasubmit_btn = gr.Button("Make Choice")
edwagame_log = gr.Textbox(label="Game Log", lines=20, value=initgameinfo[2])
edwagame_session = gr.State(value=initgameinfo[3])
edwasubmit_btn.click(
make_choice,
inputs=[edwachoices, edwagame_session, edwamediabool],
outputs=[edwadescription, edwachoices, edwagame_log, edwagame_session, edwamedia]
)
with gr.Column(scale=1):
gr.Markdown("# Debugging")
edwaerror_box = gr.Textbox(label="Path Errors - Incomplete debug process", lines=4, value=path_errors)
with gr.Accordion("Config - Game Spoiler - skip around here", open=False):
edwacustom_config = gr.Textbox(label="Custom Configuration (JSON)", value=json.dumps(all_states, default=lambda o: o.__dict__, indent=2), lines=8)
with gr.Row():
edwacustom_location = gr.Textbox(label="starting location")
edwacustom_start_state = gr.Textbox(label="starting state")
edwacustom_configbtn = gr.Button("Load Custom Config")
edwacustom_configbtn.click(
load_game_edit_version,
inputs=[edwacustom_config, edwamediabool, edwacustom_location, edwacustom_start_state],
outputs=[edwaerror_box, edwagame_log, edwadescription, edwachoices, edwacustom_config, edwagame_session, edwamedia]
)
gr.HTML("Export currently loaded config")
with gr.Row():
edexportstatus = gr.Textbox("", )
gr.Button(value="Export loaded Config").click(export_config_with_media, inputs=[edwacustom_config], outputs=[edexportstatus])
with gr.Accordion("Edit with Format Assist - Game Spoiler"):
@gr.render(inputs=edwacustom_config) #ewpgame_structure_output_text_with_media
def update(edwacustom_config):
return show_elements_json_input_play_and_edit_version(edwacustom_config)
with gr.Tab("Semi-Auto - Edit config while playing game"):
gr.HTML("-- Incomplete -- Current problem is passing values from rendered items to the config box <br>Need a way have dropdowns for the filelist and transitions eg. changing transitions must auto update choices <br>Config to components has hardcoded variables based on the auto gen so changes break it")
with gr.Column(scale=1):
gr.Markdown("# Debugging")
with gr.Row():
with gr.Column():
ewpwaerror_box = gr.Textbox(label="Path Errors - Incomplete debug process", lines=4, value=path_errors)
with gr.Accordion("Generate a new config"):
with gr.Accordion("Lists for config - only linear path for now", open=False):
gr.Markdown("# Story and Timeline Generator")
gr.Markdown("Click the button to generate a random timeline and story based on UI elements and story events. <br>Ask an LLM to use this to write a story around")
#with gr.Row():
#ewpgame_structure_output_text_with_media = gr.Code(language="json")
#ewpgame_structure_output_text = gr.Code(language="json")
with gr.Row():
ewptimeline_output_with_assets = gr.Textbox(label="Timeline with Assets Considered", lines=20)
#ewptimeline_output = gr.Textbox(label="Timeline (Order might be different for now)", lines=20)
with gr.Column():
ewptimeline_output_text = gr.Textbox(label="Random Suggestions", lines=10)
ewptimeline_selected_lists_text = gr.Textbox(label="Selected Idea Lists for Inspiration", lines=2)
ewpstory_output = gr.Textbox(label="Generated Story (Order might be different for now)", lines=20)
with gr.Row():
ewpgenerate_no_story_timeline_points = gr.Slider(minimum=1, value=10, step=1, maximum=30, label="Choose the amount of story timeline points")
ewpgenerate_no_ui_timeline_points = gr.Slider(minimum=1, value=10, step=1, maximum=30, label="Choose the amount of ui timeline points")
#ewpgenerate_no_media_timeline_points = gr.Slider(minimum=1, value=5, step=1, maximum=30, label="Choose the amount of media timeline points")
#ewpgenerate_with_media_check = gr.Checkbox(label="Generate with media", value=True)
with gr.Row():
ewptimeline_num_lists_slider = gr.Slider(minimum=1, maximum=len(all_idea_lists), step=1, label="Number of Lists to Consider", value=3)
ewptimeline_items_per_list_slider = gr.Slider(minimum=1, maximum=10, step=1, label="Items per List", value=3)
ewptimeline_include_existing_games = gr.Checkbox(label="Include Existing Game Inspirations", value=True)
ewptimeline_include_multiplayer = gr.Checkbox(label="Include Multiplayer Features", value=True)
ewpgenerate_button = gr.Button("Generate Story and Timeline")
ewpwacustom_config = gr.Textbox(label="Custom Configuration (JSON)", lines=4) #value=json.dumps(all_states, default=lambda o: o.__dict__, indent=2), lines=4) #Commented out due to initial load issues
ewpwacustom_configbtn = gr.Button("Load Custom Config")
with gr.Row():
with gr.Column(scale=1):
with gr.Group():
gr.Markdown("# Text-based Adventure Game")
ewpwadescription = gr.Textbox(label="Current Situation", lines=4, value=initgameinfo[0])
ewpwamediabool = gr.State(value=True)
ewpwamedia = gr.State(["testmedia/Stable Audio - Raindrops, output.wav"])
@gr.render(inputs=ewpwamedia)
def dynamic_with_media(media_items):
print(media_items)
with gr.Group() as ewpwamediagrouping:
gr.HTML("Placeholder to load all media tests - still need to test clearing media on ")
if media_items == []:
gr.Markdown("No media items to display.")
else:
for item in media_items:
render = create_media_component(item)
return ewpwamediagrouping
ewpwachoices = gr.Radio(label="Your Choices", choices=initgameinfo[1])
ewpwasubmit_btn = gr.Button("Make Choice")
ewpwagame_log = gr.Textbox(label="Game Log", lines=20, value=initgameinfo[2])
ewpwagame_session = gr.State(value=initgameinfo[3])
ewpwasubmit_btn.click(
make_choice,
inputs=[ewpwachoices, ewpwagame_session, ewpwamediabool],
outputs=[ewpwadescription, ewpwachoices, ewpwagame_log, ewpwagame_session, ewpwamedia]
)
ewpwacustom_configbtn.click(
load_game,
inputs=[ewpwacustom_config, ewpwamediabool],
outputs=[ewpwaerror_box, ewpwagame_log, ewpwadescription, ewpwachoices, ewpwacustom_config, ewpwagame_session, ewpwamedia]
)
with gr.Column(scale=1):
@gr.render(inputs=ewpwacustom_config) #ewpgame_structure_output_text_with_media
def update(ewpwacustom_config):
return show_elements_json_input(ewpwacustom_config)
ewpgenerate_button.click(generate_story_and_timeline, inputs=[ewpgenerate_no_story_timeline_points, ewpgenerate_no_ui_timeline_points, ewptimeline_num_lists_slider, ewptimeline_items_per_list_slider, ewptimeline_include_existing_games, ewptimeline_include_multiplayer], outputs=[ewptimeline_output_with_assets, ewpstory_output, ewpwacustom_config, ewptimeline_output_text, ewptimeline_selected_lists_text]) #ewptimeline_output_with_assets, ewptimeline_output, ewpstory_output, ewpwacustom_config, ewpgame_structure_output_text]) #ewpgame_structure_output_text_with_media, ewpgame_structure_output_text])
with gr.Tab("Config Development Assistance"): #, open=False):
gr.HTML("Jonas Tyroller (https://youtu.be/o5K0uqhxgsE)- This problem changes your perspective on game dev - minimise the cost of exploration so you can explore more (17:00) | dont make the same game again but worse (:) <br>How can we measure worse?")
gr.Markdown("# Current [Timeline] Workflow = [Precreation] Mermaid Diagram to (1) Story to (2) [Creation] Initial JSON (through LLM and fix JSON by hand) to (3) [Postcreation] JSON Corrections (through LLM and fix JSON by hand) to (4) Media prompts to (5) Asset Generation to (6) JSON Media field population")
with gr.Tab("Precreation"):
gr.Markdown()
gr.HTML("Need to learn how rules (our preferences) affect the config creation process <br>eg. core game loop - Write a story where the plot only moves based on - [insert core game loop]")
with gr.Tab("Main parts of stories to put into structures"):
with gr.Tab("Purpose (The types of decisions you want the user to make) (Main Theme)"):
gr.HTML("Unpredictable Nuances (Any movie) / Simulation (eg. Work - mixing rare industry crossover) (eg. A phrasebook into interactive game) / Time capsule / Tangible Metaphor / Song Concept as game / Advert as a game")
gr.HTML(" https://en.wikipedia.org/wiki/Philosophy https://en.wikipedia.org/wiki/Moral_injury")
with gr.Tab("Structure - (Non/)Linear Storylines"):
gr.HTML("Trying to abstract the process into one worflow is beyond me so multiple paths to goal (config) is the aim now")
with gr.Tab("Branching - Decisions / Timeline Creation to Story to Config Conversation"):
gr.HTML("Structures for interesting timeline progression")
gr.HTML("Claude Artifacts to illustrate nested structure brainstorms - <br> https://claude.site/artifacts/4a910d81-1541-49f4-8531-4f27fe56cd1e <br> https://claude.site/artifacts/265e9242-2093-46e1-9011-ed6ad938be90?fullscreen=false <br> ")
gr.HTML("Placeholder - Considerations - Story from the perspective of Main character or NPC in the LLM genereated story")
mermaideditoriframebtn = gr.Button("Load Mermaid Editor")
mermaideditoriframe = gr.HTML("")
mermaideditoriframebtn.click(fn=lambda x: "<iframe src='https://mermaid.live/' width='100%' height='1000px'></iframe>", outputs=mermaideditoriframe)
with gr.Accordion("Mermaid Structures - click to open", open=False):
for key, item in mermaidstorystructures.items():
with gr.Accordion(key, open=False):
gr.Code(item, label=key)
with gr.Tab("Linear - Player List to Empty Config with Edit support (Narrative based)"):
with gr.Accordion("Can copy in the Test Example State Machine tab - only linear path for now", open=False):
gr.Markdown("# Story and Timeline Generator")
gr.Markdown("Click the button to generate a random timeline and story based on UI elements and story events. <br>Ask an LLM to use this to write a story around")
with gr.Row():
game_structure_output_text_with_media = gr.Code(language="json")
#game_structure_output_text = gr.Code(language="json")
with gr.Accordion("JSON with no edits"):
gr.HTML("A long game is a bunch of short games")
with gr.Row():
timeline_output_with_assets = gr.Textbox(label="Timeline with Assets Considered (gaps = side quests)", lines=25)
#timeline_output = gr.Textbox(label="Timeline (Order might be different for now)", lines=20)
with gr.Column():
timeline_output_text = gr.Textbox(label="Random Suggestions", lines=10)
timeline_selected_lists_text = gr.Textbox(label="Selected Idea Lists for Inspiration", lines=2)
story_output = gr.Textbox(label="Generated Story (Order might be different for now)", lines=20)
with gr.Row():
generate_no_story_timeline_points = gr.Slider(minimum=1, value=10, step=1, maximum=30, label="Choose the amount of story timeline points")
generate_no_ui_timeline_points = gr.Slider(minimum=1, value=10, step=1, maximum=30, label="Choose the amount of ui timeline points")
#generate_no_media_timeline_points = gr.Slider(minimum=1, value=5, step=1, maximum=30, label="Choose the amount of media timeline points")
#generate_with_media_check = gr.Checkbox(label="Generate with media", value=True)
with gr.Row():
timeline_num_lists_slider = gr.Slider(minimum=1, maximum=len(all_idea_lists), step=1, label="Number of Lists to Consider", value=3)
timeline_items_per_list_slider = gr.Slider(minimum=1, maximum=10, step=1, label="Items per List", value=3)
timeline_include_existing_games = gr.Checkbox(label="Include Existing Game Inspirations", value=True)
timeline_include_multiplayer = gr.Checkbox(label="Include Multiplayer Features", value=True)
# timeline_generate_button = gr.Button("Generate Random Suggestions").click(
# timeline_get_random_suggestions,
# inputs=[timeline_num_lists_slider, timeline_items_per_list_slider, timeline_include_existing_games, timeline_include_multiplayer],
# outputs=[timeline_output_text, timeline_selected_lists_text]
# )
generate_button = gr.Button("Generate Story and Timeline (Click to get UI that will assist with JSON formatting)")
@gr.render(inputs=game_structure_output_text_with_media)
def update(game_structure_output_text_with_media):
return show_elements_json_input(game_structure_output_text_with_media)
generate_button.click(generate_story_and_timeline, inputs=[generate_no_story_timeline_points, generate_no_ui_timeline_points, timeline_num_lists_slider, timeline_items_per_list_slider, timeline_include_existing_games, timeline_include_multiplayer], outputs=[timeline_output_with_assets, story_output, game_structure_output_text_with_media, timeline_output_text, timeline_selected_lists_text]) #, generate_no_media_timeline_points, generate_with_media_check], outputs=[timeline_output_with_assets, timeline_output, story_output, game_structure_output_text_with_media, game_structure_output_text])
with gr.Tab("Linear - Existing Media eg. Songs and Screenshots"):
gr.HTML("Media position in the story part beginning, during or end")
gr.HTML("Create media first and then ask llm to make join points in the config. <br>For images need to add the location to every prompt or images will be in random lo")
with gr.Tab("Linear - Machine Leaning Architectures as game maps"):
gr.HTML("Transformers, SSMs, Image and Video Generation Architectures, GANs, RNNS, etc.")
with gr.Tab("Linear - Prompt Engineering as basis for ideation process"):
gr.HTML("Current Assited workflow idea - Story timeline events suggestions (LLM / Premade List) | Merging events with premade mermaid structures (LLM + Story Text + Mermaid Text) | Edit mermaid till satisfied (LLM + Story Text) | Ask LLM to convert to config (LLM + JSON Text) | Edit config (LLM / User with format assistance or not) | Playtest and go back to mermaaid or config if there are problems")
gr.HTML("Interactive movie (UI interaction or no progress) vs Branching Paths (Maze)")
gr.HTML("Things that can change the workflow - Asset First (Make Asset and make the transitions using LLM), Export First (Custom JS config, Playcanvas, Unreal Engine reverse engineered to this spaces config?) Game Mechanics First (eg. Player Stats, Inventory and NPCS not implemented yet, so traversal type games best aka graph like structures)")
gr.HTML("Config writing = Remix old one, Ask LLM to make one, Endless combination testing using the prompt engineering above or writing by hand (prompt engineering on yourself)")
gr.HTML("Can use song lyrics as thematic source")
gr.HTML("Placeholder for each below prompt getting a Textbox")
# for item in Storycraftprompts:
# input = gr.State(item)
# output = gr.Textbox("", label=item)
# outputbtn = gr.Button(item).click(fn=llmguide_generate_response, inputs=input, outputs=output)
# for i, item in enumerate(Storycraftprompts, 1):
# input = gr.State(item)
# previous_input = gr.State(lambda: LinPEWFprevious_messages)
# output = gr.Textbox("", label=f"Output {i}")
# def LinPEWF_update_and_generate(prompt, prev_msgs):
# prev_msgs.append(prompt)
# formatted_prompt = LinPEWFformat_prompt(prompt, prev_msgs)
# response = llmguide_generate_response(formatted_prompt)
# full_response = ""
# for chunk in response:
# full_response += chunk
# prev_msgs.append(f"Response: {full_response}")
# return full_response
# outputbtn = gr.Button(f"Generate {i}").click(
# fn=LinPEWF_update_and_generate,
# inputs=[input, previous_input],
# outputs=output
# )
# LinPEWFprevious_messages.append(item)
#with gr.Accordion("Decisions / Timeline Creation to Story to Config Conversation", open=False):
with gr.Tab("Branching - Network analysis to Game config"):
gr.HTML("Placeholder for analysing multiple stories for their network structures and creating general rules for a strucutre generator based of named entity recognition and bias to locations or people - The extreme long way")
with gr.Tab("Linear - Chess PNG to Game config"):
gr.HTML("Any Chess match can serve as end of game final battle")
with gr.Tab("Conflicts"):
gr.HTML("Most stories are based around")
with gr.Tab("Setting"):
gr.HTML("https://en.wikipedia.org/wiki/History#Periods")
gr.HTML("")
with gr.Tab("Locations"):
gr.HTML("Jungle, Sea, Desert, Snow, City, Village, Space")
with gr.Tab("Character Relations"):
gr.HTML("Friend or foe")
with gr.Tab("Character Archetypes"):
gr.HTML("")
with gr.Tab("Additional Themes"):
gr.HTML("")
with gr.Tab("Generalized Inspiration from existing games"):
gr.HTML("Consequences of buying into Hype quickly (I was going to find a way to fit 70B into zerogpu) - https://www.reddit.com/r/LocalLLaMA/comments/1fc98fu/confirmed_reflection_70bs_official_api_is_sonnet/")
with gr.Tab("Old Ideas to merge"):
gr.HTML("Random Scenario / Song to 'full game' manual or auto is end goal ")
gr.HTML("Componets (outside Code Support for Config): Decisions (and context explanation), Nested Sections, Media (Especially to affect decisions), Replayability (GTA and Tekken type mechanics in text form), Theme integration (Modified Varibles that affect UI or config order)")
gr.HTML("Existing Games eg. GTA Heists - Same Map with overlapping branching narratives, Battlefront - Elites amongst Commoners, Tekken Casino (one mistake = 1/2 or 1/3 of your Resources) and Turn based: 'Tactics' type nintendo games, Chess (and any other tile based game) ")
gr.HTML("Existing Game Rules for text - Cyberpunk RED, ")
gr.HTML("Community playthrough = Tally of players choices, Random item placed in a random location - first person to get it wins, Survival by location or characters met")
gr.HTML("Some Kinds of game skeletons ideas - Timelines, Graph as State machine paths, Economy ecosystem")
gr.HTML("One prompt to be used to test models - <br>Please make 10 python lists for the types of media files and their purposes in a game and then use those lists to random generate a timeline of 20 items when the function is called <br>Great next suggest ways to improve this function to create better timelines")
with gr.Tab("Structural Inspirations"):
gr.HTML("GTA Heists - Replayability and stakes, Tekken - 2/3 mistakes = lost round ")
gr.HTML("Elden Ring - Story telling by traversal of map")
gr.HTML("Sports Scores, ")
with gr.Tab("Worldbuilding tools"):
gr.HTML("Good wordbuilding makes new scenarios automatic")
gr.HTML("In a game awareness = directly affect one of the characters - Any time fights are involved, paralympics categorisations can be inspiration (watched paralympics and wanted to learn the categories eg. s10)")
with gr.Tab("Concept combination brainstorm"):
gr.HTML("The story and the gameplay dont have to occur at the same time - eg. ")
gr.Markdown("## Prompts / Mermaid diagrams to be made from the ideas for workflow")
with gr.Tab("Using Time as a proxy for all conepts?"):
gr.HTML("A timeline is the most important part of the story - once that is set you can do anything?")
with gr.Tab("Concept Bashing? Ideas"):
with gr.Row():
gr.Textbox(TimeRelatedConceptsForIdeaGeneration, lines=30)
gr.Textbox(Nonlinearprogressionideas, lines=30)
gr.Textbox(Adjectivebasedcombinationideatextsv2, lines=30)
gr.Textbox(Adjectivebasedcombinationideatexts, lines=30)
gr.HTML("Media Critiques (eg. Youtube Rants) as Prompts to whole games as interactive explanation")
with gr.Tab("Mermaid Diagram to (1) Story"):
gr.HTML("Below 70B seem to struggle here")
gr.Code(WFStage1prompt , label="Prompt Used")
with gr.Row():
gr.Textbox(TimeRelatedMermaidStoryAttempttoRefinefrom[0], lines=30)
gr.Textbox(TimeRelatedMermaidStoryAttempttoRefinefrom[1], lines=30)
gr.Textbox(TimeRelatedMermaidStoryAttempttoRefinefrom[2], lines=30)
gr.Textbox(TimeRelatedMermaidStoryAttempttoRefinefrom[3], lines=30)
gr.Textbox(TimeRelatedMermaidStoryAttempttoRefinefrom[4], lines=30)
with gr.Tab("Mermaid Diagrams"):
with gr.Accordion("Mermaid Structures - click to open", open=False):
for key, item in examplemermaidconceptblendingstrutures.items():
gr.Code(item, label=key)
with gr.Tab("HF datasets as scenario inspiration"):
gr.HTML("eg. https://huggingface.co/datasets/thesven/gsm8k-reasoning | https://huggingface.co/datasets/HuggingFaceFW/fineweb | HuggingFaceFW/fineweb-edu | https://huggingface.co/datasets/HuggingFaceFV/finevideo - https://huggingface.co/spaces/HuggingFaceFV/FineVideo-Explorer | even translations - https://huggingface.co/datasets/opencsg/chinese-fineweb-edu")
with gr.Tab("Creation"):
with gr.Tab("AI generates scaffolds"):
gr.HTML("8b size models make Format mistakes. For extention purposes this step specifically might have to be function call only if you explain the tool can take as many blocks as neccesary <br> Prompts without extra considerations")
with gr.Row():
gr.Code(WFStage2prompt , label="Prompt Used (working on 70B and above)")
gr.Code(WFStage2prompt2 , label="Alternate prompt to use (working on 70B and above)")
with gr.Row():
gr.HTML("The theme is waking up on the day AGI is created and how life will change")
gr.HTML("")
with gr.Tab("Extension ideas"):
gr.HTML("The basic idea is just make a new story and fight the JSON issues to make them fit and then rinse and repeat")
with gr.Tab("Follow-up prompts ideas"):
gr.HTML("Extension = any description in original JSON as the theme using the prompt template")
with gr.Tab("Change flow of existing config"):
gr.HTML("Ask for incorporation of mermaid structure into JSON or ask for how the mermaid structure would change the JSON / story")
with gr.Tab("Post-creation"):
gr.HTML("Assumed story is complete is complete at this stage / will be continued in seperate config")
with gr.Tab("Initial Media Generation"):
gr.HTML("Placeholder for verb extraction from description and choices - to help guide initial media population")
gr.HTML("To do a full test need media - Fast and quality - https://huggingface.co/spaces/black-forest-labs/FLUX.1-schnell")
with gr.Tab("Initial JSON (through LLM and fix JSON by hand) to (3) JSON Corrections (through LLM and fix JSON by hand)"):
gr.Code("Lets a critique this JSON to find areas fix", label="prompt used")
with gr.Tab("JSON Corrections (through LLM and fix JSON by hand) to (4) Media prompts"):
gr.HTML("This Step specifically has to be function call only")
gr.HTML("Gemma-9b and Mistral 8x7b is better at this prompt than llama 3.1 8b and 70b <br>Can add (each media field must get an entry) and (in python list of list format for plug and play) but they affect final output")
gr.Code("Lets a make a list for the prompts we will use to make media objects in this JSON. Make one for a person to interpret and one for direct media generators that focus on keywords: ", label="prompt used")
with gr.Tab("Media prompts to (5) Asset Generation to (6) JSON Media field population"):
gr.HTML("This Step specifically has to be function call only")
gr.Code("For each Media item described classify it by media type and comment if in a story setting it would need timing ", label="prompt used")
gr.HTML("This Step can be merged with the next if we can make a editor like in the semi-Auto space in test and edit tailored to just accepting the JSON and exposing only media part for editing")
gr.Code("Here is a list of file names - assume they are in the order of the empty media sections of the JSON and rewrite the JSON", label="prompt used")
with gr.Tab("Existing Config Crafting Progression"):
with gr.Accordion("Test config format assist - to merge with the one in the test area", open=False ):
gr.HTML("Placeholder for media field uploading / dropdowns for all files that have been uploaded")
gr.HTML("Splits by new line and is looking something like this 1: UI/Story/Media - content/type - Need to adjust it to current config format ")
input_text = gr.Textbox(label="Input Text", lines=10)
output_group = gr.Group()
@gr.render(inputs=input_text)
def update(text):
return show_elements(text)
# import originalconfigatbeinningofthisspace, claude3_5_06072024configtips, tipsupdatedconfigatbeinningofthisspace from relatively_constant_variables
with gr.Tab("Quick Ways to evaluate current config"):
gr.HTML("Ask SOTA LLMs This prompt: <br> This config is for a basic text based game engine. I dont have any structural metrics to assess the quality of the config. What JSON things can we look at to see if it may be too bland for a person testing the game? <br> Then Paste the Config with the prompt")
gr.HTML("""Original Claude 3.5 Sonnet Response snippets: <br>
Limited state variety: With only 13 states across 5 locations, the game might feel short and lacking in diversity. Consider adding more locations or states within existing locations.
Low average choices: An average of 1.92 choices per state might make the game feel linear. Increasing the number of choices in more states could improve player engagement.
Limited consequences: Only 3 states have consequences, which might make player choices feel less impactful. Adding more consequences could increase the sense of agency.
Short descriptions: The average description length of 13.15 words might not provide enough detail to immerse players. Consider expanding descriptions to create a richer narrative.
Lack of media: No states currently use media elements, which could make the game feel less engaging. Adding images, sound effects, or other media could enhance the player experience.
Limited narrative branching: While there are some loops and choices, the overall structure is relatively linear. Adding more branching paths could increase replayability and player interest.
To make the game less bland, consider:
Adding more states and locations
Increasing the number of choices in each state
Implementing more consequences for player actions
Expanding descriptions to create a richer narrative
Incorporating media elements
Creating more diverse paths through the game""")
with gr.Tab("Improvement of the default config"):
gr.HTML("Example of how to advance a game config with LLM - end goal is to have automatic worflow that takes these considerations into account <br> Things missing from the game engine - Economics and Basic Politics (NPC affiliation)")
gr.HTML("Suggestions from claude 3.5 on how to change config")
display_originalconfigatbeinningofthisspace = originalconfigatbeinningofthisspace.replace(' ', '&nbsp;').replace('\n', '<br>')
display_claude3_5_06072024configtips = claude3_5_06072024configtips.replace(' ', '&nbsp;').replace('\n', '<br>')
display_tipsupdatedconfigatbeinningofthisspace = tipsupdatedconfigatbeinningofthisspace.replace(' ', '&nbsp;').replace('\n', '<br>')
gr.HTML("""<div style="display: flex; justify-content: space-between; height: 900px; overflow: auto; ">
<div style="flex: 1; margin: 0 10px; padding: 20px;">
""" + display_originalconfigatbeinningofthisspace + """
</div>
<div style="flex: 1; margin: 0 10px; padding: 20px; width: 50%">
""" + display_claude3_5_06072024configtips + """
</div>
<div style="flex: 1; margin: 0 10px; padding: 20px;">
""" + display_tipsupdatedconfigatbeinningofthisspace + """
</div>
</div>""")
with gr.Tab("Leaveraging Machine Learning"): # , open=False):
gr.HTML("https://www.reddit.com/r/singularity/comments/1fhbipv/some_video_games_made_entirely_by_o1preview_and/")
gr.HTML("""<a href="https://artificialanalysis.ai/" target="_blank" rel="noopener noreferrer">Artificial Analysis</a>""")
with gr.Tab("Chat UIs - Free Tier"):
gr.HTML("""<a href="https://huggingface.co/chat" target="_blank" rel="noopener noreferrer">Hugging Face Chat</a>""")
gr.HTML("You can turn any space into a tool for huggingchat and the default image tool can do 5-10 secs per image - paste the current description and ask for images")
gr.HTML("Huggingface chat supports - State Management (Threads), Image Generation and editing, Websearch, Document parsing (PDF?), Assistants and larger models than zero gpu can support in July 2024 (Unquantised 30B and above)")
gr.HTML("ChatGPT is good for multiple images in one image - eg game maps and for this space all decisions in one picture")
gr.HTML("Gemini")
gr.HTML("Claude - Coding")
gr.HTML("Existing Assistants to use and planning custom assistants placeholder")
with gr.Tab("Leveraging ZeroGPU Attempt"):
gr.HTML("https://huggingface.co/posts/cbensimon/747180194960645 <br>https://github.com/NexaAI/Awesome-LLMs-on-device/ <br>13092024 - https://www.reddit.com/r/LocalLLaMA/comments/1fg3bin/6_months_out_of_date_what_has_changed/")
with gr.Accordion("Seperate interfaces I want to mix and space restraint management"):
gr.HTML("Text generation (RAG, Front End prompt engineering, Streaming output, Access to contextual generation accross the other interfaces) <br>Image generation (prompt only, context guided generation) <br> ")
gr.HTML("Tracking models to build with first to save money and privacy - https://github.com/NexaAI/Awesome-LLMs-on-device/, https://huggingface.co/gpt-omni/mini-omni https://www.reddit.com/r/LocalLLaMA/comments/1f84p1g/an_opensource_voicetovoice_llm_miniomni/, ")
model_name = gr.State(modelname)
gr.Markdown(f"# Language Model with RAG and Model Switching, and FLUX Integration")
gr.Markdown("This demo allows you to switch between different Qwen models and use Retrieval-Augmented Generation (RAG).")
gr.Markdown("**Note:** Model switching is intended for testing output quality. Due to GPU limitations, speed differences may not be apparent. Models requiring over 50GB to load will likely not work.")
gr.Markdown("Need to add support for switching models and loading GGUF and GPTQ and BNB")
gr.Markdown("57b MOE takes 6min to load and gets workload evicted - storage limit over 100G")
with gr.Tab("Text Generation"):
with gr.Row():
with gr.Column():
model_dropdown = gr.Dropdown(choices=modelnames, value=modelname, label="Select Model")
current_model_info = gr.Markdown(f"Current model: {modelname}")
current_model_info2 = gr.Interface(lambda x: f"Current model: {lastmodelnameinloadfunction[0]} ({lastmodelnameinloadfunction[1]}) (tokeniser = {lastmodelnameinloadfunction[2]})", inputs=None, outputs=["markdown"], description="Check what was last loaded (As the space has memory and I havent figured how spaces work enough eg. how does multiple users affect this)") # gr.Markdown(f"Current model: {lastmodelnameinloadfunction}")
gr.HTML("Need to figure out my test function calling for groq-8b as it doesnt seem to answer chat properly - will need a seperate space - eg. letter counting, plural couting, using a function as form for llm to fill (like choosing which model and input parameters for media in game)?")
prompt = gr.Textbox(lines=2, placeholder="Enter your prompt here...")
stream_checkbox = gr.Checkbox(label="Enable streaming")
rag_checkbox = gr.Checkbox(label="Enable RAG")
submit_button = gr.Button("Generate")
clear_models_button = gr.Button("Clear All Models")
loaded_models_button = gr.Button("Load Model List")
model_list_input = gr.Textbox(lines=2, placeholder="Enter model names separated by commas")
with gr.Column():
with gr.Tab("Current Response"):
output = gr.Textbox(lines=10, label="Generated Response")
tokens_per_second = gr.Textbox(label="Tokens per Second")
ram_usage = gr.Textbox(label="RAM Usage")
doc_references = gr.Textbox(label="Document References")
with gr.Tab("All Responses So far"):
gr.Markdown("As we want a iterative process all old responses are saved for now - will figure how to make per user solution -- need some kind of hook onto the loading a space to assign random usercount with timestamp")
gr.Interface(format_output_dict, inputs=None, outputs=["textbox"])
with gr.Tab("Image Generation"):
gr.HTML("Real Time Image Gen in this space is next aim like sd versions and https://huggingface.co/spaces/KingNish/Realtime-FLUX")
gr.Interface(generate_image, inputs=["text"], outputs=["text", "text", "image"], description="Current image")
#image_output = gr.Image(label="Generated Image (FLUX)")
model_dropdown.change(
model_change_handler,
inputs=[model_dropdown],
outputs=[model_name, current_model_info, output]
)
submit_button.click(
generate_response,
inputs=[prompt, rag_checkbox, stream_checkbox],
outputs=[output, tokens_per_second, ram_usage, doc_references],
)
clear_models_button.click(
clear_all_models,
inputs=[],
outputs=[output]
)
loaded_models_button.click(
loaded_model_list,
outputs=[output]
)
with gr.Tab("Preview APIs / Gradio Client"):
gr.HTML("July 2024 - Gemini, Cohere and Groq rate limit free APIs")
gr.HTML("https://modal.com/pricing ($30 a month?), https://fireworks.ai/pricing ($1 free trial), https://sambanova.ai/fast-api?api_ref=577164 (free rate limitied api - llama 405B 114 toks/s)")
gr.Interface(fn=TestGradioClientrandommodel, inputs="text", outputs="markdown", description="Single response test of gradio client - Gemma 2 9b for test as api, Use for testing like using a space and duplicate for heavy testing")
with gr.Tab("Everything Else"):
#with gr.Accordion("Game Customisation Tools", open=False):
with gr.Tab("Portability"):
with gr.Tab("Export"):
with gr.Row():
with gr.Column():
gr.Markdown("""# Suggestions from Llama 405b through Lambdachat
To create 2D and 3D versions of your 1D text-based game, you'll need to expand your game engine to support additional features. Here's a high-level overview of the steps you can follow:
1. For 2D (top-down traversal):
a. Create a grid-based system: Instead of just having a linear sequence of decisions, create a 2D grid that represents the game world. Each cell in the grid can represent a location in the game world, and the player can move between adjacent cells.
b. Implement movement: Allow the player to move in four directions (up, down, left, right) by updating their position on the grid. You can use input commands like "go north", "go south", "go east", and "go west".
c. Add obstacles and interactive objects: Place obstacles (e.g., walls, locked doors) and interactive objects (e.g., keys, items) on the grid. The player will need to navigate around obstacles and interact with objects to progress in the game.
d. Update game logic: Modify your game's logic to account for the player's position on the grid and any interactions with objects or NPCs.
2. For 3D:
a. Add a third dimension: Expand your 2D grid to a 3D grid by adding a new dimension (e.g., height). This will allow you to create multi-level environments with stairs, elevators, or other vertical traversal methods.
b. Implement movement in 3D: Extend your movement system to allow the player to move up and down in addition to the four cardinal directions. You can use input commands like "go up" and "go down".
c. Update game logic for 3D: Modify your game's logic to account for the player's position in 3D space, as well as any interactions with objects or NPCs that may occur at different heights.
d. Add 3D-specific features: Consider adding features that take advantage of the 3D environment, such as jumping, falling, or flying.
In both cases, you'll need to update your game's user interface to accommodate the additional dimensions. This may involve displaying a top-down view of the game world, rendering a 3D environment, or providing additional text descriptions to convey the player's surroundings.
Keep in mind that creating 2D and 3D games will require more complex programming and design compared to a 1D text-based game. You may need to learn new programming concepts and tools to achieve your goals.
# More ideas for expansion of '1d' ideas
Expanding a 1D text-based game into 2D and 3D versions can introduce various new gameplay elements and features. Here are 10 additional points for each expansion, assuming we can debug and code any idea we want:
2D Expansion:
1. Add a mini-map: Implement a mini-map feature that displays the player's current position and the surrounding area, making navigation more intuitive.
2. Introduce NPCs with movement: Create non-player characters (NPCs) that can move around the grid, adding life to the game world and offering new interaction opportunities.
3. Develop a dialogue system: Design a dialogue system that allows players to engage in conversations with NPCs, further enriching the game's narrative.
4. Implement a day-night cycle: Add a day-night cycle that affects gameplay, such as certain events or NPCs only being available during specific times.
5. Design puzzles: Create grid-based puzzles that players must solve to progress in the game, such as pushing blocks to activate switches or navigating mazes.
6. Add character customization: Allow players to customize their character's appearance and attributes, giving them a sense of ownership over their avatar.
7. Introduce a crafting system: Implement a crafting system that enables players to combine items found in the game world to create new, more powerful items.
8. Add weather effects: Introduce weather effects like rain, snow, or fog that can impact gameplay, such as reducing visibility or making certain areas inaccessible.
9. Create a quest system: Design a quest system with various objectives for players to complete, providing a sense of progression and purpose.
10. Develop a party system: Allow players to recruit NPCs to join their party, assisting them in combat and providing unique abilities.
3D Expansion:
1. Add camera controls: Implement camera controls that allow players to rotate and zoom their view of the 3D game world, providing greater flexibility in exploration.
2. Introduce platforming elements: Add platforming elements like jumping, climbing, and ledge-grabbing to enhance traversal in the 3D environment.
3. Develop a physics system: Create a physics system that governs object interactions, enabling realistic behaviors like collisions, gravity, and buoyancy.
4. Implement destructible environments: Design destructible environments that react to player actions, such as breaking walls or collapsing structures.
5. Add aerial gameplay: Introduce flying mounts or vehicles that allow players to explore the game world from the air, opening up new traversal possibilities.
6. Create underwater sections: Design underwater areas with unique gameplay mechanics, such as swimming, diving, and underwater combat.
7. Introduce mounted combat: Allow players to engage in combat while riding mounts, adding a new strategic layer to battles.
8. Develop a dynamic weather system: Create a dynamic weather system that affects gameplay in real-time, such as strong winds impacting movement or lightning strikes causing damage.
9. Implement a stealth system: Design a stealth system that enables players to avoid detection by enemies, using cover, distractions, and silent takedowns.
10. Add virtual reality support: Implement virtual reality support, allowing players to fully immerse themselves in the 3D game world using VR headsets and motion controls.
Remember that these ideas can be mixed and matched to create unique gameplay experiences tailored to your vision for the game.
# More ideas for '1d' game idea
1D text-based games have their own unique strengths and limitations. Here are some ideas that can be best explored or are exclusive to 1D text-based games:
1. Focus on narrative: 1D text-based games can focus primarily on storytelling, allowing for rich, branching narratives without the need for complex graphics or animations.
2. Emphasize imagination: With no visual elements, 1D text-based games rely on the player's imagination to visualize the game world, making the experience more personal and engaging.
3. Develop complex dialogue trees: In a 1D text-based game, you can create intricate dialogue trees with multiple choices and consequences, allowing for deep character interactions.
4. Create puzzles based on text manipulation: Design puzzles that involve manipulating or deciphering text, such as riddles, word scrambles, or cipher-based challenges.
5. Implement a text-based inventory system: Create an inventory system that relies on text descriptions of items, allowing players to use their imagination to determine how to use or combine objects.
6. Explore experimental storytelling techniques: 1D text-based games can experiment with unconventional narrative structures, such as non-linear storytelling, interactive fiction, or second-person narration.
7. Focus on resource management: Implement resource management mechanics that rely on text descriptions, such as managing a character's hunger, thirst, or fatigue levels.
8. Develop a text-based skill tree: Create a skill tree system that uses text descriptions to convey character progression and abilities, allowing players to make meaningful choices about their character's development.
9. Create a text-based AI companion: Design an AI companion that communicates with the player through text, offering guidance, hints, or engaging in conversations.
10. Emphasize accessibility: 1D text-based games can be more accessible to players with visual impairments, as they can be played using screen readers or other assistive technologies.
While some of these ideas can be adapted to 2D and 3D games, they are particularly well-suited for 1D text-based games, where the focus is on narrative, imagination, and text-driven gameplay.
""")
with gr.Column():
gr.HTML("Main idea for this tab is ways to reuse the config in same/different way in other platforms - Need a conversion management interface")
with gr.Accordion("Basic planning for conversions", open=False):
gr.HTML("MikeTheTech Tutorials (He has many more playlists so check the rest of his channel) - <br>playcanvas https://www.youtube.com/playlist?list=PLJKGfra8Jl0B845PNo9cMxAQfghJrYH1Y, <br>unreal engine - https://www.youtube.com/watch?v=STHdIdWO0tk&list=PLJKGfra8Jl0CSjCzk1r0peTp0orIleqdG, <br>gamemaker - https://www.youtube.com/watch?v=ka_fVrGMOwo&list=PLJKGfra8Jl0AW3rNuwcmi_aq_PdsjQtbu ")
gr.Interface(ConfigConversionforExporttoPlatform, inputs=[ConfigConversionforExporttoPlatformselector, "text"], outputs=["text", "code"], description="Helper for Exporting to other platforms")
gr.HTML("Reskinng and extending the Tutorials / smallest examples = fastest way to gain intuition for whats important")
gr.HTML("For 3D with regard to this space 3 is backdrop for the UI until major modifications are decided by the user")
with gr.Tab("Play Canvas"):
gr.HTML("Playcanvas Tutorials - https://developer.playcanvas.com/tutorials/webxr-hello-world/, Wow - https://developer.playcanvas.com/user-manual/assets/types/wasm/ <br>https://github.com/playcanvas/playcanvas.github.io - https://playcanvas.vercel.app/#/misc/hello-world ")
gr.HTML("https://youtu.be/a3pJiZ86XgA (Learn.Nimagin) - Youtube video showing user interface in playcanvas (My observation is you can have 3d items moving behind the interface like how 2d fighter use 3d space)")
gr.HTML("How can add 100 shapes in playcanvas very quickly? - Seems one at a time during editor phase")
gr.HTML("Each location is new scene?")
gr.HTML("Repurpose the ball deno - ball replaced with a custom 3D object <br> platform can used as map floor by changing dimensions, islands unlock = hidden platforms unhidden by a trigger (verticality as location access control) <br>Teleport can be loader for UI ")
gr.HTML("")
with gr.Tab("Unreal Engine"):
gr.HTML("Learning Centre - https://dev.epicgames.com/community/unreal-engine/learning")
gr.HTML("How can add 100 shapes in playcanvas very quickly? - Can run python scripts and possibly c++")
gr.HTML("")
gr.HTML("")
gr.HTML("")
with gr.Tab("Existing Game as game engine"):
gr.HTML("Unreal Engine for Fortnite https://dev.epicgames.com/community/fortnite/getting-started/uefn")
gr.HTML("https://www.reddit.com/r/singularity/comments/1fd4oo1/roblox_announces_ai_tool_for_generating_3d_game/ - roblox and genai")
gr.HTML("Modding Tools? eg. Skyrim, GTA, sims 4 custom scenarios")
gr.HTML("Other games as Iframes and MLM as the judge (visual confirmation) aka the quest completion algorithm")
with gr.Tab("In-browser / mobile IDE to Mobile (Mainly Android)"):
gr.Interface(fn=lambda inputtoconvert: inputtoconvert + " + placeholder code", inputs=["text"], outputs=["text"], description="placeholder code for conversion from JSON to basic text UI (eg. terminal = nested while loop + input + if in python)" )
gr.HTML("'Host' Dart app on github - create hyperlink like the page suggests: https://codewithandrea.com/tips/create-dartpad-from-github-gist/")
gr.HTML("https://docs.flutter.dev/ui, https://docs.flutter.dev/data-and-backend/state-mgmt/intro <br>https://developer.android.com/ai/aicore")
gr.HTML("Some ideas - https://github.com/divyanshub024/awesome-dart-pad, Dart Website - https://dart.dev/tools/dartpad")
gr.HTML("Flutter / Pydroid / Kivy / Colab")
gr.HTML("Flutter - Dartpad, Project IDX, Replit?")
with gr.Tab("Import"):
gr.HTML("Textbooks/Memes/Sayings/Songs/Books to Games. NLP as a way to guide the generation process")
with gr.Tab("Basic Game Engine Mechanics"):
gr.HTML("There is an issue with the loading of the choices above 4 - only 3 load max it seems")
gr.HTML("Placeholder for explanations of Player and Game Session")
with gr.Tab("Endless Commerce support"):
gr.HTML("Need to be able to support this type of code for upgrades - https://www.decisionproblem.com/paperclips/index2.html - https://www.reddit.com/r/incremental_games/comments/rc7ks7/the_unique_storytelling_of_universal_paperclips/ <br>https://huggingface.co/spaces/osanseviero/TheMLGame/blob/main/main.js")
with gr.Tab("Current '1D Engine' Defects"):
gr.HTML("To test the config idea I (with llm assistance) had to make an 'engine' that was based around the config - so there are many potholes ")
gr.HTML("All realtime events - Text still needs realtime as well")
with gr.Tab("Inventory and Skill Support"):
gr.HTML("Each decision affects Skills or inventory")
with gr.Tab("NPC Support"):
gr.HTML("Shared timeline that the player interfere with")
with gr.Tab("Economics Support"):
gr.HTML("Style Idea for a Basic Idea - Endless Economy (Tiny Tower as well) - Paperclip maximiser and inspirations - https://huggingface.co/spaces/osanseviero/TheMLGame")
with gr.Tab("Time Support"):
gr.HTML("No urgency / patience mechanics")
with gr.Tab("LLM play testing"):
gr.HTML("LLM can read the contents in full and give critiques but they can also play the game if you make a api interface - gradio allows this in the form of gradio client but you can also reroute the user inputs to function calling")
with gr.Tab("Custom JS Config Creator"):
gr.HTML("-- Incomplete -- Companion Space for zerogpu / client api workflow planning for a way to send a zip to the Basic Game Engine at the bottom of https://huggingface.co/spaces/KwabsHug/TestSvelteStatic (Also to test how much can be done majority on cpu)")
with gr.Tab("Simple Config Creator"):
inventory_items = gr.State([])
skills_items = gr.State([])
objectives_items = gr.State([])
targets_items = gr.State([])
with gr.Tabs():
with gr.TabItem("Inventory"):
inventory_type = gr.Textbox(label="Type")
inventory_name = gr.Textbox(label="Name")
inventory_description = gr.Textbox(label="Description")
add_inventory = gr.Button("Add Inventory Item")
inventory_textbox = gr.JSON(label="Inventory Items", value=[])
with gr.TabItem("Skills"):
skills_branch = gr.Textbox(label="Branch")
skills_name = gr.Textbox(label="Name")
skills_learned = gr.Dropdown(choices=["True", "False"], label="Learned")
add_skill_button = gr.Button("Add Skill")
skills_textbox = gr.JSON(label="Skills", value=[])
with gr.TabItem("Objectives"):
objectives_id = gr.Textbox(label="ID")
objectives_name = gr.Textbox(label="Name")
objectives_complete = gr.Dropdown(choices=["True", "False"], label="Complete")
add_objective_button = gr.Button("Add Objective")
objectives_textbox = gr.JSON(label="Objectives", value=[])
with gr.TabItem("Targets"):
targets_name = gr.Textbox(label="Name")
targets_x = gr.Textbox(label="X Coordinate")
targets_y = gr.Textbox(label="Y Coordinate")
targets_collisionType = gr.Textbox(label="Collision Type")
targets_collisiontext = gr.Textbox(label="Collision Text")
add_target_button = gr.Button("Add Target")
targets_textbox = gr.JSON(label="Targets", value=[])
with gr.TabItem("Placeholders for Modal Target"):
gr.HTML("Placeholder")
with gr.TabItem("Placeholders for State Machine Modal Target"):
gr.HTML("Placeholder")
with gr.TabItem("Placeholders for Background"):
gr.HTML("Placeholder")
config_output = gr.JSON(label="Updated Configuration")
@gr.render(inputs=[inventory_items, skills_items, objectives_items, targets_items]) #, outputs=config_output)
def aggregate_config(inventory, skills, objectives, targets):
config = default_config.copy()
config['inventory'] = inventory
config['skills'] = skills
config['objectives'] = objectives
config['targets'] = targets
return config
add_inventory.click(add_inventory_item, inputs=[inventory_items, inventory_type, inventory_name, inventory_description], outputs=inventory_textbox)
add_inventory.click(aggregate_config, inputs=[inventory_items, skills_items, objectives_items, targets_items], outputs=config_output)
add_skill_button.click(add_skill, inputs=[skills_items, skills_branch, skills_name, skills_learned], outputs=skills_textbox)
add_skill_button.click(aggregate_config, inputs=[inventory_items, skills_items, objectives_items, targets_items], outputs=config_output)
add_objective_button.click(add_objective, inputs=[objectives_items, objectives_id, objectives_name, objectives_complete], outputs=objectives_textbox)
add_objective_button.click(aggregate_config, inputs=[inventory_items, skills_items, objectives_items, targets_items], outputs=config_output)
add_target_button.click(add_target, inputs=[targets_items, targets_name, targets_x, targets_y, targets_collisionType, targets_collisiontext], outputs=targets_textbox)
add_target_button.click(aggregate_config, inputs=[inventory_items, skills_items, objectives_items, targets_items], outputs=config_output)
with gr.Tab("Advanced Config Creator"):
gr.HTML("Config with More than text and images")
with gr.Tab("Real World reach of the game"):
gr.HTML("3D printed trophies or game items as real items")
gr.HTML("Smart Watch and Phone - Notifications to watch and eg. character messages, authorisation requests, in game internet - Cloud computing / SBC or controller project ideas")
with gr.Tab("LLM/Robotics as custom controllers"):
gr.HTML("https://www.reddit.com/r/singularity/comments/1fm7fup/ihmc_and_boardwalk_robotics_show_their_humanoid/")
gr.HTML("Controls changed the scope of the game eg. mouse vs keyboard vs console controller vs remote vs touch screen <br>LLM can be vision/surveilance based controler (eg. MGS/GTA camera gauged by an actual camera in real life) or it can be a companion (offline/off console game progrssion ideas)")
gr.HTML("https://github.com/Shaka-Labs/ACT $250 imitation learning/teleoperation - eg. a win loss result alert / NPC 'scout' telling you go or stay")
gr.HTML("https://huggingface.co/posts/thomwolf/809364796644704")
gr.HTML("Robotics - https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-orin/ https://huggingface.co/lerobot https://github.com/tonyzhaozh/aloha https://github.com/Shaka-Labs/ACT https://github.com/OpenTeleVision/TeleVision https://www.stereolabs.com/ ")
gr.HTML("https://www.reddit.com/r/singularity/comments/1f88z58/the_first_ever_agent_civilization_1000_truly/")
with gr.Tab("Existing Game Developemnt Resources"):
gr.HTML("https://enginesdatabase.com/")
gr.HTML("https://develop.games/#nav-tools-engine ")
with gr.Tab("Other Considerations"):
with gr.Tab("General"):
gr.HTML("https://www.reddit.com/r/singularity/comments/1fiugew/wonderworld_a_novel_framework_for_interactive_3d/")
gr.HTML("https://huggingface.co/docs/hub/api - daily papers is an endpoint so you can turn paper abstract into games with the help of LLM")
gr.HTML("Experiment for https://huggingface.co/spaces/ysharma/open-interpreter/blob/main/app.py inplementation with gradio client api")
gr.HTML("https://huggingface.co/spaces/HuggingFaceTB/SmolLM-135M-Instruct-WebGPU")
gr.HTML("Useful Spaces and links: https://huggingface.co/spaces/artificialguybr/Stable-Audio-Open-Zero https://huggingface.co/spaces/stabilityai/TripoSR https://huggingface.co/spaces/wangfuyun/AnimateLCM-SVD https://huggingface.co/spaces/multimodalart/face-to-all https://huggingface.co/spaces/facebook/MusicGen https://huggingface.co/spaces/Doubiiu/tooncrafter")
gr.HTML("langchain docs as awareness for alot of the integration use cases and providers that are possible - https://python.langchain.com/v0.2/docs/integrations/tools/")
gr.HTML("https://huggingface.co/spaces/linoyts/scribble-sdxl-flash as map planner")
gr.HTML("---------------------------------------Gameplay Ideas-------------------------------")
gr.HTML("https://huggingface.co/spaces/Lin-Chen/ShareCaptioner-Video - game use example police questions a event with multiple eye witnesses needs to give as close to the caption description to win")
with gr.Tab("State management through huggingface?"):
gr.HTML("Huggingface as the login provider? - https://huggingface.co/spaces/Wauplin/gradio-user-history/tree/main https://huggingface.co/spaces/AP123/IllusionDiffusion https://huggingface.co/docs/hub/en/spaces-oauth https://huggingface.co/docs/hub/en/oauth, persistent storage - https://huggingface.co/docs/hub/en/spaces-storage")
with gr.Tab("Finetuning options"):
gr.HTML("https://docs.mistral.ai/guides/finetuning/ <br>https://openpipe.ai/blog/fine-tuning-best-practices-chapter-2-models")
gr.HTML("Unsloth and Colab? - https://github.com/unslothai/unsloth https://huggingface.co/unsloth <br>Mistral Nemo Base - https://huggingface.co/unsloth/Mistral-Nemo-Base-2407 - https://colab.research.google.com/drive/17d3U-CAIwzmbDRqbZ9NnpHxCkmXB6LZ0?usp=sharing <br>Llama 3 8B https://huggingface.co/unsloth/llama-3-8b-Instruct-bnb-4bit")
gr.HTML("Price - https://openpipe.ai/pricing")
with gr.Tab("Backend and/or Hosting?"):
gr.HTML("Deployemnt options - https://huggingface.co/SpacesExamples", "https://huggingface.co/templates")
gr.HTML("Prototyping and freemium <br>free api <br>HF Pro subscription")
gr.HTML("GPU (Data privacy) = No Rate limits? - https://replicate.com/pricing, https://lambdalabs.com/service/gpu-cloud https://huggingface.co/pricing#endpoints https://tensordock.com/cloud-gpus", "https://massedcompute.com/home/pricing/" )
gr.HTML("Speed - Groq, SambaNova, https://www.etched.com/announcing-etched ")
gr.HTML("Price - Coding - https://aider.chat/docs/leaderboards/ - https://www.deepseek.com/ 0.3 per million - is this per token or chinese character as that means converting code to chinese if possible can save api cost?")
gr.HTML("Llama 3.1 405B - https://ai.meta.com/blog/meta-llama-3-1/ https://replicate.com/meta/meta-llama-3.1-405b-instruct https://fireworks.ai/pricing https://www.ibm.com/products/watsonx-ai/foundation-models")
gr.HTML("Covered by Anythingllm - https://github.com/Mintplex-Labs/anything-llm : https://repocloud.io/details/?app_id=276, https://render.com/pricing, https://docs.railway.app/reference/pricing/free-trial, https://repocloud.io/pricing, https://elest.io/pricing ")
with gr.Tab("Some Interesting Git Repos"):
gr.HTML("https://github.com/NVIDIA/Megatron-LM https://github.com/OpenGVLab/EfficientQAT https://github.com/evintunador/minLlama3/blob/main/model.py https://github.com/evintunador/micro-GPT-sandbox")
with gr.Tab("Old Ideas"):
gr.HTML("""<div style="width: 100%; text-align: center">Main ideas for this space is (June 2024) (Custom component planning?):</div>
<div style="display: flex; justify-content: center; margin-bottom: 20px; align-items: center;">
<div style="width: 20%; text-align: center">We can generate almost any media data and more </div>
<div style="width: 20%; text-align: center">A program exist around data </div>
<div style="width: 20%; text-align: center">Time moves in a straight so all considerations are flattend by the nature of time </div>
<div style="width: 20%; text-align: center">llms good at short questions </div>
<div style="width: 20%; text-align: center">HF + Gradio allows for api use so this my prototype tool for tool use test</div>
</div>""")
with gr.Tab("Licensing"):
gr.HTML("Need to find the press release to see license eg. https://blackforestlabs.ai/announcing-black-forest-labs/")
with gr.Tabs("Links to go over when free"):
gr.HTML("https://www.reddit.com/r/singularity/comments/1ecuu8j/you_can_now_use_ai_for_3d_model_creation/ | ")
with gr.Tab("Asset loading test"):
gr.HTML("SDXL (linoyts/scribble-sdxl-flash), SVD and Stable Audio used for the test assets (For commercial use need a licence) <br>testmedia/")
with gr.Row():
gr.Image(value="testmedia/Flash scribble SDXL - random squiggles as roads.webp")
gr.Video(value="testmedia/SVD - random squiggles as roads video 004484.mp4")
gr.Audio(value="testmedia/Stable Audio - Raindrops, output.wav")
gr.HTML(TestmedialoadinHTML) # imported from relatively_constant_variables
demo.queue().launch()