Neocortex Logo
Build a Half-Life AI NPC mod with the HL SDK or Xash3D FWGS: scientists and guards you can talk to, voice commands for guards and a Black Mesa safety quiz.

Half-Life AI NPC Mod: Talking Scientists and Voice Commands

ModdingHalf-LifeAI NPC

What would a Black Mesa scientist tell you if you could ask a real question? In the base game, nothing new: every scientist and security guard has a handful of recorded lines. A Half-Life AI NPC mod changes that. Your game DLL sends what the player says to an AI character and plays the answer back as voice and subtitles, and with Neocortex you also get Conversation Flows for scripted beats, a quiz engine and on-device voice commands for the guards.

Half-Life in-game screenshot Screenshot: Half-Life © Valve

Valve's SDK vs Xash3D FWGS

Two code bases are in use, and a Half-Life AI NPC mod works on either:

Valve's Half-Life SDKXash3D FWGS with hlsdk-portable
What it isThe official source for the client and server librariesAn open-source engine compatible with Half-Life, plus the FWGS cross-platform fork of the SDK
Runs onGoldSrcWindows, Linux, BSD and Android; hlsdk-portable builds for GoldSrc and Xash3D
StatusLast updated by Valve in October 2024 to match that month's Steam patchActively developed
BuildsThe client and server DLLsThe same DLLs with CMake or waf, with optional bug fixes and several community mods kept as separate branches
Game dataYour Steam copyThe valve folder from your own copy of the game

Valve's SDK license lets you distribute mods for free only.

Inside a GoldSrc mod

Half-Life runs on GoldSrc. A mod is a folder next to valve that contains your maps, models, sounds and two compiled C++ libraries: a server DLL for game logic, NPC AI and triggers, and a client DLL for the HUD, effects and local sound.

GoldSrc has no built-in HTTP client, so your mod links one: WinHTTP on Windows, or libcurl if you also target Linux or Xash3D ports. Run requests on a worker thread and hand results back to the game loop, so the game never stalls while a reply is on its way.

For subtitles, draw a custom HUD element in the client DLL, or fire a game_text message from the server for a quick start. For voice, request WAV audio, save it in your mod's sound folder and play it on the client, converting it to a format the engine accepts if needed.

Meet the cast

Dr. Ilse Marek and Officer Dale Ruiz

Write your own cast instead of reusing the base game's. Dr. Ilse Marek is a sleep-deprived spectrometry researcher who has not left her lab in three days. Officer Dale Ruiz has worked the same checkpoint for nine years and has opinions about the tram schedule.

Give each one a Personality, an Emotion setting and a Knowledge base in the Neocortex editor: lab procedures, rumours about the test chamber, who owes whom money.

Your mod sends each message with context: nearby objects (the lab door, the retinal scanner, a health charger) and recent events ("the lights just failed", "the player is holding a crowbar"). The character answers in voice, every line carries an emotion tag such as CURIOUS or ANGRY that you can map to a facial expression or animation, and it can return an action like { "name": "OPEN_DOOR", "targetId": "lab_door_03" }. Your game DLL then fires that door, exactly as if the player had pressed the button.

Guards who take spoken orders

Classic Half-Life guards already follow the player when you press the use key. Voice commands let the player do the same with speech: "follow me", "wait here", "open the door".

In the Neocortex dashboard you design a command set as actors, actions and objects: actor "guard", actions "follow", "wait" and "open", objects "me" and "door". Players speak naturally, and the mod receives matched commands instantly, including several in one sentence: "Ruiz, open the door and wait here" arrives as two commands. It works with push-to-talk or always-listening, in multiple languages, and runs on the player's machine with no cloud round trip.

Voice Commands is a licensed SDK: contact us for a Voice Commands license.

The safety officer and the orientation quiz

Turn the orientation room into a game. A safety officer character runs a short quiz built in the Neocortex dashboard: what to do when a specimen escapes containment, which badge colour means radiation clearance, when you are allowed to run in the halls.

The quiz engine (Team plan) asks the questions, checks the player's answers and keeps score. Pass, and your mod opens the door to the next area; fail, and the officer sends you back to watch the safety slideshow again.

Half-Life in-game screenshot Screenshot: Half-Life © Valve

What Neocortex handles

  • Dialogue. The mod reads game state (who is nearby, what just happened) and sends it with the player's message to a Neocortex character through /v3/chat. It shows the reply as subtitles, plays the voice from /v3/audio/generate or /v3/audio/stream, and runs the actions the character returns.
  • Conversation Flows. Branching story beats, such as convincing a scientist to open the storage room. The character steers the player through them and the API returns checkpoint keywords the mod reacts to.
  • Quizzes. The quiz engine runs question-and-answer games through /v3/quiz, including scoring.
  • Voice commands. On-device voice commands turn spoken phrases into game actions without a cloud round trip. Neocortex Voice Commands runs on the player's machine.

Characters are built in a visual node editor (Personality, Emotion, Knowledge, World, Objects, Actions, Voice and more) and can be tested in the browser before you write a line of C++. If you want to see how we compare with other AI character tools, see our comparisons.

Can you sell a Half-Life AI NPC mod?

No. Valve's Half-Life SDK license allows you to distribute your mod in source and binary form, but only for free; for commercial use it asks you to contact Valve.

Keep AI NPC mods to single-player, never use them on multiplayer servers against their rules, and have each player use their own Neocortex API key.

Your first map, step by step

  1. Set up the SDK. Clone Valve's halflife SDK or hlsdk-portable and build the client and server DLLs for an empty test mod.
  2. Design your characters in the Neocortex dashboard: a scientist, a guard, a safety officer with a quiz, and a command set for the guards.
  3. Add an HTTP client to the game DLL and call /v3/chat on a worker thread, reusing the sessionId from each reply.
  4. Keep the API key in a config file that the player fills in, never hard-coded in a mod you share.
  5. Wire up subtitles, voice and actions, then add voice commands for the guards.
  6. Test in single-player on one small map before you build a full campaign around it.

Want to go further? Read how on-device voice commands for game mods work, or see the same ideas on Source in our Half-Life 2 AI NPC mod guide. All our game-by-game guides are in the AI NPC and voice command mods index, and every one of them starts the same way: one Neocortex character, tested in the browser, before any C++.

Tool versions and links checked October 2026. Modding tools change often; check each project's page for the latest release.

Frequently Asked Questions

Can you add AI NPCs to Half-Life?

Yes. Half-Life mods are C++ game DLLs built from Valve's Half-Life SDK, so a mod can send the player's words to a web API and play back the answer. Neocortex provides the AI character, its voice and the actions it returns, and your mod runs them in the game.

What do I need to mod Half-Life in 2026?

Valve's halflife SDK on GitHub, a C++ compiler, and the Steam version of Half-Life. Many modders also use Xash3D FWGS and the hlsdk-portable fork to build for more platforms. To add AI NPC dialogue, create a free Neocortex account and design your characters in the browser.

Can Half-Life mods use voice commands?

Yes. A mod can listen to the microphone and map spoken phrases to game code, such as telling a guard to follow you. Neocortex Voice Commands does the listening and matching on the player's PC, so commands work offline and respond instantly.

Can I sell a Half-Life mod with AI NPCs?

No. Valve's Half-Life SDK license allows you to distribute your mod only for free and asks you to contact Valve for any commercial use. You can build and test the Neocortex side of a free mod on our free plan.

Does an AI NPC mod work with Xash3D FWGS?

It can. Xash3D FWGS is an open-source engine compatible with Half-Life, and hlsdk-portable builds game code for both GoldSrc and Xash3D. Neocortex is a plain web API, so the same mod code can call it on either engine.

Written by

Sercan Altundas

Date

Oct 20, 2026

Read time

7 min

Similar Posts