Skip to content

Latest commit

 

History

History
executable file
·
182 lines (115 loc) · 17.1 KB

spawn.md

File metadata and controls

executable file
·
182 lines (115 loc) · 17.1 KB

SpawnCycle Docs

Overview

Controlled Difficulty includes the SpawnCycle system. This is optional. When enabled, it bypasses standard KF2's random zed spawns and instead spawns a user-specified list of zed squads in predictable order. There are two ways to activate this feature.

  • SpawnCycle=<name_of_preset> activates one of CD's builtin, standard, handcrafted spawnlists. The command CDSpawnPresets lists all available preset names and the game lengths supported by each preset. This is easy to use, though the presets are not customizable. Note that CD must already be loaded before CDSpawnPresets will work.
  • SpawnCycle=ini tells CD to look in KFGame.ini for a spawnlist. This provides maximum control. You can control every zed that spawns, in what squads, and in what order, on every wave. This is highly customizable, though it requires editing KFGame.ini manually.

To turn it off, set SpawnCycle=unmodded. It is off by default.

Because the SpawnCycle system spawns zeds in a fixed order, it avoids a significant aspect of luck when comparing challenge runs. The only aspect of spawning it does not control is spawnpoint selection.

What can SpawnCycle do?

SpawnCycle is lets you decide what zeds you want to spawn each wave, and in what order. You can use this to create elaborate waves with custom squads and predictable difficulty, or you can use it to just spawn a parade of scrakes to practice decapitating them. If you can imagine a particular series of zeds, you can make it happen with SpawnCycle.

Background: Details about KF2's Spawn System

A squad is a predefined group of zeds that the game attempts to spawn simultaneously. Examples of squads that the standard game can spawn:

  • 4 cysts
  • 2 slashers, 3 gorefasts, and a scrake
  • 3 fleshpounds

Standard KF2 comes with predefined squad definitions, called "archetypes", created by Tripwire. A list of archetypes is associated with each combination of difficulty+gamelength+wavenumber. For a full list of these archetypes, consult Simple Cat's KF2 spreadsheet or open the KF2 SDK and browse Packages->Gameplay->GP_Spawning_ARCH

When a wave starts, the game creates an initially-empty squadlist. The game iterates through all "normal squad" archetypes, adding each one to the its list. The game then randomly selects one "special squad" archetype and adds it to the squadlist. The game then randomly shuffles the entire squadlist.

The game then spawns each squad in the squadlist.

If the game reaches the end of the squadlist before the wave ends, then it discards the used-up squadlist and repeats entire squadlist-building process from the start. However, there is one complication. On the 2nd, 4th, 6th, ... squadlists, the game only uses "normal squad" archetypes. It does not spawn a "special squad" archetype on these even-numbered squadlists. This behavior creates a natural hard-easy-hard-easy-... rhythm. The beginning of a wave tends to be more hectic because the spawn list includes a special squad, but that is followed by a less hectic spawn list with no special squad, then there is another spawn list with a special squad that makes the game more hectic, etc.

Note that "normal squad" is somewhat misleading. In later waves on higher difficulties, a "normal squad" may include up to one scrake. For example, there are two separate "normal squad" archetypes on Wave 10 HOE that have one scrake each. This means even the squadlists without a "special squad" archetype will still have two scrakes, and squadlists with a "special squad" archytpes have two extra scrakes mixed in.

This system removes player control over difficulty. It has two key problems:

  • Special squads are selected totally randomly, but they vary widely in comparative difficulty.

    For instance, Wave 10 HOE special squads vary from 2 SC + 4 Stalkers (probably the easiest) to 2 FP + 3 Scrakes or 3 FP (probably the hardest).

  • Shuffling the squad list creates unpredictably distributed big zeds. They could all spawn at the same time, or they could be evenly-spaced among trash spawns with rest time in between.

    Consider the beginning of Wave 10 HOE. The normal squads guarantee two scrakes in one squad each. For the sake of discussion, say that the game randomly chooses the 2 FP + 2 SC special squad at the start of the wave. The game then shuffles the list. This could result in 6 SC + 2 FP spawning nearly consecutively (if all of those squads happen to randomly shuffle next to each other), or it could result in the squads being spread out over the wave, so that two scrakes march out one at a time with a short break, and then the 2 FP + 2 SC squad emerges alone later. This variation can actually be even more severe than described, since it is possible that the big zed squads from one list might immediately precede big zed squads from the next list, depending on how the shuffles went.

Benefits of CD's SpawnCycle System

CD lets the user define, for each wave, exactly what squads spawn and in what order. This offers both fine control and reproducibility.

Fine control: Specify as many or as few squads as you want. Compose squads with whatever combination of zeds you want. CD spawns zeds as listed without shuffling. This system supports all squads used in the base game, but also permits squads unseen in the base game (e.g. 4 FP), should you wish to use such squads.

Reproducibility: This system removes random spawn list shuffling. The only random aspect is spawnpoint selection. On solo maps like Hillside or Midnightpark, spawnpoint selection is nearly irrelevant, and only zed spawn order and rate really matters. This is where deterministic spawns really help. Once you've set the spawn list and rate, every run presents effectively identical difficulty. The game doesn't randomly get harder or easier from one attempt to the next depending on random list generation and shuffling, like in the standard game. This takes a major luck aspect out of challenges.

Getting Started: Commands and Options

To control this feature, set SpawnCycle=<some_value> on your open command when starting CD. SpawnCycle takes the following values:

  • ini: Spawn zeds according to the SpawnCycleDefs settings in KFGame.ini. The syntax for SpawnCycleDefs is described in a later section of this document.
  • anything else: Interpreted as the name of SpawnCycle preset. Must be listed in CDSpawnPresets and must support the selected game length.
  • unmodded: Use standard KF2's randomized spawn system. This effectively disables spawn cycles.

For example, this command would load KF-Hillside-B4 with the SpawnCycle preset named basic_moderate:

open KF-Hillside-B4?game=ControlledDifficulty.CD_Survival?SpawnCycle=basic_moderate

Some commands are available to display information about spawn cycles.

CDSpawnPresets lists available SpawnCycle preset names, accession dates, and authors.

CDSpawnSummaries [optional_cycle_name [optional_player_count]] projects the estimated number of zeds per wave, breaking fleshpounds, scrakes, sirens, husks, bloats, and trash into separate counts. It considers the currently loaded SpawnCycle if no parameters are specified. If the optional_cycle_name parameter is present, then it interprets it as a SpawnCycle value and projects for that one instead of whatever is loaded. By default, it projects zed counts for one player plus the WaveSizeFakes setting, considering FakesMode. However, if running on a server or if you just want to see pro-forma numbers for a different player count, you can specify the optional_player_count parameter, which must be a positive integer. This overrides the guessed 1 + fakes value when specified. This command does not consider the boss wave. It only considers regular waves.

CDSpawnDetails [optional_cycle_name] lists the exact spawn squads scheduled for each wave. Summaries just counts the number of cysts, gorefasts, crawlers, etc per wave; this command, on the other hand, describes exactly what squads spawn on each wave, and in what order. It is more verbose than the summaries.

loading the mod

listing known presets

running cdspawnsummaries

running cdspawndetails

INI Configuration Syntax

When SpawnCycle=ini is specified on CD's open command, CD looks for SpawnCycleDefs lines in KFGame.ini's [ControlledDifficulty.CD_Survival] section. SpawnCycleDefs can only appear in KFGame.ini under this section. There is no way to specify SpawnCycleDefs in the open command. This makes SpawnCycle=ini currently the only aspect of CD that requires manual config editing to use.

The first SpawnCycleDefs that appears in KFGame.ini controls Wave 1, the second controls Wave 2, etc. The number of SpawnCycleDefs must match the game length or an error message will be printed at game startup and CD will revert to unmodded spawn behavior.

A single SpawnCycleDefs line for a wave is a comma-separated list of squads. Squads are comprised of one or more underscore-separated elements, where each element is a number and a zed type. This allows for heterogeneous squads.

The squads on each SpawnCycleDefs are spawned in the order listed. If only part of a squad can be spawned (because of MaxMonsters), then zeds are spawned left-to-right within the squad. For example, assume we have a game in progress and already at the MaxMonsters cap, so that new nothing can spawn. One zed dies. The next squad to spawn is 2Stalker_1Cyst. CD will spawn one stalker. Another zed dies. CD spawns the second stalker. Another zed dies. CD will then spawn the cyst.

If CD reaches the end of a SpawnCycleDefs list before the end of the wave, then CD goes back to the beginning of the SpawnCycleDefs line and repeats it. This is why they're called cycles. They repeat as necessary to supply the number of zeds required for the selected difficulty, wave number, and player count.

Each squad must contain between one and ten zeds (inclusive). Each wave defined with SquadCycleDefs should have at least one squad.

Here's an artificially simple SpawnCycleDefs line illustrating the basic syntax:

SpawnCycleDefs=4ClotA,4Stalker_2Crawler

The following zed names are accepted in SpawnCycleDefs:

  • AL(PHA), CA, ClotA
  • B(LOAT)
  • CR(AWLER)
  • CY(ST), CC, ClotC
  • F(LESHPOUND), FP
  • G(OREFAST), GF
  • H(USK)
  • KI(NGFLESHPOUND), KF, KFP (EXPERIMENTAL, might be changed or removed)
  • MI(NIFLESHPOUND), MF, MFP
  • SC(RAKE)
  • SI(REN)
  • SL(ASHER), CS, ClotS
  • ST(ALKER)

Letters in parentheses may be omitted or shortened on the right. All zed names are completely case-insensitive.

For example, any of the following strings is a valid way to spell a fleshpound:

  • fp
  • FP
  • Fp
  • FL
  • Fl
  • fle
  • flesh
  • fleshp
  • FleshPound

Whereas all of the following strings are invalid (don't do this):

  • flp
  • FPound
  • POUND

Albino/Special Zed Variants

At the time this document was last updated, there are several albino zed variants in survival, also known as elite variants, special variants, or king variants (TWI's source code in particular calls them "king" variants):

  • AL(PHA)*, CA*, ClotA* (Albino Alpha Clot)
  • CR(AWLER)* (Albino Crawler)
  • G(OREFAST)*, GF* (Albino Gorefast -- two blades)

The asterisk suffix makes these zeds albino/special. For example, "Crawler*" would spawn a gas grawler and "AL*" would spawn an albino alpha clot. Appending a * character to a zed that has no albino variant generates an error message and causes the SpawnCycle to be rejected.

When CD's AlbinoCrawlers, AlbinoAlphas, and AlbinoGorefasts options are set to false, the associated zed albino type cannot spawn, even if the SpawnCycle says so. When those options are set to true, the associated albino zed type spawns whenever the SpawnCycle dictates. If the SpawnCycle does not include any albino zeds, then none will spawn even if one of the Albino... options is set to true.

Fleshpounds that Rage at Spawntime

In v1053, TWI introduced a random chance for fleshpounds to rage when they spawn. SpawnCycles let you control this behavior. Ordinarily, a fleshpound squad will not spawn raged. Its members have to go through the traditional FP rage process: either become raged due to damage taken, or see a target and eventually hit the enrage timer.

However, if a FP squad in a SpawnCycle has the "!" suffix character, then its members spawn raged. This works on both fleshpounds and mini fleshpounds (also known in-game as "Quarter Pounds"). It does not currently work with king fleshpounds.

For example, 1FP! would spawn a fleshpound that is raged from the instant it spawns. 2MFP! would spawn a pair of minifleshpounds that are both raged from the instant they spawn.

When CD's FleshpoundRageSpawns option is set to false, then fleshpounds never spawn raged, even if the SpawnCycle says so. When that option is set to true, then behavior depends on the SpawnCycle setting. If the SpawnCycle includes some FP squads with the "!" suffix, then those will spawn enraged. If the SpawnCycle does not include any FP squads with the "!", then no enraged FPs will spawn, even though FleshpoundRageSpawns is true. If SpawnCycle is unmodded and this option is true, then each FP will randomly decide whether to spawn enraged using a chance dependent on the difficulty, just like in TWI's vanilla game.

The FleshpoundRageSpawns option affects only fleshpounds and mini fleshpounds, not kings. Note that CD's current support for king fleshpounds is tentative and could be removed or altered.

Sample Configuration: basic_moderate Preset

The following KFGame.ini snippet reflects the basic_moderate preset. This could be useful if you want to start tweaking an existing preset rather than starting from scratch.

Here are some charts visualizing how the preset's big zeds and husks are distributed: http://imgur.com/a/oKVmS

[ControlledDifficulty.CD_Survival]
SpawnCycle=ini
Sp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