What stealth elements are in Half-Life 2 and how does the enemy AI detect the player?
Solution 1:
Enemy scripting tends to keep them from activating until the player has arrived in the area. Gunfire within their "arena" will alert them, but generally they're already active by then. Walking and crouching doesn't have any game effect on detection. Most detection isn't – it's scripted activation, not AI detection.
Enemies are insensitive to light levels. The flashlight doesn't alert them to your presence. Usually they already act like they know you're there. Hiding and line-of-sight is not a notable game mechanic. Enemies either know you're there or they don't – once activated, they will know where you are at all times (unless of course they're acting out a "where is the target" scripted scene, which happens but is limited to fixed moments in the game).
Enemies are alerted forever, and all enemies in an arena's group will activate at the same time as soon as you arrive at the trigger location. They don't deactivate or engage in a search routine like in stealth-based games.
Enemy activation is mostly or entirely scripted. You generally can't avoid detection, although you sometimes have a second or two between when the script triggers and when the script makes the enemy start acting like it's aware of you. You can get off a few shots in that time, but there's no way to avoid activation once their script starts running.
The different categories of enemies are scripted to act differently. Combine soldiers and support creatures generally behave as if they are using networked/radio intelligence on your location. Animals and xenofauna behave more like animals, using different triggers (e.g. stepping on sand near antlions, water creatures ignoring you until you're in the water) to activate.