Neocortex Logo
Build a Portal 2 AI mod: a sarcastic test-chamber AI that reacts to your attempts, voice-controlled chambers and a science quiz, bridged from VScript.

Portal 2 AI Mod: A Talking Test-Chamber AI and Voice Commands

ModdingPortal 2AI NPC

Portal 2 is a game about being judged by a voice in the walls, so a Portal 2 AI mod that gives your test chamber its own talking AI is a natural fit. Picture a chamber that notices you failing the same jump five times and has something to say about it, a chamber you control by speaking, and a quiz that only opens the exit for correct answers. Neocortex provides the AI character, Conversation Flows, quizzes and on-device voice commands; a small helper app connects them to your map.

Portal 2 in-game screenshot Screenshot: Portal 2 © Valve

What you could build with Neocortex in Portal 2

A sarcastic test-chamber AI

Create an original overseer instead of borrowing the game's: PROCTOR-7, a facility intelligence that was demoted to running one chamber and is not happy about it. Give it a Personality, an Emotion setting and a Knowledge base about your chamber's solution, its history and its petty grievances.

Your map reports what happens: "player fell in the goo", "third failed fling at panel B", "cube placed on the wrong button", "player has been standing still for 40 seconds". The helper app sends those as events with each message, and PROCTOR-7 comments in voice, with an emotion tag on every line (CURIOUS when you try something new, ANGRY when you break the intended solution). It can also return actions, such as a grudging { "name": "SPAWN_CUBE", "targetId": "dropper_01" } after enough failures, which your map runs as a hint.

A Conversation Flow can turn the whole chamber into a story: introduction, first test, a "malfunction" the player has to talk PROCTOR-7 through, and a final test. Each checkpoint keyword the API returns opens the next part of the map.

A voice-command test chamber

Build a chamber the player solves by talking to it. In the Neocortex dashboard you design a command set as actors, actions and objects: actor "chamber", actions "raise", "lower", "drop" and "extend", objects "platform", "cube" and "bridge". Players speak naturally, and the helper receives matched commands instantly, including several actions and quantities in one sentence: "drop two cubes and raise the platform". It works with push-to-talk or always-listening, in multiple languages, and runs on the player's machine with no cloud round trip, which matters when the timing of a fling depends on it. Voice Commands is a licensed SDK: contact us for a Voice Commands license.

A science quiz chamber

Make a chamber where the puzzle is the player's knowledge. An announcer character asks physics questions built in the Neocortex dashboard: momentum, gravity, why a portal keeps your speed. The quiz engine (Team plan) runs the questions and scoring; each right answer powers one more light bridge segment, and a wrong one drops a cube into the goo.

How Portal 2 modding works

Portal 2 maps are built in Hammer with the Portal 2 Authoring Tools and shared on the Steam Workshop. Map logic is entity I/O plus VScript, which in Portal 2 is Squirrel. VScript can read and move entities, track the player and print to the console, but it has no network or HTTP access.

That is why an AI mod for Portal 2 uses a small local helper app:

  • Out of the game. Your VScript prints tagged lines (an event, a chamber state) to the console. Launching Portal 2 with -condebug writes console output to a console.log file the helper can watch. See Valve's command line options.
  • Back into the game. Portal 2 can also open a console port with the -netconport launch option, which lets the helper send console commands back, for example a script call into your map's VScript. Keep that port on your own machine.
  • Subtitles and voice. Your map shows reply text with a game_text entity, and the helper plays the character's voice through the PC's audio output.

Portal 2: Community Edition is worth watching. It is a community-maintained version of Portal 2 on Strata Source, an officially licensed fork of the CS:GO engine branch, and it entered open beta on Steam on April 17, 2026. It is free for Portal 2 owners and adds a native 64-bit port, AngelScript scripting, Panorama UI, an addon system and its own Workshop. It is still a beta, so check its documentation for what its scripting can do; the helper-app pattern works there either way.

Portal 2 in-game screenshot Screenshot: Portal 2 © Valve

How Neocortex fits in

  • Dialogue. The helper reads game state from the console log and sends it with the player's message to a Neocortex character through /v3/chat. The map shows the reply as subtitles, the helper plays the voice from /v3/audio/generate or /v3/audio/stream, and the actions the character returns go back to the map as console commands.
  • Conversation Flows. They steer story beats and return checkpoint keywords (flowState) the map reacts to, such as opening the next test.
  • Quizzes. The quiz engine runs question-and-answer games through /v3/quiz.
  • Voice commands. On-device voice commands turn spoken phrases into game actions without a cloud round trip. The helper uses the Neocortex Voice Commands library on the player's machine.

The helper can be written in any language with an HTTP client. If you later want the same character in a standalone game, the same character works through our Unity integration.

Getting started with your Portal 2 AI mod

  1. Build a test chamber in Hammer with a VScript file that prints tagged events to the console.
  2. Design your character in the Neocortex dashboard: PROCTOR-7's Personality and Knowledge, a Conversation Flow for the chamber, a quiz, and a command set.
  3. Write the helper app: watch console.log, call /v3/chat, play the voice, and send commands back through the console port.
  4. Keep the API key in the helper's config file, filled in by the player, never hard-coded in a build you share.
  5. Test in single-player with the launch options set, then publish the map on the Workshop and the helper separately.

Mod policy and fair play

Valve's Workshop terms apply to the map, and the helper app is a separate download players choose to run. Keep AI and voice features to single-player chambers, never use them to gain an edge in co-op with players who did not opt in, and have each player use their own Neocortex API key.

For the voice side, read on-device voice commands for game mods. For engine-level mods on Source, see our Half-Life 2 AI NPC mod guide.

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 an AI character to Portal 2?

Yes, with a small helper app. Portal 2 map scripts cannot reach the internet, so the map prints events to the console and a local helper app passes them to an AI character. Neocortex supplies the character, its voice and its replies, and the helper sends them back into the game.

Can Portal 2 VScript make HTTP requests?

No. VScript in Portal 2 is Squirrel running inside the map, with no network access. The usual pattern is to log events to the console, read them from a helper app, and let that app call web APIs such as Neocortex.

Can I control a Portal 2 test chamber with my voice?

Yes. A helper app can listen to the microphone and send matched commands into the game, such as raising a platform or dropping a cube. Neocortex Voice Commands does the matching on the player's PC, so it works offline and responds instantly.

What is Portal 2: Community Edition?

Portal 2: Community Edition is a community-maintained version of Portal 2 on the Strata Source engine, in open beta on Steam since April 2026 and free for Portal 2 owners. It adds AngelScript, Panorama UI and an addon system, and the helper-app pattern for Neocortex works there too.

Can I publish an AI test chamber on the Steam Workshop?

You can publish the map on the Workshop as usual, but the helper app has to be shared separately, for example on GitHub. Each player runs it with their own Neocortex API key, which you can get on our free plan.

Written by

Neocortex

Date

Oct 20, 2026

Updated

Oct 20, 2026

Read time

6 min

Similar Posts

Read More