Ammo Balancing in Half-Life : Alyx


Ammo balancing creates part of the core tension in Half-Life: Alyx by dynamically adjusting the player's available resources. This creates a feeling that ammo and resources are constantly running low and that the player needs to consider every decision when engaging enemies. This effect is achieved by using several dynamic systems that try to remove outliers, and keep players at the desired level of danger. The two dynamic ammo balancing systems used in Half-Life: Alyx are Ammo Removal and Ammo Drain.
Ammo Removal
Ammo Removal is a dynamic system that will remove resources (ammo, grenades, and health syringes) from the world if the player has too much of any individual resource. It can be enabled by setting that removal is allowed for ammo balancing on most items.
Much like how most games have a maximum carriable amount of ammunition for each weapon, Half-Life: Alyx's Ammo Removal system strives to keep the player's inventory within certain thresholds. These thresholds for default ammo removal can be found in the Skill.cfg file. Below are the default values used for the normal difficulty level:
hlvr_player_ammobal_removeat_pistol "60" ... hlvr_player_ammobal_removeat_shotgun "12" ... hlvr_player_ammobal_removeat_rapidfire "150"
The game checks the player's inventory (including ammo in each weapon) against these values when an item is loaded. Items are loaded in two ways:
- When the player enters the Potential Visibility Set of the item.
- When a point_template is triggered to spawn an item.
When either of these occur and the player has more of a resource type than the threshold for ammo removal, the spawned item is removed. Keep in mind, this includes items in the player inventory including grenades. If the player has grenades in their inventory, a new one will not be spawned.
Unlike grenades, health syringes have specific criteria which determine if they should be removed, including the following scenarios:
- If the player does not have a syringe in their inventory AND has full health, there is a random chance the syringe will be removed.
- If the player does not have a syringe in their inventory AND has less than full health, the syringe will always be spawned.
- If the player has a syringe in their inventory, the item will not spawn.
Lastly, there are additional nuances to the Ammo Removal system to prevent player frustration from having too many items removed as a result of the player having high resource levels. As such, the Ammo Removal system uses a counter to track how many resources have been removed. After seven items have been removed, the eighth one will not be. After the eighth item is not removed, the counter starts again.


Ammo Drain
The Ammo Drain system is designed around long-term ammo balancing across several levels or even chapters.
This system revolves around slightly randomizing enemy health to create uncertainty, then adjusting that randomness as the player exceeds certain ammo values.
The main goal of this is for the player to take a couple extra shots then what they normally would.
The main guts of this system is defined by these values in the Skill.cfg (normal difficulty settings):
hlvr_player_ammobal_min_pistol "20" hlvr_player_ammobal_max_pistol "60" ... hlvr_player_ammobal_min_shotgun "8" hlvr_player_ammobal_max_shotgun "12" ... hlvr_player_ammobal_min_rapidfire "90" hlvr_player_ammobal_max_rapidfire "150"
At the hlvr_player_ammobal_min*
value the system takes effect and begins randomly adjusting the player's damage. The likely hood of this system taking effect increases as the player approaches hlvr_player_ammobal_max*
.
After that value is reached, the system will continue to increase the probability that the player's damage will be adjusted. Potentially, at a faster growth rate then before.
There are upper limits to this, however--and it does not apply to all enemy types.
This is defined by these values in the Skill.cfg:
sk_zombie_max_additional_ammo_shots "18" sk_headcrab_max_additional_ammo_shots "4" sk_barnacle_max_additional_ammo_shots "8" sk_combine_max_additional_ammo_shots "16"
An enemy cannot take more shots to kill then these values. However, they can take less, due to how this system works.
If this limit has been not been reached, and the shot fired is randomly decided to have it's damage adjusted, the damage will be capped at these values per weapon:
hlvr_player_ammobal_drain_pistol "4" ... hlvr_player_ammobal_drain_shotgun "6" ... hlvr_player_ammobal_drain_rapidfire "4"
Compare this to the default damage values for these weapons:
vr_energygun_dmg "8" vr_energygun_burstdmg "10" vr_energygun_handcannon_dmg "6" ... vr_rapidfire_dmg "4"
With the exception of the pistol, all this system will do is randomly remove damage multipliers.
This matters little for some weapons, like the shotgun, due to the number of pellets fired per shot, and its high default damage.
This system is reminiscent of systems seen in other survival-action games. It creates uncertainty, prevents players from "counting their shots", and helps control ammo "snow balling", but (partially due to its randomness) has little short-term effects.
Best Practices
These ammo balancing systems are not meant to prevent the player's inventory from "snowballing" just slow it down.
It encourages the player's inventory to stay in a certain area, but it does not prevent it from exceeding that. Thorough players can still find an advantage.
These won't solve poor designer choices.
With that in mind, below are some tips and tricks to take advantage of these systems, while also encouraging good design for Half-Life: Alyx's gameplay.
Ammo Pacing
Since the Ammo Removal system checks the player's current ammo state, it is often best to "trickle" items. Placing them farther apart will give the system time to adapt to the player's ammo situation.
This works best in linear layouts, but through use of objects such as Combine Lockers, the designer can check the player's ammo state at the exact time the ammo is discovered.
Below is an example of firing an output right when the locker is opened:
My Output | Target Entity | Target Input | Parameter | Delay |
---|---|---|---|---|
Ouput_OnHackSuccess | [locker_template] | ForceSpawn | 0.00 |
Though, this can be used outside of Combine Lockers. Pad-Locked supply closets, closed containers, or even some drawers, can have the items spawn right when they are opened.
This gives designers more flexibility in less linear environments. However, having every box opened be empty can hurt exploration, so it's advised to not have all items be removable.
Pacing items like this has additional benefits.
"Scavenging fatigue" is real, and can be quite annoying if not accounted for. Picking up 20 items in 20 seconds WILL get annoying. Especially considering the extra interactivity required of VR, making sure a player isn't constantly opening every drawer, and shoving stuff in their backpack, can help keep them engaged.
Paced ammo also helps prevent player mishap. Large stockpiles, spread out, increase the risk of the player miss-using their ammo and running out. Depending on the time between stockpiles, a player may blame the designer, and not some mistake they made 5 rooms ago. In Half-Life: Alyx, running out of ammo is considered a "fail state", so players should understand why they have essentially "lost".
Ammo Variety
Both the Ammo Removal and the Ammo Drain systems do their calculations on a per weapon basis. This means keeping caches of supplies varied will help prevent the system from removing everything.
For example, a player may not need pistol ammo, so it all gets removed, but they do need shotgun ammo, so that still spawns.
Keeping the ammunition the player has varied also helps prevent the player from completely running out, while still giving them the feeling that they could.
If a player manages their ammunition poorly, they are more likely to "run dry" on a specific weapon. This can lead to dynamic tactics changes--often to sub-optimal ones. It is not optimal (or feel good) to kill an antlion with only a shotgun, but if that's all a player has left, that is what they must do. Playing past mistakes like this can often feel better and more immersive then simply running out of ammo and "losing", requiring a re-load.