nobodywho

nobodywho

NobodyWho is a plugin that lets you interact with local LLMs in the Godot game engine, with more plugins in development.

Stars: 266

Visit
 screenshot

NobodyWho is a plugin for the Godot game engine that enables interaction with local LLMs for interactive storytelling. Users can install it from Godot editor or GitHub releases page, providing their own LLM in GGUF format. The plugin consists of `NobodyWhoModel` node for model file, `NobodyWhoChat` node for chat interaction, and `NobodyWhoEmbedding` node for generating embeddings. It offers a programming interface for sending text to LLM, receiving responses, and starting the LLM worker.

README:

Nobody Who

Discord Matrix Mastodon Godot Engine GitHub Sponsors Contributor Covenant

NobodyWho is a plugin that lets you interact with local LLMs in the Godot game engine, with more plugins in development.

At a Glance

  • πŸƒ Run LLM-driven characters locally without internet
  • ⚑ Super fast inference on GPU powered by Vulkan or Metal
  • πŸ”§ Easy setup - just two nodes to get started
  • 🎯 Perfect for games, interactive stories, and NPCs
  • πŸ’» Cross-platform: Windows, Linux, macOS
  • πŸ¦™ Powered by the wonderful llama.cpp

Demo video

Small demo of a use-case. This video was recorded in real time on a laptop, to give you an idea of performance.

The code for this showcase is in the demo-game folder of this repo. It amounts to about 100 lines of code in a single file, most of it being UI stuff.

How to Install

You can install it from inside the Godot editor: In Godot 4.3+, go to AssetLib and search for "NobodyWho".

...or you can grab a specific version from our github releases page. You can install these zip files by going to the "AssetLib" tab in Godot and selecting "Import".

Make sure that the ignore asset root option is set in the import dialogue.

How to Help

  • ⭐ Star the repo and spread the word about NobodyWho!
  • Join our Discord or Matrix communities
  • Found a bug? Open an issue!
  • Submit your own PR - contributions welcome
  • πŸ’ Become a sponsor to support development
  • Help improve docs or write tutorials

Getting started

The plugin does not include a large language model (LLM). You need to provide an LLM in the GGUF file format. A good place to start is something like Gemma 2 2B

Once you have a GGUF model file, you can add a NobodyWhoModel node to your Godot scene. On this node, set the model file to the GGUF model you just downloaded.

NobodyWhoModel contains the weights of the model. The model takes up a lot of RAM, and can take a little while to initialize, so if you plan on having several characters/conversations, it's a big advantage to point to the same NobodyWhoModel node.

Now you can add a NobodyWhoChat node to your scene. From the node inspector, set the "Model Node" field, to show this chat node where to find the NobodyWhoModel. Also in the inspector, you can provide a prompt, which gives the LLM instructions on how to carry out the chat.

Now you can add a script to the NobodyWhoChat node, to provide your chat interaction.

NobodyWhoChat uses this programming interface:

  • say(text: String): a function that can be used to send text from the user to the LLM.
  • response_updated(token: String): a signal that is emitted every time the LLM produces more text. Contains roughly one word per invocation.
  • response_finished(response: String): a signal which indicates that the LLM is done speaking.
  • start_worker(): a function that starts the LLM worker. The LLM needs a few seconds to get ready before chatting, so you may want to call this ahead of time.

Example NobodyWhoChat script

extends NobodyWhoChat

func _ready():
	# configure node
	model_node = get_node("../ChatModel")
	system_prompt = "You are an evil wizard. Always try to curse anyone who talks to you."

	# say something
	say("Hi there! Who are you?")

	# wait for the response
	var response = await response_finished
	print("Got response: " + response)

    # in this example we just use the `response_finished` signal to get the complete response
    # in real-world-use you definitely want to connect `response_updated`, which gives one word at a time
    # the whole interaction feels *much* smoother if you stream the response out word-by-word.

Example NobodyWhoEmbedding script

extends NobodyWhoEmbedding

func _ready():
    # configure node
    self.model_node = get_node("../EmbeddingModel")

    # generate some embeddings
    embed("The dragon is on the hill.")
    var dragon_hill_embd = await self.embedding_finished

    embed("The dragon is hungry for humans.")
    var dragon_hungry_embd = await self.embedding_finished

    embed("This doesn't matter.")
    var irrelevant_embd = await self.embedding_finished

    # test similarity,
    # here we show that two embeddings will have high similarity, if they mean similar things
    var low_similarity = cosine_similarity(irrelevant_embd, dragon_hill_embd)
    var high_similarity = cosine_similarity(dragon_hill_embd, dragon_hungry_embd) 
    assert(low_similarity < high_similarity)

Frequently Asked Questions

Once I export my Godot project, it can no longer find the model file.

Exports are a bit weird for now: Llama.cpp expects a path to a GGUF file on your filesystem, while Godot really wants to package everything in one big .pck file.

The solution (for now) is to manually copy your chosen GGUF file into the export directory (the folder with your exported game executable).

We're looking into solutions for including this file automatically.

Where do I find good models to use?

New language models are coming out at a breakneck pace. If you search the web for "best language models for roleplay" or something similar, you'll probably find results that are several months or years old. You want to use something newer.

We recommend checking leaderboards like The GPU-Poor LLM Gladiator Arena, or OpenRouter's Roleplay Rankings. Once you select a model, remember that you need a quantization of it in the GGUF format. The huggingface user bartowski regularly uploads GGUF quantizations for a lot of new models.

Selecting the best model for your usecase is mostly about finding the right tradeoff between speed, memory usage and quality of the responses. Using bigger models general will yield better responses, but raise minimum system requirements and slow down generation speed.

Can I export to HTML5, Android or iOS?

Currently only Linux, MacOS, and Windows are supported platforms.

Mobile exports seem very feasible. See issues #114, #66, and #67 for progress.

Web exports will be a bit trickier to get right. See issue #111.

Licensing

There has been some confusion about the licensing terms of this plugin. To clarify:

You are allowed to use this plugin in proprietary and commercial projects, free of charge.

If you distribute modified versions of the code in this repo, you must open source those changes.

Feel free to make proprietary games using NobodyWho, but don't make a proprietary fork of NobodyWho.

Featured Examples

  • Neophyte
    • Describe your actions and use the items you buy with your words to finish off the enemies.
  • The Merchant's Road
    • An LLM-driven text adventure where you guard a merchant in his travels.
  • Who Farted in the Eleveator?
    • LLM game where you talk to NPCs about farting in the elevator.
  • Procedural
    • A procedurally generated 2D shooter that takes place in an infinite dungeon.
  • The Black Box
    • Half Life inspired short story with a mysterious Black Box.
  • Ai rgument
    • A party game where you argue a position before an AI judge.
  • The World Will End in 60 Seconds!
    • What will you do before it’s all over?
  • Stonecot Prototype
    • Stonecot Prototype is a stripped-down, experimental build of Mythara Chronicles, showcasing AI-driven party interactions and a prototype main quest.
  • The Asteroid
    • A game where you can chat with the crew of a spacestation to figure out what happened in the accident.

For Tasks:

Click tags to check more tools for each tasks

For Jobs:

Alternative AI tools for nobodywho

Similar Open Source Tools

For similar tasks

For similar jobs