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 11:12, 1 July 2023 by Ihonnyboy (talk | contribs) (Adjusted warning positions)
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 item 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:The PVS in HLA can be finicky, point_template spawns is what is mostly used by Valve.
Warning.pngWarning:THIS SYSTEM IS NOT AWARE OF OTHER NEARBY ITEMS! Only what the player currently has.


Due to the "all or nothing" system, supplies are often given one at a time

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

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

(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.

Pacing

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

Variety

Keeping supplies varied ensures the player always has options

See Also