File size: 7,912 Bytes
f27460e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c6fa314
 
d8cee44
73be982
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c6fa314
 
 
 
 
 
 
 
 
73be982
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c6fa314
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73be982
c6fa314
 
 
 
 
 
 
 
 
 
 
f27460e
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
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")
    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")
    with gr.Tab("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("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")
            gr.HTML("")

        with gr.Tab("Save files"):
            gr.HTML("")

        with gr.Tab("Images"):
            gr.HTML("")
            gr.HTML("Images =  https://huggingface.co/spaces/microsoft/Promptist ")
        
        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>")
            gr.HTML("Placeholder for huggingface spaces that can assist")

        with gr.Tab("Video"):
            gr.HTML("")

        with gr.Tab("3D"):
            gr.HTML("")

        with gr.Tab("Animations"):
            gr.HTML("")

        with gr.Tab("Fonts"):
            gr.HTML("")
        
        with gr.Tab("Shaders and related"):
            gr.HTML("")

        
    with gr.Tab("Other Considerations"):
        with gr.Tab("General"):
            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, ")

demo.launch()