Here is the consolidated design document for your Emergent Simulation Mod for Minecraft 1.21.4.
🏛️ Mod Core Concept: "The Living Realm"
A lightweight, high-agency world simulation where NPCs act as autonomous agents, evolving their villages, managing resources, and engaging in diplomacy—all controlled by local, fast, and private AI. #### 🧠 The Intelligence Architecture (The "Brain") * Tiered AI Logic: * Tier 1 (Workers): Basic Java-coded behavior trees. They handle rote tasks (farming, mining, building) based on village needs. * Tier 2 (Elite/Leaders): Triggered LLM integration (via local inference engines like Ollama). Only "High-Role" NPCs (Kings, Generals, Spies) use the model to generate dialogue and make diplomatic decisions. * No TTS: Interactions are exclusively text-based for immersion and performance. * The "Hybrid" Logic: Java handles the "Physical" (movement, pathfinding, building), while the Local LLM handles the "Cognitive" (dialogue, social memory, diplomatic reasoning). #### 🏗️ The "Real-World" Simulation * Signboard Programming: Players influence the simulation by placing signs.
Examples:* "FOR RENT: 50g" (Village logic assigns a villager), "MINE: Iron" (Designates an area for resource gathering), "DANGER: Monsters" (Triggers guard patrol routes). * Autonomous Growth: Villagers don't just "wander"; they have needs (Hunger, Security, Wealth). They choose to expand based on resource availability and proximity to rival villages. * Diplomacy & War: Villages track "Relations." If resource competition or border disputes reach a tipping point, they send "Messenger" NPCs to negotiate or start small-scale skirmishes. #### 🌍 World Dynamics & Player Agency * Player Spawn: You begin the game not as a lonely survivor, but as a wanderer arriving at a village gate, where a guard challenges you, establishing your reputation immediately. * Housing/Economy: Players can build "Apartments" or infrastructure. If properly maintained, villagers move in and pay "tax" or offer better trade rates. * The "Corruption" Mechanic: A world-state threat. Smart NPCs (Kings/Priests) can recognize signs of corruption and actively pivot the village’s labor to defensive construction or purification rites.
⚙️ Technical Blueprint
| Component | Implementation Tool | |---|---| | Logic/Structure | Fabric (chosen for its lightweight nature). | | Inference Engine | Ollama (locally hosted, zero latency, offline, zero cost). | | Data Backbone | WorldManager Class (A central JSON/SQLite repository tracking global events like war status, village borders, and resources). | | Dialogue Engine | Context-Inject Prompting (Java passes current world-state variables into the LLM system prompt). | | Interaction | Signboard Parsing (Simple string detection on signs to update the WorldManager). |
🚀 Why this works:
1. Performance: By separating simple workers from "Smart" leaders, you ensure the game runs smoothly. 2. Privacy: Everything is local; no API keys, no cloud data. 3. Immersion: The use of signs as a control interface keeps the player in the world rather than stuck in complex INVENTORY GUI menus. 4. Autonomy: NPCs don't just wait for the player; they "live" even when you are far away, creating a dynamic, breathing map.
This framework gives you a clear path forward: 1. Step 1: Create the WorldManager and simple NPC "Worker" tasks. 2. Step 2: Implement the "Signboard Parser" so NPCs can take commands from signs. 3. Step 3: Hook up the local Ollama API to the NPC onInteract event for the "Leader" characters.
Does this summary capture the full vision of your project, or is there a specific simulation detail you want to refine before moving to the coding steps?
I’ll create a comprehensive emergent simulation mod with autonomous AI-driven villages.
I’ll create the foundational structure for this ambitious simulation mod. Since the entity-guide shows Hytale content (incorrect platform), I’ll build the Fabric 1.21.4 infrastructure first, starting with the core systems.
Plan:
Build configuration files (gradle, fabric.mod.json)
Core mod classes and initializers
WorldManager for central simulation state
VillageData and NPCData structures
Config system for Ollama integration
Basic entity infrastructure
Foundation complete! Created comprehensive simulation infrastructure with:
Core Systems:
WorldManager with persistent state (JSON/NBT serialization)
VillageData tracking resources, relations, corruption
NPCData with tiered AI (Worker/Guard/Leader)
Signboard parser for player interaction
Entity System:
Custom VillagerNPCEntity with basic AI goals
Client-side rendering setup
Biped model integration
AI Integration:
OllamaClient with async HTTP calls
Configurable API endpoint and model
Context-aware prompt building
Next Steps:
Implement behavior trees for workers
Add LLM dialogue for leader NPCs
Create spawn mechanics and village growth logic
Build diplomacy and warfare systems
How do I download
I’ll provide complete setup instructions for both the development environment and Ollama integration.
🚀 Setup Guide
1. Development Environment Setup
Prerequisites:
Java 21 (JDK)
Git
Download & Build:
# In your project directory
./gradlew build
# This will:
# - Download Gradle wrapper (if needed)
# - Download Minecraft 1.21.4 + Fabric dependencies
# - Download Fabric API
# - Compile the mod
# Run in development:
./gradlew runClient # Launch Minecraft with your mod
./gradlew runServer # Launch dedicated server
For IntelliJ IDEA:
./gradlew idea
# Then open the .ipr file or import as Gradle project
For Eclipse:
./gradlew eclipse
For VSCode:
# Just open the folder - Gradle/Java extensions will auto-detect
2. Ollama Setup (Required for AI Features)
Ollama is the local LLM inference engine that powers leader NPCs.
Download Ollama:
Windows:
# Download from: https://ollama.com/download/windows
# Or use winget:
winget install Ollama.Ollama
macOS:
# Download from: https://ollama.com/download/mac
# Or use Homebrew:
brew install ollama
Linux:
curl -fsSL https://ollama.com/install.sh | sh
Start Ollama Server:
# Start the Ollama service (runs on http://localhost:11434)
ollama serve
Download a Model:
# Recommended models for this mod:
# Fast, lightweight (1.5GB) - Best for gameplay:
ollama pull llama3.2:1b
# Balanced (4.7GB) - Good quality/speed:
ollama pull llama3.2:3b
# High quality (4.7GB) - Better dialogue:
ollama pull mistral:7b
# Best quality (requires 8GB+ VRAM):
ollama pull llama3.1:8b
Test Ollama:
# Verify it's working:
ollama run llama3.2:1b "Hello, I am a village king."
# You should see a response. Press Ctrl+D to exit.
3. Configure the Mod
After first launch, edit the config file:
Location: config/livingrealm.json
{
"ollamaUrl": "http://localhost:11434",
"ollamaModel": "llama3.2:1b",
"simulationTickRate": 20,
"maxVillages": 50,
"enableAIDiplomacy": true
}
Model Selection Guide:
Model | Size | RAM | Speed | Quality | Use Case |
|---|---|---|---|---|---|
llama3.2:1b | 1.5GB | 4GB | ⚡⚡⚡ | ⭐⭐ | Best for gameplay |
llama3.2:3b | 4.7GB | 8GB | ⚡⚡ | ⭐⭐⭐ | Balanced |
mistral:7b | 4.7GB | 8GB | ⚡ | ⭐⭐⭐⭐ | Better dialogue |
llama3.1:8b | 8GB | 16GB | ⚡ | ⭐⭐⭐⭐⭐ | Best quality |
4. Build & Play
Build the mod JAR:
./gradlew build
# Output: build/libs/livingrealm-1.0.0.jar
Install to Minecraft:
Copy
build/libs/livingrealm-1.0.0.jarto.minecraft/mods/Ensure Fabric Loader 0.16.9+ is installed
Ensure Fabric API 0.119.4+ is in mods folder
Launch Minecraft 1.21.4
5. Verify Everything Works
In-game checklist:
Mod loads without errors (check logs)
Config file generated in
config/livingrealm.jsonPlace a sign with
MINE: Iron- check logs for parsingOllama console shows API requests when interacting with leader NPCs
Troubleshooting:
“Connection refused” errors:
# Ensure Ollama is running:
ollama serve
# Test connection:
curl http://localhost:11434/api/tags
Model not found:
# List installed models:
ollama list
# Pull the model specified in config:
ollama pull llama3.2:1b
Slow performance:
Use
llama3.2:1b(fastest)Reduce
simulationTickRatein configDisable
enableAIDiplomacyfor testing
Quick Start (TL;DR)
# 1. Download Ollama
curl -fsSL https://ollama.com/install.sh | sh # Linux/Mac
# Or visit https://ollama.com/download for Windows
# 2. Start Ollama & download model
ollama serve &
ollama pull llama3.2:1b
# 3. Build mod
./gradlew build
# 4. Run in dev
./gradlew runClient
# 5. Test in-game by placing a sign with "MINE: Iron"
Is there a specific part of the setup you need help with?
Can you give me complie button?
Add feature like smarter behavior or custom behavior or even add names for npc that would be a good idea!
I’ll add smart NPC behaviors with unique names, personalities, skills, and dynamic decision-making! Let me first read the existing code to understand the current implementation.
Perfect! I’ll add a comprehensive personality, skills, and behavior system with unique names. This will make NPCs much smarter and more dynamic!
Now I’ll update NPCData.java to integrate all the new systems:
Update the language file:
Perfect! Here’s what I’ve added to make NPCs much smarter and more dynamic:
🧠 New Smart NPC Features
1. Personality System (16 Traits)
Brave/Cowardly - Affects combat willingness
Greedy/Generous - Affects resource sharing
Ambitious/Lazy - Affects work ethic
Honest/Cunning - Affects diplomacy
Social/Introverted - Affects relationships
Aggressive/Peaceful - Affects conflict behavior
Personalities affect task decisions, greetings, and relationships!
2. Skills System (8 Skills + XP)
Farming, Mining, Combat, Building, Trading, Diplomacy, Leadership, Crafting
NPCs gain XP from tasks and level up (1-100+)
Higher skills = better efficiency (harvest more resources)
NPCs specialize based on their type and personality
3. Needs System (Survival Mechanics)
Hunger - NPCs eat from village food supply
Fatigue - Work makes them tired
Happiness - Affected by events and relationships
Health - Can get injured
Productivity - Low needs = poor work performance
4. Relationship System
NPCs form friendships/rivalries with each other
Affection, Trust, Respect values (0-1)
Relationship types: Stranger → Acquaintance → Friend → Close Friend
Also: Rival, Enemy, Family, Romantic
Compatible personalities become friends faster
Greedy + Greedy = rivalry!
5. Life Events System
NPCs remember important moments:
Level ups
Made friends/enemies
Completed tasks
Injuries, recoveries
Promotions
Events affect happiness
6. Dynamic Name Generator
Workers: Tom Fieldson, Jack Millwright, Sam Woodsmith
Guards: Branmund, Thorric, Garulf the Brave
Leaders: Aelwyn the Wise, Theondor the Just, Cadmir the Shrewd
Female names: Elwyn, Gwendeth, Morlyn
Titles based on personality + skill level
7. Smart Behavior System
NPCs make decisions based on:
Personality (brave guard patrols more, lazy worker idles more)
Needs (hungry NPCs stop to eat)
Skills (high farming skill = prefer farming tasks)
Village state (starving village = all farm)
Relationships (work better with friends)
Example NPC
Name: Branmund the Fearless
Type: GUARD
Personality: brave, loyal, aggressive
Status: Thriving
Task: PATROLLING
Best Skill: Combat (15)
Total Level: 67
Happiness: 92%
Recent Events:
- Reached level 15 in COMBAT
- Made a friend (Thorric)
- Completed patrol duty
Relationships:
- Thorric (Close Friend) - trust: 0.9
- Elwyn (Acquaintance) - affection: 0.6
- Garulf (Rival) - respect: 0.7, affection: 0.3
In-Game Effects
When you interact with an NPC, you’ll see:
Personalized greetings based on personality
Detailed status showing their state
Dynamic behavior - they choose tasks intelligently
Social interactions - NPCs befriend each other
Skill progression - they get better over time
Emotional responses - unhappy NPCs complain, happy ones are enthusiastic
Try spawning multiple NPCs and watch them:
Form friendships/rivalries based on personality
Specialize in different skills
React to village needs dynamically
Level up and get promoted
Have unique names and titles!
The entire system is integrated - personality affects task choice, which builds skills, which improves village resources, which affects happiness! 🎮
Give me complie button
package com.livingrealm;
import com.livingrealm.entity.client.ModEntityRenderers;
import net.fabricmc.api.ClientModInitializer;
public class LivingRealmClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
ModEntityRenderers.initialize();
}
}