Show HN: Neural Emotion Matrix for NPCs

Show HN (score: 12)
Found: September 29, 2025
ID: 1713

Description

Other
Show HN: Neural Emotion Matrix for NPCs Hey! I built this system to humanize NPCs by giving them emotions using Rust and ML.

The system provides emotion coordinates (based on Russell's circumplex model) from text input or actions, with persistent emotional memory per entity. Think NPCs that remember how they feel about specific players or events.

I pre-trained a DistilBERT model on ~1k video game dialogues (Skyrim, Cyberpunk, etc.) and plan to extract and evaluate 100k+ dialogues soon. However studio/team can manually add dialogues to enrich their own dataset.

The matrix doesn't generate dialogue, it only analyzes content. When you pass text or an action, it returns emotion coordinates on the valence (pleasant/unpleasant) and arousal(energetic/calm) scale. For example:

- [0.00, 0.00] = neutral

- [0.29, 0.80] = excited

- [-0.50, -0.30] = sad/tired

I made a quick visualizer here to help understand https://valence-arousal-visualizer.vercel.app/

The system helps select which dialogue/action to play based on emotional state:

- Player says something bad to NPC → system detects negative valence → game picks from "angry dialogue pool"

- NPC remembers past positive interactions → system returns positive valence → friendlier responses available

So, the devs still write the dialogues or choose the next actions, but the matrix helps manage NPC emotional states and memory dynamically.

Here's the project structure to better understand how it works:

- src/config: Helper utilities for NPC configuration setup

- src/module: The core engine with emotion prediction, memory storage, and entity management

- src/api: FFI layer with pub extern "C" to bridge our modules with C/C++ game engines and modding tools (Unity, Unreal, etc.)

To implement it, just call `build.sh`, it will create DLL files that you can use to call the matrix functions directly in C++/C/C#.

I'd love feedback on code quality and overall architecture.

Feel free to be honest about the good, the bad, and the ugly. PRs welcome if you want to contribute!

More from Show

Show HN: Apicat – A Lightweight Offline Postman Alternative

Show HN: Apicat – A Lightweight Offline Postman Alternative Apicat is the ultimate offline Postman alternative that stores your .http files locally. It’s Git-friendly, open-source, and highly compatible with Postman. Test APIs offline with this powerful free offline API client designed for developers who need a reliable local API testing tool.

Show HN: Cmux – Coding Agent Multiplexer

Show HN: Cmux – Coding Agent Multiplexer HN,<p>I&#x27;m stoked to share this product I&#x27;ve been working on non-stop for the past few weeks. It&#x27;s an immersive GUI experience for working with many coding agents in parallel. The UX should be familiar to Claude Code users, but we took advantage of the GUI nature to add in a bunch more.<p>cmux is early but certainly usable—almost all of our internal cmux development rolls through cmux itself. Please let me know your thoughts and feedback!

Show HN: A Vectorless LLM-Native Document Index Method

Show HN: A Vectorless LLM-Native Document Index Method The word &quot;index&quot; originally came from how humans retrieve info: book indexes and tables of contents that guide us to the right place in documents.<p>Computers later borrowed the term for data structures: e.g., B-trees, hash tables, and more recently, vector indexes. They are highly efficient for machines; but abstract and unnatural: not something a human, or an LLM, can understand and directly use as a reasoning aid. This creates a gap between how indexes work for computers and how they should work for models that reason like humans.<p>PageIndex is a new step that &quot;looks back to move forward&quot;. It revives the original, human-oriented idea of an index and adapts it for LLMs. Now the index itself (PageIndex) lives inside the LLM&#x27;s context window: the model sees a hierarchical table-of-contents tree and reasons its way down to the right span, much like a person would retrieve information using a book&#x27;s index.<p>PageIndex MCP shows how this works in practice: it runs as a MCP server, exposing a document&#x27;s structure directly to LLMs&#x2F;Agents. This means platforms like Claude, Cursor, or any MCP-enabled agent or LLM can navigate the index themselves and reason their way through documents, not with vectors&#x2F;chunking, but in a human-like, reasoning-based way.

Show HN: Runner – the anti-vibe coding agent

Show HN: Runner – the anti-vibe coding agent Now that AI is capable of writing large volumes of production-quality code, our role as developers is changing. Our primary job is no longer writing code. It’s planning and communicating software design and architecture. We have to do this collaboratively with agents and then review and iterate on their implementations.<p>IDEs were not built for this workflow. So about three months ago I decided to try to build what I thought this new interface should look like.<p>Runner is a coding agent purpose-built for this new “plan and review” workflow. It’s not for vibe coding. It’s for professional software developers who are responsible for the code they ship.<p>It encourages and supports a more structured and controlled workflow than other coding agents. It’s built around the concept of tasks. A task is a small, clearly scoped change. The planning agent creates and edits task specs, and then you can assign them to coding agents once you’re happy with the plan. When the coding agent finishes, you can review the changes via the built-in diff viewer. If you’re happy with them you can approve the changes, which will trigger a git commit.<p>Runner is available as a free BYOK beta for MacOS right now. You can learn more and download it here: <a href="https:&#x2F;&#x2F;runnercode.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;runnercode.com&#x2F;</a>. You will need at least a Gemini API key, and for best performance also an OpenAI API key.

Show HN: BreakerMachines – Modern Circuit Breaker for Rails with Async Support

Show HN: BreakerMachines – Modern Circuit Breaker for Rails with Async Support BreakerMachines is a production-ready circuit breaker for Ruby&#x2F;Rails with built-in async&#x2F;fiber support, fallback chains, and rich monitoring. Unlike existing gems, it handles modern Ruby&#x27;s fiber scheduler and avoids dangerous thread timeouts.

No other tools from this source yet.