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

Every Half-Life scientist and security guard has a handful of recorded lines, and every modder who has walked those corridors has wanted to ask one of them a real question. A Half-Life AI NPC mod makes that possible: your game DLL sends what the player says to an AI character and plays the answer back as voice and subtitles. 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

What you could build with Neocortex in Half-Life

Scientists and security guards you can actually talk to

Write your own cast instead of reusing the base game's: Dr. Ilse Marek, a sleep-deprived spectrometry researcher who has not left her lab in three days, and Officer Dale Ruiz, a guard who 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.

Voice commands for the guards

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.

A Black Mesa safety-training 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.

How Half-Life modding works

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.

  • Valve's Half-Life SDK is the official source for both libraries. Valve last updated it in October 2024 to match that month's Steam patch. Its license lets you distribute mods for free only.
  • Xash3D FWGS is an open-source engine compatible with Half-Life that runs on Windows, Linux, BSD and Android. It uses the valve folder from your own copy of the game and is actively developed.
  • hlsdk-portable is the FWGS cross-platform fork of the SDK. It builds with CMake or waf for GoldSrc and Xash3D, includes optional bug fixes, and keeps several community mods as separate branches.

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.

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

How Neocortex fits in

  • 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. The mod uses the Neocortex Voice Commands library 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.

Getting started with your Half-Life AI NPC mod

  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.

Mod policy and fair play

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.

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.

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

Neocortex

Date

Oct 20, 2026

Updated

Oct 20, 2026

Read time

6 min

Similar Posts

Read More