The standard NPCs in Half-Life 2 were created with the action-centric gameplay of Half-Life 2 in mind, so the design process of Duality called for changes to the base NPCs in order to make them usable for stealth gameplay. The figure below shows the changes/modifications made to each enemy in Duality. This rig is used in both the Stealth and Action versions of the level, with the Stealth version simply being a bit more forgiving in the consequences of the player being spotted, whereas the Action version simply reverts back to the bots normal behavior. A couple of editor terms used in the descriptions:
- Entity – A generic HL2 Editor term for any object that is placed in the level. Can be anything from weapons, sounds, lights to a NPC.
- NPC – Non-Player Character. In HL2, this is almost interchangeable with any AI-controlled entity.
Description of each entity of the rig and what it does:
- Guard NPC (Hidden underneath the mess of entities, his leg and arm are visible) – Basic npc_combine_s entity (standard bot), acts as the “parent” of all the other entities (all other objects in the above screen are parented to the Guard NPC, and move with it)
- Enemy Finder NPC (large gray cube) – This is actually a separate NPC (npc_enemyfinder) that is attached to the Guard NPC. It acts as the Guard NPC’s eyes; used so I could control what happens when (and if) the Guard NPC sees the player.
- Stealth Kill Volume (orange cube to the right) – Attached to the Guard NPC; when the player walks into this volume, a visual effect overlay is put on the screen, and the damage dealt by their melee weapon is increased dramatically.
- Microphone – Attached to the Guard NPC; acts as the Guard NPC’s ears. Used so I could control what happens when the Guard NPC hears the player, and the distance at which it can hear the player.
- AI Relationship (brain with two shaking hands) – Sets it so, by default the Guard NPC ignores the player, essentially stifling its hard-coded behavior to attack on sight.
- Player Visible Compare – Checked every time the Enemy Finder NPC “sees” the player; this entity checks to see if the player is currently in a special area marked as a stealth area. If the player is in one of these stealth areas, it does nothing; if not then it tells the Guard NPC to go into attack mode.
- Search Timer – Controls the Guard NPCs search time after the Enemy Finder NPC has lost sight of the player. This turns on if the player has been seen already by the Enemy Finder NPC, but has managed to hide from sight for a certain period of time. It counts down for ten seconds, and if the Enemy Finder NPC has not seen the player again in that time, it resets and tells the Guard NPC to go back to its patrol (via the…)
- Scripted Sequence (big purple cube) – This entity does two things: it renders the Guard NPC deaf, dumb, and blind, and it acts as the starting point for the Guard NPCs patrol path. Without this, the Guard NPCs behavior would become unpredictable after he had been sent into attack mode, and it would also make it difficult to control what AI messages the Guard NPC should ignore.
Duality Gameplay Comparison:
There were also some minor code modifications made for this level, which included:
- Weapon Model Swap – Swapped out the normal melee weapon in Half-Life 2, the Crowbar, with the model for the Stun Baton. The Stun Baton assets were copied over from the Half-Life 2: Deathmatch assets, and the reason for the swap was partially for weapon distinction (since the stun baton behaves differently than the standard crowbar in this level) and partially for kicks, since it was closer to the blackjack weapon from the Thief series, which influenced the stealth gameplay I was aiming for with this level
- Viewcone Modifications – The viewcone for the most commonly used guard NPC entity, the npc_combine_s, was modified slightly so they had a bit less peripheral vision.