LOADING...

Growing your garden...

Local LLM NPC

Private, On-Device Educational NPCs Powered by Gemma 3n and Godot 4
View on GitHub

The Challenge

Educational access remains limited in regions with poor connectivity, while privacy concerns grow around cloud-based AI systems. Traditional learning platforms require constant internet access and compromise user data privacy.

Privacy Concerns

Cloud AI sends user data to external servers, raising security issues

Offline Learning

Internet dependency prevents access in low-connectivity regions

Internet Dependency

Traditional educational games require constant online connectivity

Resource Constraints

Edge devices like Jetson Orin Nano need optimized AI solutions

Our Solution

  • 🤖 On-Device AI
    Gemma 3n runs entirely on your device
  • 📴 Offline-First
    No internet required for core features
  • 🔐 Privacy-Preserving
    Your data never leaves your device
  • 📚 Educational NPCs
    Socratic dialogue for hands-on learning
  • 🖥️ Cross-Platform
    Works on Windows, Linux, and edge devices

Key Features

Educational NPC with Socratic Dialogue

💬
NPC Conversation UI

Interactive NPCs guide students through learning using the Socratic method, asking questions to encourage critical thinking and deeper understanding.

Progress Tracking & Assessment

📊
Progress Dashboard

Track learning checkpoints, completed topics, and assessments. The system adapts difficulty based on learner performance.

Customizable AI Host

⚙️
Settings Panel

Easily configure your Ollama/Gemma 3n endpoint and select from various AI models including gemma3n:e4b and gemma3n:e2b.

Garden Environment

🌻
Garden Scene

Beautiful garden setting with diverse plants, composting areas, and demonstration plots for hands-on learning experiences.

Project Architecture

┌─────────────────────────────────────────────────────────────┐
│                     👤 GAME PLAYER                          │
└─────────────────────────────────────────────────────────────┘
                            │
                            ▼
┌─────────────────────────────────────────────────────────────┐
│                 💬 CONVERSATION SYSTEM                       │
│  ┌──────────────┐  ┌──────────────────┐  ┌──────────────┐  │
│  │ 🌱 NPC       │  │   📝 CONVERSATION│  │  💾 GAME     │  │
│  │   GARDENER   │──▶│      MANAGER     │──│    DATA      │  │
│  │  (BackStory) │  │                  │  │  (Settings)  │  │
│  └──────────────┘  └──────────────────┘  └──────────────┘  │
│                            │                                 │
│                            ▼                                 │
│  ┌─────────────────────────────────────────────────────┐   │
│  │            📚 EDUCATIONAL CONVERSATION               │   │
│  │   • Progress Tracker  • Learning Session  • Subject  │   │
│  └─────────────────────────────────────────────────────┘   │
│                            │                                 │
│                            ▼                                 │
│  ┌────────────┐  ┌─────────────────┐  ┌────────────────┐   │
│  │  🎯 EVENT  │  │  📋 RESPONSE    │  │   📜 RESPONSE  │   │
│  │  HANDLER   │  │    HANDLER      │  │     SCHEMA     │   │
│  └────────────┘  └─────────────────┘  └────────────────┘   │
└─────────────────────────────────────────────────────────────┘
                            │
                            ▼
┌─────────────────────────────────────────────────────────────┐
│                    🦙 OLLAMA SERVICE                         │
│              (HTTP Client - Singleton Pattern)               │
│                         ┌────────┐                           │
│                         │ 🤖 OLLAMA SERVER │                 │
│                         └────┬────┘                           │
│                              │                                │
│                   ┌──────────┴──────────┐                    │
│                   │    💎 Gemma 3n      │                    │
│                   │    (e4b or e2b)     │                    │
│                   └─────────────────────┘                    │
└─────────────────────────────────────────────────────────────┘
            
💬

Conversation.cs

ASSETS/PREFABS/BUNDLE/UI/Conversation/SCRIPTS/Conversation.cs
Core NPC conversation logic, signal dispatching, state management
📚

EducationalConversation.cs

ASSETS/PREFABS/BUNDLE/UI/Conversation/SCRIPTS/EducationalConversation.cs
Manages educational content, tracks progress, interfaces with learning modules
🦙

OllamaService.cs

ASSETS/PREFABS/BUNDLE/UI/Conversation/SCRIPTS/OllamaService/OllamaService.cs
Communication with Ollama server, sends prompts, receives AI responses
💾

GameData.cs

ASSETS/SCRIPTS/Global/GameData.cs
Manages persistent game data, Ollama host config, subject selection
🎯

ConversationStarter.cs

ASSETS/PREFABS/BUNDLE/ConversationStarter/SCRIPTS/ConversationStarter.cs
Initializes and triggers new conversations with NPCs
⚙️

Settings.cs

ASSETS/PREFABS/settings/Settings.cs
UI for configuring Ollama host, model selection, subject area

Tech Stack

🎮
Godot 4.4.1
🔷
.NET 8.0
🦙
Ollama
💎
Gemma 3n
🇨#
C#

Getting Started

1

Install Prerequisites

Download and install Godot 4.4.1 Mono and .NET SDK 8.0+

# Download Godot 4.4.1 Mono # Download .NET SDK 8.0+ # Install both with default settings
2

Install & Configure Ollama

Download Ollama from ollama.com and set environment variable

# Download from https://ollama.com # Set environment variable set OLLAMA_HOST=0.0.0.0 # Restart Ollama app
3

Download AI Model

Pull the Gemma 3n model (e4b for larger, e2b for smaller)

ollama pull gemma3n:e4b # Or for smaller model: ollama pull gemma3n:e2b
4

Open in Godot & Run

Clone the repo and open in Godot editor

git clone https://github.com/harsh77788/local-llm-npc.git cd local-llm-npc # Open in Godot 4.4.1 Mono and press Play
1

Install Prerequisites

# Install Godot 4.4.1 Mono and .NET SDK 8.0+
2

Install & Configure Ollama

curl -fsSL https://ollama.com/install.sh | sh sudo nano /etc/systemd/system/ollama.service # Add: Environment="OLLAMA_HOST=0.0.0.0" sudo systemctl daemon-reload sudo systemctl restart ollama.service
3

Download & Run

ollama pull gemma3n:e4b git clone https://github.com/harsh77788/local-llm-npc.git cd local-llm-npc ./godot --editor
1

Install Ollama & Model

# Install Ollama, then: ollama pull gemma3n:e4b
2

Run Prebuilt Executable

# Windows: BIN\WINDOWS\local-llm-npc (4.4).exe # Linux: ./BIN/LINUX/local-llm-npc (4.4).x86_64

Prerequisites Checklist

Godot Engine 4.4.1 (Mono/C#)
Download Godot →
.NET SDK 8.0 or higher
Download .NET SDK →
Gemma 3n Model
ollama pull gemma3n:e4b
`

Attribution & Credits

🎨

Game Assets

Sprites from Kenney's asset store

Visit Kenney.nl

Released under CC0 Public Domain

🔊

Audio Assets

Yellowstone National Park Sound Library

Visit NPS Sound Library

Public Domain

💎

AI Model

Google Gemma 3n

Google Gemma 3n Impact Challenge

Support & Contribute

⭐ 0

Stars on GitHub

Help us grow! 🌟