Living NPCs, procedural content, dynamic mechanics — all driven by AI, right during gameplay.
Imagine a game that adapts not just with numbers, but with logic and situations: different threats, different pacing, different world "character". CoreAI makes this a reality.
Версия: v0.9.0 | Единый MEAI pipeline для HTTP API и LLMUnity
var merchant = new AgentBuilder("Blacksmith")
.WithSystemPrompt("You are a blacksmith. Sell weapons and remember purchases.")
.WithTool(new InventoryLlmTool(myInventory)) // Knows their stock
.WithMemory() // Remembers buyers
.WithMode(AgentMode.ToolsAndChat) // Tools + chat
.Build();3 Agent Modes: 🛒 ToolsAndChat · 🤖 ToolsOnly · 💬 ChatOnly
AI doesn't just generate text — it calls code for real actions:
| Tool | What it does | Who uses it |
|---|---|---|
| 🧠 MemoryTool | Persistent memory between sessions | All agents |
| 📜 LuaTool | Executes Lua scripts | Programmer AI |
| 🎒 InventoryTool | Gets NPC inventory | Merchant AI |
| ⚙️ GameConfigTool | Reads/writes game configs | Creator AI |
Create your own:
public class WeatherLlmTool : ILlmTool
{
public string Name => "get_weather";
public string Description => "Get current weather.";
public AIFunction CreateAIFunction() => AIFunctionFactory.Create(
async ct => await _provider.GetWeatherAsync(ct), "get_weather", "Get weather.");
}Player: "Craft a weapon from Iron and Fire Crystal"
↓
CoreMechanicAI: "Iron + Fire Crystal → Flame Sword, damage 45"
↓
Programmer AI: execute_lua → create_item("Flame Sword", "weapon", 75)
add_special_effect("fire_damage: 15")
↓
✨ Player receives a unique item!
| Memory | ChatHistory | |
|---|---|---|
| Storage | JSON file on disk | In LLMAgent (RAM) |
| Duration | Between sessions | Current conversation |
| For what | Facts, purchases, quests | Conversation context |
Small models (Qwen3.5-2B) sometimes forget the format. CoreAI automatically gives 3 retries + checks fenced Lua blocks immediately.
| Model | Size | Tool Calling | When to use |
|---|---|---|---|
| Qwen3.5-4B | 4B | ✅ Great | Recommended for local GGUF |
| Qwen3.5-35B (MoE) API | 35B/3A | ✅ Excellent | Ideal via API — fast & accurate |
| LM Studio / OpenAI API | Any | ✅ Excellent | External models via HTTP — best choice |
| Qwen3.5-2B | 2B | Minimal, but may make mistakes |
💡 Recommendation: Qwen3.5-4B locally or Qwen3.5-35B (MoE) via API
MoE models (Mixture of Experts) activate only 3B parameters per inference — fast as 4B, accurate as 35B.
The repository consists of two packages:
| Package | What's inside | Dependencies |
|---|---|---|
| com.nexoider.coreai | Portable core — pure C# without Unity | VContainer, MoonSharp |
| com.nexoider.coreaiunity | Unity layer — DI, LLM, MEAI, MessagePipe, tests | Depends on coreai |
┌─────────────────────────────────────────────────────────────┐
│ Player / Game │
└──────────────────────┬──────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ AiOrchestrator │
│ • Priority queue • Retry logic • Tool calling │
└──────────────────────┬──────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ LLM Client │
│ • LLMUnity (local GGUF) • OpenAI HTTP • Stub │
└──────────────────────┬──────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ AI Agents │
│ 🛒 Merchant 📜 Programmer 🎨 Creator 📊 Analyzer │
│ 🗡️ CoreMechanic 💬 PlayerChat + Your custom ones! │
└──────────────────────┬──────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ Tools (ILlmTool) │
│ 🧠 Memory 📜 Lua 🎒 Inventory ⚙️ GameConfig + Yours! │
└──────────────────────┬──────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────┐
│ Game World │
│ • Lua Sandbox (MoonSharp) • MessagePipe • DI (VContainer)│
└─────────────────────────────────────────────────────────────┘
Window → Package Manager → + → Add package from git URL…
https://github.com/NeoXider/CoreAI.git?path=Assets/CoreAI
https://github.com/NeoXider/CoreAI.git?path=Assets/CoreAiUnity
Assets/CoreAiUnity/Scenes/_mainCoreAI.unity → Play
var storyteller = new AgentBuilder("Storyteller")
.WithSystemPrompt("You are a campfire storyteller. Share tales about the world.")
.WithMemory()
.WithChatHistory()
.WithMode(AgentMode.ChatOnly)
.Build();| Document | What's inside |
|---|---|
| 📖 CoreAI README | General overview + AgentBuilder |
| 🏗️ AGENT_BUILDER.md | Agent builder guide + ChatHistory |
| 🔧 TOOL_CALL_SPEC.md | Tool calling specification |
| 🛒 CHAT_TOOL_CALLING.md | Merchant NPC with inventory |
| 🧠 MemorySystem.md | Agent memory system |
| 🗺️ DEVELOPER_GUIDE.md | Code map, architecture |
| 🤖 AI_AGENT_ROLES.md | Agent roles and prompts |
| ⚙️ COREAI_SETTINGS.md | CoreAISettingsAsset + tool calling |
| 🛠️ MEAI_TOOL_CALLING.md | MEAI pipeline architecture |
| 📋 CHANGELOG.md | Version history |
Unity → Window → General → Test Runner
├── EditMode — 215+ tests (fast, no LLM)
│ ├── CoreAISettingsAssetEditModeTests (7)
│ ├── AgentBuilderChatHistoryEditModeTests (7)
│ ├── OfflineLlmClientEditModeTests (5)
│ ├── MeaiLlmClientEditModeTests (4)
│ └── ... (other tests)
└── PlayMode — 12+ tests (with real LLM)
- Singleplayer: Same pipeline, AI works locally
- Multiplayer: AI logic on host, clients receive agreed outcomes
One template — for both solo campaign and coop.
Author: Neoxider
Ecosystem: NeoxiderTools
License: PolyForm Noncommercial 1.0.0 (commercial use — separate license)
Contact: neoxider@gmail.com | GitHub Issues
🎮 CoreAI — Make your game smarter. One agent at a time.