This article relates to the game "Half-Life: Alyx". Click here for more information.
This article relates to the workshop tools for "Half-Life: Alyx". Click here for more information.
This article's documentation is for Source 2. Click here for more information.

Ammo Balancing in Half-Life : Alyx

From Valve Developer Community
< Half-Life: Alyx Workshop Tools‎ | Level Design
Revision as of 09:10, 1 July 2023 by Ihonnyboy (talk | contribs) (placeholder text)
Jump to navigation Jump to search
English (en)Translate (Translate)

Ammo Types

A major part of the core tension of Half-Life: Alyx comes from the player's limited resources. Your ammo is constantly running low, and every missed shot or poorly used weapon, matters. This all comes from spot on ammo balancing. There's no "magic bullet" to achieve this perfectly every time, but Half-Life: Alyx does include several dynamic systems that try to remove any outliers, and keep players in the perfect levels of danger. These two systems are Ammo Removal and Ammo Drain.

Todo: Page under construction


Ammo Removal

Ammo Removal is a system that will remove items from the world if the player has too many of it. It can be enabled with this setting on most items.

Remove ammo setting.png

Consider this a lot like the "max ammo" in most other games. The systems strives to keep the player's inventory within certain numbers.

These numbers can be found in the Skill.cfg (normal difficulty values below).

hlvr_player_ammobal_removeat_pistol			"60"
...
hlvr_player_ammobal_removeat_shotgun		"12"
...
hlvr_player_ammobal_removeat_rapidfire		"150"
Point Template ex.png

The game checks the player's inventory (including ammo in a weapon) against these values when an item is loaded in.

This can be when the ammo enters the Potential Visibility Set or is spawned via a Point_template.

If the player has more then these values, the item is removed.

Keep in mind, this includes items such as grenades; if the player has this item in their inventory, a new one will not be spawned.

Note.pngNote:THIS SYSTEM IS NOT AWARE OF OTHER NEARBY ITEMS! Only what the player currently has.


Keeping ammo stockpiles varied can help prevent the system from removing all supplies

However, there is more nuances to this system, as never finding an item for long periods of time can be frustrating.

There exists an invisible counter. After seven items have been removed, the eighth one will not be.

After that , the counter starts again.


There is some additional logic when it comes to health syringes:

  • If you have full health and no syringe in a pocket, there is a random chance of the item spawning
  • If you have less than full health and no syringe in a pocket, the item will always spawn
  • If you have a syringe in a pocket, the item will not spawn (respecting the above counter)
Todo: This was tested on normal difficulty, hard difficulty has additional settings that can change this

Ammo Drain

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"
hlvr_player_ammobal_drain_pistol			"4"
...
hlvr_player_ammobal_drain_shotgun			"6"
...
hlvr_player_ammobal_drain_rapidfire			"4"
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"

Best Practices

The Combine Locker prefab is often used to efficiently spawn ammo
Pacing scavenging can help reduce fatigue
My Output Target Entity Target Input Parameter Delay
Ouput_OnHackSuccess [locker_template] ForceSpawn 0.00

(temporary text) These additional "safety nets" all point to one fact: this system is 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.

This won't solve poor designer choices.

See Also