GameConfigIdea / app.py
kwabs22
Adding some links
b19b854
raw
history blame
12.2 kB
import gradio as gr
# Default configuration template
default_config = {
'background': '/AutoGameBackgrounds/1stGameLoc123.png',
'inventory': [],
'skills': [],
'objectives': [],
'targets': [],
'story': [],
'actions': {}
}
# Helper functions to dynamically add items
def add_inventory_item(inventory_items, type, name, description):
new_item = {"type": type, "name": name, "description": description}
inventory_items.append(new_item)
return inventory_items
def add_skill(skills_items, branch, name, learned):
new_skill = {"branch": branch, "name": name, "learned": learned == 'True'}
skills_items.append(new_skill)
return skills_items
def add_objective(objectives_items, id, name, complete):
new_objective = {"id": id, "name": name, "complete": complete == 'True'}
objectives_items.append(new_objective)
return objectives_items
def add_target(targets_items, name, x, y, collisionType, collisiontext):
new_target = {"name": name, "x": int(x), "y": int(y), "collisionType": collisionType, "collisiontext": collisiontext}
targets_items.append(new_target)
return targets_items
with gr.Blocks() as demo:
gr.HTML("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)")
gr.HTML("Main ideas for this space is: <br>A program exist around data <br>We can generate almost any media data and more <br>llms good at short questions <br>Time moves in a straight so all considerations are flattend by the nature of time <br>HF + Gradio allows for api use so this my prototype tool for tool use test")
with gr.Tab("Config Creator"):
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("")
with gr.Tab("Skeleton and Asset Generation"):
gr.HTML("With some ideas from gemini-1.5-flash-api-0514 and reka-flash-preview-20240611")
with gr.Tab("Skeleton Generator"):
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("Save files"):
gr.HTML("For Dynamic events overnight or when player is not active what can LLMS edit? <br><br>eg. Waiting for a letter from a random npc can be decided by the llm <br>eg. Improved Stats on certain days (eg. bitrthday) <br>Privacy <br>User Directed DLC eg. Rockstar Editor with local llm guide")
gr.HTML("Placeholder for huggingface spaces that can assist ")
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist (9b and under) <br>initial floor for testing can be https://huggingface.co/spaces/Qwen/Qwen2-0.5B-Instruct, https://huggingface.co/spaces/Qwen/Qwen2-1.5b-instruct-demo, https://huggingface.co/spaces/stabilityai/stablelm-2-1_6b-zephyr, https://huggingface.co/spaces/IndexTeam/Index-1.9B, ")
with gr.Tab("Images"):
gr.HTML("Concept Art, UI elements, Static/3D Characters, Environments and Objects")
gr.HTML("Image Caption = https://huggingface.co/spaces/microsoft/Promptist, https://huggingface.co/spaces/gokaygokay/SD3-Long-Captioner, https://huggingface.co/spaces/gokaygokay/Florence-2, ")
gr.HTML("Images Generation Portraits = https://huggingface.co/spaces/okaris/omni-zero")
gr.HTML("Images Generation General = ")
gr.HTML("Images Generation Posters with text - https://huggingface.co/spaces/GlyphByT5/Glyph-SDXL-v2")
gr.HTML("Placeholder for huggingface spaces that can assist <br> https://huggingface.co/spaces/gokaygokay/Florence-2 <br>")
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist")
with gr.Tab("Audio"):
gr.HTML("Music - Background, Interactive, Cutscene, Menu <br>Sound Effects - Environment, character, action (environmental triggered by user eg. gun), UI <br>Speech - Dialouge, narration, voiceover <br>The new render function means the Config can be made and iframe/api functions can be ordered as neccessary based on the part of the config that needs it to streamline workflows based on current state of config ")
gr.HTML("Placeholder for huggingface spaces that can assist")
gr.HTML("Audio Sound Effects - https://huggingface.co/spaces/artificialguybr/Stable-Audio-Open-Zero")
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist")
with gr.Tab("Video"):
gr.HTML("Cutscenes, Tutorials, Trailers")
gr.HTML("Placeholder for huggingface spaces that can assist")
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist")
with gr.Tab("3D"):
gr.HTML("Characters, Environments, Objects")
gr.HTML("Placeholder for huggingface spaces that can assist")
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist")
with gr.Tab("Animations (for lower resource use)"):
gr.HTML("Characters, Environments, Objects")
gr.HTML("Placeholder for huggingface spaces that can assist")
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist")
with gr.Tab("Fonts"):
gr.HTML("Style of whole game, or locations, or characters")
gr.HTML("Placeholder for huggingface spaces that can assist")
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist")
with gr.Tab("Shaders and related"):
gr.HTML("Post-processing Effects, material effects, Particle systems, visual feedback")
gr.HTML("Visual Effects - eg. explosion can turn all items white for a moment, losing conciousness blurs whole screen")
gr.HTML("Placeholder for huggingface spaces that can assist")
gr.HTML("Placeholder for models small enough to run on cpu here in this space that can assist")
with gr.Tab("Other Considerations"):
with gr.Tab("General"):
gr.HTML("Experiment for https://huggingface.co/spaces/ysharma/open-interpreter/blob/main/app.py inplementation with gradio client api")
gr.HTML("Some conderations for future integration: https://huggingface.co/spaces/dylanebert/3d-arena, https://github.com/fudan-generative-vision/hallo")
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("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("Backend and/or Hosting?"):
gr.HTML("Prototyping and freemium <br>free api <br>HF Pro subscription")
gr.HTML("GPU (Data privacy) = No Rate limits? - https://lambdalabs.com/service/gpu-cloud https://huggingface.co/pricing#endpoints")
gr.HTML("Speed - Groq, SambaNova, ")
gr.HTML("Price - Coding - https://www.deepseek.com/ 0.3 per million")
demo.launch()