AQI AIAQI AI Intelligence
⌕
Official documentationPartially tested · see scope

Design local NPC dialogue for your Godot game

Download an original minimal Godot example: test mock NPC replies first, then opt into local Ollama separately.

Last checked: Version: 1.1.0

Model to check

A quick glossary

Models generate and reason. Agents use tools to work on tasks. A harness manages an agent’s environment. MCP connects tools and data. Skills are reusable task guidance.

Before you start

Prerequisites

Back up your game and create an empty exercise folder. Use official Godot 4 and a maintained Node.js version (syntax floor 22.12). The ZIP contains source only, no engine, model or installer. Read README and npc_client.gd; retain default Mock mode.

Model / service

Default Mock uses no model. Real mode needs an installed local Ollama model; verify license, memory, speed and quality separately.

Agent / runtime

No agent required: button-triggered, text-only HTTP client, without planning or action execution.

API key

Default mock needs no key/account; cloud keys are unsupported. Check authentication/cloud features of your own local service; never embed secrets in the client.

Estimated time

Learner time varies by environment; no measured duration is claimed.

Implementation steps

  1. Prepare an isolated practice folder and official tools

    Stage practice: Back up your game and create an empty exercise folder. Use official Godot 4 and a maintained Node.js version (syntax floor 22.12). The ZIP contains source only, no engine, model or installer. Read README and npc_client.gd; retain default Mock mode.

  2. Check the hash and extract without overwriting your game

    Stage practice: Compute SHA-256 of the ZIP and compare the full value above; use Get-FileHash on Windows or a trusted SHA-256 tool. Extract to a new folder: eight files, including project.godot, main.tscn, main.gd, npc_client.gd, mock-server.mjs, headless_check.gd, README.md and LICENSE.txt. Inspect before adapting your game.

  3. Run the mock service and Godot scene first

    Stage practice: Run node mock-server.mjs in the extracted folder and keep it open; it listens only on127.0.0.1:18080. Import project.godot in Godot, run it and enter a fictional question in the English UI. Ask should produce mock_ok and a fixed [MOCK - no model] reply. No Ollama, model, agent or key needed.

  4. Check failure and recovery deliberately

    Stage practice: Stop your mock server and ask again: expect fixed fallback with a usable interface. Restart to recover. Ask is disabled while waiting; Cancel must allow another request. Blank or over 512-character inputs are not sent. Responses are bounded to 64 KiB/1000 text characters with no redirects. Fallback is not a model answer.

  5. Opt into a real local model only after preparation

    Stage practice: Optional exercise; browsing this website needs no Ollama. Prepare and verify an installed local model and license, then set Ollama and its exact model_id in main.gd. In 1.1.0, ollama_timeout_seconds allows up to 120s for cold loading. Send a synthetic question, check model_reply, and use Cancel if needed. Avoid cloud models and embedded keys.

  6. Record acceptance before adapting your game

    Stage practice: Record engine, Node, runtime, model versions, backend and success/server-stop/timeout/cancel results. Text goes only to TextEdit, never commands, tools or NPC actions; no chat history. Client cancellation does not prove inference stopped. Multiplayer, Web/mobile exports and public hosting require separate auth, rate limits, content handling and platform tests.

Commands and examples

Partially tested · see scope

# In the extracted example directory; first run uses MOCK, no model.
node --version
node mock-server.mjs
# Leave this terminal open. Import project.godot in Godot and run the project.
# Optional real local model in main.gd, only after separate preparation:
# client.backend = "Ollama"
# client.model_id = "YOUR_EXACT_INSTALLED_LOCAL_MODEL_ID"
# Optional Ollama cold-load limit in example1.1.0: client.ollama_timeout_seconds = 120.0
# Website browsing does not require this optional local runtime.

Validation checks

Validation

Record engine, Node, runtime, model versions, backend and success/server-stop/timeout/cancel results. Text goes only to TextEdit, never commands, tools or NPC actions; no chat history. Client cancellation does not prove inference stopped. Multiplayer, Web/mobile exports and public hosting require separate auth, rate limits, content handling and platform tests.

Stop your mock server and ask again: expect fixed fallback with a usable interface. Restart to recover. Ask is disabled while waiting; Cancel must allow another request. Blank or over 512-character inputs are not sent. Responses are bounded to 64 KiB/1000 text characters with no redirects. Fallback is not a model answer.

Recorded test results

Windows x64: Godot 4.7.2, Ollama 0.34.4,qwen3:8b Q4_K_M passed 3 headless NPC replies, first from a cold runtime, and 1 native chat request; 16 mock HTTP checks also pass. Graphical interaction, exports, other OSs, full quality/speed and network isolation are untested. Partial test only.

Common problems

If node is missing, check official installation and terminal PATH. If 18080 is busy, inspect your own process without killing others. In real mode, check the exact installed ID; inspect cold start/logs before choosing a finite timeout. Cancel does not guarantee server inference stops.

Cost

Free software; check license and compute costs

Original example is free under MIT. Check Godot, Node, model licenses and existing hardware separately; model downloads, power or hosting may add costs. No service purchase required.

Limits & boundaries

An own-game development exercise, not an official NPC plugin or deployable multiplayer service. Use fictional questions. Loopback does not prove the machine/runtime is offline. Confirm your first real-model request separately.

Permissions & risks

No packaged official NPC plugin was verified; do not embed secrets, control unauthorized games or cheat.

Alternatives and next steps

Open-source alternatives may still require paid hardware or model calls.

Prefer public software on existing hardware; API, hardware, electricity and hosting are not guaranteed free.

Original sources

  1. Godot HTTPRequest official documentation ↗

    docs.godotengine.org · · Official documentation

  2. Godot · HTTPRequest ↗

    docs.godotengine.org · · Official documentation

  3. Ollama · native chat API ↗

    docs.ollama.com · · Official documentation

  4. Godot · official Windows download ↗

    godotengine.org · · Official documentation

  5. Node.js · official downloads ↗

    nodejs.org · · Official documentation

  6. Ollama · qwen3:8b ↗

    ollama.com · · Official documentation

  7. Ollama · show model details ↗

    docs.ollama.com · · Official documentation

  8. Ollama · get version ↗

    docs.ollama.com · · Official documentation

  9. Ollama FAQ · local-only ↗

    docs.ollama.com · · Official documentation

Connected resources

Local runtimeCost: Free software; check license and compute costs

Ollama

A local model runtime and API tool supporting a subset of OpenAI endpoints.

Official documentation
Integration platformCost: Free software; check license and compute costs

Unity ML-Agents

Unity’s official open-source ML toolkit for training and testing agents in games and simulations.

Official documentation
Integration platformCost: Free software; check license and compute costs

Godot HTTPRequest

Godot’s official HTTPRequest interface connects external services; AI integration needs custom implementation.

Official documentation
ModelCost: Free software; check license and compute costs

Qwen3-8B

Capacity estimate only; no automatic download or connection to your computer.

Official documentation