Spaces:
Running
Running
update README
Browse files
README.md
CHANGED
@@ -8,4 +8,93 @@ pinned: false
|
|
8 |
license: mit
|
9 |
---
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
license: mit
|
9 |
---
|
10 |
|
11 |
+
# NPC Playground 🕹️🤖
|
12 |
+
|
13 |
+
<div align="center">
|
14 |
+
[![Discord][discord-badge]][discord]
|
15 |
+
|
16 |
+
3D playground to interact with LLM-powered NPCs. </br>
|
17 |
+
Modify the `world.lua` file to teach them new skills with a few lines of code.
|
18 |
+
|
19 |
+
<img width="1342" alt="cubzh_gigax_hf" src="https://github.com/soliton-x/ai-npc/assets/33256624/e62dd138-c018-4ecf-bc77-a072fadb5c12">
|
20 |
+
|
21 |
+
[Installation](#Installation)
|
22 |
+
[Customization](#Customization)
|
23 |
+
[Course](#Course)
|
24 |
+
[Credits](#Credits)
|
25 |
+
|
26 |
+
</div>
|
27 |
+
|
28 |
+
|
29 |
+
## Installation
|
30 |
+
|
31 |
+
1. Fork the project on [Hugging Face](https://huggingface.co/projects/ai-npc-world).
|
32 |
+
2. Modify the [`world.lua`](https://huggingface.co/spaces/cubzh/ai-npcs/blob/main/world.lua) file to edit NPC skills!
|
33 |
+
3. Deploy on your own Hugging Face space to run your modified version of the playground.
|
34 |
+
|
35 |
+
|
36 |
+
## Customization
|
37 |
+
|
38 |
+
### **Tweaking NPC Behavior**
|
39 |
+
Modify the fields defined in `world.lua`'s `NPCs` table in order to influence NPC behaviour:
|
40 |
+
```lua
|
41 |
+
local NPCs = {
|
42 |
+
{
|
43 |
+
name = "npcscientist",
|
44 |
+
physicalDescription = "A small sphere with a computer screen for a face",
|
45 |
+
psychologicalProfile = "Designed to be helpful to any human it interacts with, this robot viscerally hates squirrels.",
|
46 |
+
currentLocationName = "Scientist Island",
|
47 |
+
initialReflections = {
|
48 |
+
"This NPC is a robot that punctuates all of its answers with electronic noises - as any android would!",
|
49 |
+
...
|
50 |
+
},
|
51 |
+
},
|
52 |
+
...
|
53 |
+
}
|
54 |
+
```
|
55 |
+
|
56 |
+
### **Teaching NPCs new skills**
|
57 |
+
Our NPCs have been trained to use any skill you've defined before running the game. This is achieved by training the LLM powering them to do "function calling".
|
58 |
+
|
59 |
+
Modify `world.lua`'s `skills` table to give your NPCs new skills :
|
60 |
+
```lua
|
61 |
+
local skills = {
|
62 |
+
{
|
63 |
+
name = "SAY",
|
64 |
+
description = "Say smthg out loud",
|
65 |
+
parameter_types = {"character", "content"},
|
66 |
+
callback = function(client, action)
|
67 |
+
local npc = client:getNpc(action.character_id)
|
68 |
+
if not npc then print("Can't find npc") return end
|
69 |
+
dialog:create(action.content, npc.avatar)
|
70 |
+
print(string.format("%s: %s", npc.name, action.content))
|
71 |
+
end,
|
72 |
+
action_format_str = "{protagonist_name} said '{content}' to {target_name}"
|
73 |
+
},
|
74 |
+
...
|
75 |
+
}
|
76 |
+
```
|
77 |
+
The `callback` will be called whenever an NPC uses this skill, using the parameters defined in the `parameters` field. We've given you some examples in `skills.lua`, feel free to draw inspiration from them!
|
78 |
+
|
79 |
+
### [Work in progress] **Environment Design:**
|
80 |
+
The Cubzh game engine allows you to modify the 3D environment of your worlds, by importing community-generated voxel assets or creating new ones yourself. We're working hard to integrate these functionalities into this world - stay tuned!
|
81 |
+
|
82 |
+
## Course
|
83 |
+
|
84 |
+
Together with the HuggingFace staff, we've released a new course to teach you how to create your own Lua skills.
|
85 |
+
You can access it [here](https://huggingface.co/huggingface-ml-4-games-course)
|
86 |
+
|
87 |
+
## Credits
|
88 |
+
|
89 |
+
- [Hugging Face](https://huggingface.co/) 🤗
|
90 |
+
- [Gigax](https://github.com/GigaxGames)
|
91 |
+
- [Cubzh](https://cu.bzh): A versatile UGC (User-Generated Content) gaming platform.
|
92 |
+
- **You !** You're welcome to fork the repo, share your creations, and create PRs here :)
|
93 |
+
|
94 |
+
|
95 |
+
---
|
96 |
+
|
97 |
+
For detailed documentation, troubleshooting, and contributing guidelines, please refer to the [wiki](https://github.com/Cubzh/ai-npc-world/wiki).
|
98 |
+
|
99 |
+
[discord]: https://discord.gg/rRBSueTKXg
|
100 |
+
[discord-badge]: https://img.shields.io/discord/1090190447906934825?color=81A1C1&logo=discord&logoColor=white&style=flat-square
|