Website ยท SparkLabs ยท Quickstart ยท Key Features ยท Docs ยท Contributing
SparkLabs is a next-generation AI-native game engine that deeply integrates artificial intelligence capabilities into the core architecture of game development. Unlike traditional game engines that rely on manually coded game logic and predefined pipelines, SparkLabs revolutionizes game development by enabling procedural content generation, intelligent NPC behavior systems, adaptive rendering, and dynamic difficulty adjustment through AI.
The engine features an AI Agent foundation that provides a comprehensive multi-agent orchestration system, hierarchical memory, tool registry, and LLM provider integration โ all designed from the ground up for AI-native game development. The web editor provides an intuitive interface for scene design, workflow composition, NPC creation, and narrative editing.
- SparkAgent with observe-think-act loop
- Multi-provider LLM integration (OpenAI, Anthropic, DeepSeek, Ollama, local models)
- Hierarchical memory system (short-term, long-term, episodic, semantic, working)
- Tool registry with built-in engine tools for game development
- Multi-agent orchestration with automatic capability matching
- Deep integration of AI inference capabilities into core engine architecture
- AI-driven object system and event handling mechanisms
- Support for neural network models
- Real-time AI super-resolution (Neural Upscaling)
- AI-based ambient occlusion (N/AO)
- Intelligent anti-aliasing (Neural AA)
- Adaptive rendering based on scene understanding
- Neural network-driven NPC decision making with dual-network architecture
- 10-dimensional personality trait system
- Emotional state machine with 7 emotion types
- Memory system with short-term, long-term, episodic, and semantic memory
- Attention mechanism for focus management
- Behavior tree system with selector, sequence, decorator, and parallel nodes
- Context-aware dialogue generation
- Player skill tracking and modeling
- Real-time dynamic difficulty adjustment
- Engagement metrics monitoring
- Personalized player experience optimization
- Branching story graph with variable tracking and conditional logic
- Procedural quest generation with 6+ template types
- Dynamic quest customization with context-aware text
- Story node types: Beginning, Plot Point, Choice, Climax, Resolution, Branch
- AI-powered texture synthesis
- Procedural geometry generation
- Prompt-to-asset conversion system
- Intelligent asset caching
- Node-graph visual programming for AI pipelines
- 20+ built-in node types across 11 categories
- Typed pin connections with type safety
- Topological execution engine
- Categories: Prompt, Image, Text, Video, Audio, Input, Output, Sampling, Latent, ControlNet, Logic, Game
- Three-tiered agent architecture matching real studio hierarchy
- Tier 1: Directors (Creative Director, Technical Director, Producer)
- Tier 2: Department Leads (Game Designer, Lead Programmer, Art Director, etc.)
- Tier 3: Specialists (19 specialist roles)
- Design review and approval workflows
- Code review and quality validation processes
- Quality gate system with 4 standards and 5 metrics
- React + TypeScript + Vite + Tailwind CSS
- 11 editor panels: Dashboard, Game Studio, Templates, Story, Assets, Voice, Storyboard, Video, Workflow, NPC Designer, Agent Panel
- Real-time WebSocket connection to engine backend
- AI Agent chat interface for content generation
- Visual workflow canvas with drag-and-drop nodes
- NPC personality designer with trait visualization
- Story editor with branching narrative support
- OS: Windows 10, macOS 10.14, Linux (Ubuntu 18.04+)
- Compiler: GCC 9+, Clang 10+, MSVC 2019+
- Python: 3.10+
- Node.js: 18+
- RAM: 8 GB
- Disk: 2 GB free space
- OS: Windows 11, macOS 12+, Linux (Ubuntu 20.04+)
- Compiler: GCC 11+, Clang 14+, MSVC 2022+
- RAM: 16 GB or more
- GPU: NVIDIA GPU with CUDA support (for GPU acceleration)
# Clone the repository
git clone https://github.com/Yuan-ManX/SparkLabs.git
cd SparkLabs
# Create build directory
mkdir build && cd build
# Configure with CMake
cmake ..
# Build
cmake --build . --config Release# Navigate to website directory
cd frontend/website
# Install dependencies
npm install
# Start website server
npm run dev# Navigate to web editor directory
cd frontend/web
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build# Install Python dependencies
pip install -r backend/requirements.txt
# Start the backend server
python -m uvicorn backend.app:app --host 0.0.0.0 --port 8091 --reloadSPARKLABS_ORT_ENABLED: Enable ONNX Runtime support (default: ON)SPARKLABS_GPU_SUPPORT: Enable GPU acceleration (default: ON)
cmake .. -DSPARKLABS_ORT_ENABLED=ON -DSPARKLABS_GPU_SUPPORT=ON#include <SparkLabs.h>
using namespace SparkLabs;
int main() {
auto scene = new Scene();
scene->SetName("MyGame");
auto player = scene->CreateEntity("Player");
player->SetPosition(Vector3(0.0f, 1.0f, 0.0f));
player->SetTag("Player");
auto npc = scene->CreateEntity("NPC");
npc->SetPosition(Vector3(5.0f, 1.0f, 0.0f));
auto npcBrain = npc->AddComponent<NPCBrainComponent>();
npcBrain->LoadModel("models/npc_decision.onnx");
Engine::GetInstance()->SetScene(scene);
Engine::GetInstance()->Run();
return 0;
}import asyncio
from sparkai import SparkAgent, LLMProvider, LLMConfig, AgentCapability, create_engine_tools
async def main():
# Create an AI agent
agent = SparkAgent(
name="GameDesigner",
role="game_designer",
capabilities=[
AgentCapability.REASONING,
AgentCapability.GAMEPLAY_DESIGN,
AgentCapability.WORLD_BUILDING,
],
)
# Configure LLM provider
llm = LLMProvider(LLMConfig(
provider="openai",
model="gpt-4",
api_key="your-api-key",
))
await llm.initialize()
agent.set_llm_provider(llm)
# Register engine tools
for tool in create_engine_tools():
agent.register_tool(tool)
# Use the agent
response = await agent.think("Design a boss encounter for a fantasy RPG")
print(response)
# Execute an action
result = await agent.act("create_scene", {"name": "Boss Arena"})
print(result)
asyncio.run(main())from sparkai import WorkflowGraph, WorkflowNode, WorkflowExecutor, NodeRegistry
# Create workflow graph
graph = WorkflowGraph(name="Image Generation Pipeline")
# Use the node registry to create typed nodes
registry = NodeRegistry.get_instance()
prompt = registry.create_node("text_prompt", name="Landscape Prompt")
prompt.set_property("prompt", "A beautiful landscape at sunset")
prompt.position = [100.0, 100.0]
image_gen = registry.create_node("image_generation", name="Generate Image")
image_gen.set_property("width", 1024)
image_gen.set_property("height", 1024)
image_gen.position = [400.0, 100.0]
save = registry.create_node("save_image", name="Save Result")
save.set_property("output_path", "output/landscape.png")
save.position = [700.0, 100.0]
# Add nodes and connect
graph.add_node(prompt)
graph.add_node(image_gen)
graph.add_node(save)
graph.connect(prompt.id, 0, image_gen.id, 0)
graph.connect(image_gen.id, 0, save.id, 0)
# Execute
executor = WorkflowExecutor()
result = await executor.execute(graph)from sparkai import NPCBrain, NPCPersonality, PersonalityTraits, BehaviorTree, BehaviorNode
# Create NPC with personality
personality = NPCPersonality(
name="Elder Sage",
traits=PersonalityTraits(
courage=0.3, curiosity=0.8, aggression=0.1,
friendliness=0.9, honesty=0.9, intelligence=0.95,
),
background="An ancient keeper of knowledge",
speech_style="wise",
)
brain = NPCBrain(personality=personality)
# Add goals
brain.add_goal("Share wisdom", priority=0.8)
brain.add_goal("Protect library", priority=0.9)
# Create behavior tree
tree = BehaviorTree()
root = BehaviorNode(name="Root", node_type="selector")
tree.set_root(root)
brain.set_behavior_tree(tree)
# Make decisions
decision = await brain.decide({"player_action": "asks about ancient artifact"})
dialogue = await brain.generate_dialogue("Tell me about the ancient artifact")โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ SparkLabs Web Editor โ
โ React + TypeScript + Vite + Tailwind CSS โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ
โ โ Game โ โ Workflow โ โ NPC โ โ Agent โ โ
โ โ Studio โ โ Canvas โ โ Designer โ โ Panel โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Backend API (FastAPI) โ
โ WebSocket โ REST API โ Agent Routes โ Engine Routes โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ sparkai (Python AI Layer) โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Agent โ โ Workflow โ โ NPC System โ โ
โ โ Foundation โ โ Engine โ โ Brain โ Memory โ Emotionโ โ
โ โ LLMโMemory โ โ GraphโExec โ โ Behavior โ Personality โ โ
โ โ ToolsโOrch. โ โ Registry โ โ Dialogue โ Goals โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Narrative โ โ Team โ โ Engine โ โ
โ โ StoryโQuest โ โ DirโLead โ โ Scene โ Entity โ โ
โ โ BranchโVar โ โ SpecโQualityโ โ Component System โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ C++ Core Engine Layer โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ
โ โ Scene โ โ Resource โ โ Physics โ โ AI Runtime โ โ
โ โ Manager โ โ Manager โ โ Engine โ โ ONNX โ Neural โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Neural Rendering Pipeline โ
โ Classical Render โ Neural AA โ Neural AO โ Neural Upscale โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Platform Layer โ
โ Windows | macOS | Linux | Web | Mobile โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
SparkLabs/
โโโ sparkai/ # Python AI Agent Foundation
โ โโโ __init__.py # Package exports
โ โโโ config.py # Configuration system
โ โโโ agent/ # Agent core
โ โ โโโ base.py # SparkAgent with observe-think-act loop
โ โ โโโ llm.py # Multi-provider LLM integration
โ โ โโโ memory.py # Hierarchical memory system
โ โ โโโ toolkit.py # Tool registry and execution
โ โ โโโ orchestrator.py # Multi-agent orchestration
โ โโโ engine/ # Python engine interface
โ โ โโโ engine.py # SparkEngine, Scene, Entity
โ โ โโโ scene.py # Scene management
โ โโโ workflow/ # AI Workflow system
โ โ โโโ graph.py # WorkflowGraph, WorkflowNode, PinType
โ โ โโโ executor.py # Topological execution engine
โ โ โโโ registry.py # Node type registry with 20+ types
โ โโโ npc/ # Intelligent NPC system
โ โ โโโ brain.py # NPCBrain with dual-network
โ โ โโโ personality.py # 10-dimensional personality traits
โ โ โโโ behavior.py # Behavior tree system
โ โโโ narrative/ # AI Narrative engine
โ โ โโโ story.py # Branching story graph
โ โ โโโ quest.py # Procedural quest generation
โ โโโ team/ # Team collaboration
โ โ โโโ director.py # Director agents (Tier 1)
โ โ โโโ lead.py # Lead agents (Tier 2)
โ โ โโโ specialist.py # Specialist agents (Tier 3)
โ โ โโโ quality.py # Quality gate system
โ โโโ ai/ # C++ AI runtime (headers)
โ โโโ asset/ # Smart asset management (C++)
โ โโโ audio/ # Audio system (C++)
โ โโโ gameplay/ # Adaptive gameplay (C++)
โ โโโ neural/ # Neural rendering (C++)
โ โโโ editor/ # Editor integration (C++)
โโโ backend/ # FastAPI Backend
โ โโโ app.py # Application entry point
โ โโโ websocket.py # WebSocket handler
โ โโโ requirements.txt # Python dependencies
โ โโโ routes/ # API routes
โ โโโ engine.py # Engine control endpoints
โ โโโ agent.py # Agent management endpoints
โ โโโ scene.py # Scene/entity endpoints
โ โโโ workflow.py # Workflow endpoints
โ โโโ narrative.py # Story/quest endpoints
โ โโโ npc.py # NPC management endpoints
โโโ frontend/ # SparkLabs Frontend
โ โโโ website/ # Official Website (Static HTML)
โ โ โโโ index.html # Main homepage
โ โ โโโ sparklabs.html # SparkLabs homepage
โ โ โโโ editor.html # Original editor page
โ โ โโโ package.json # Website server config
โ โโโ web/ # AI-Native Game Engine Editor (React)
โ โโโ index.html # Vite entry
โ โโโ App.tsx # Main application
โ โโโ main.tsx # Entry point
โ โโโ index.css # Global styles
โ โโโ package.json # Editor dependencies
โ โโโ vite.config.ts # Vite configuration
โ โโโ components/ # UI components
โ โ โโโ SparkLabsEditor.tsx # Editor main layout
โ โ โโโ EditorToolbar.tsx # Top toolbar
โ โ โโโ SceneHierarchy.tsx # Left panel - scene tree
โ โ โโโ Viewport3D.tsx # Center - Three.js viewport
โ โ โโโ InspectorPanel.tsx # Right panel - properties
โ โ โโโ ConsolePanel.tsx # Bottom - console/AI assistant
โ โ โโโ SparkLabsHome.tsx # Landing page
โ โ โโโ WelcomeDashboard.tsx # Editor dashboard
โ โ โโโ GameEditor.tsx # Game studio
โ โ โโโ GameGenerator.tsx # Template generator
โ โ โโโ StoryEditor.tsx # Story editor
โ โ โโโ AssetGenerator.tsx # Asset generator
โ โ โโโ VoiceSynthesizer.tsx # Voice synthesis
โ โ โโโ StoryboardEditor.tsx # Storyboard editor
โ โ โโโ VideoRenderer.tsx # Video renderer
โ โ โโโ WorkflowEditor.tsx # Workflow canvas
โ โ โโโ NPCDesigner.tsx # NPC designer
โ โ โโโ AgentPanel.tsx # Agent chat panel
โ โโโ hooks/ # Custom React hooks
โ โโโ utils/ # API client and utilities
โ โโโ types/ # TypeScript type definitions
โโโ core/ # Core C++ utilities
โโโ engine/ # C++ Engine core
โโโ render/ # Rendering system
โโโ platform/ # Platform abstraction
โโโ docs/ # Documentation
โโโ scripts/ # Build scripts
โโโ tests/ # Unit tests
For full documentation, see the docs directory:
Contributions are welcome! Please read our contributing guidelines before submitting pull requests.
SparkLabs Engine is licensed under the MIT License. See LICENSE for details.
If you like this project, please โญ star the repo. Your support helps us grow!
