Difficulty scaling: Difference between revisions

Jump to navigation Jump to search
imported>Leoetlino
imported>Leoetlino
m (terms)
Line 16: Line 16:
Only the defeated counter flags are stored in the save file. The <code>Ecosystem::LevelSensor</code> subsystem is responsible for [[Difficulty scaling#Ecosystem::LevelSensor::calculatePoints|converting these kill counts to points]] using a [[Difficulty scaling#Ecosystem::LevelSensor::loadByml|configuration file]].
Only the defeated counter flags are stored in the save file. The <code>Ecosystem::LevelSensor</code> subsystem is responsible for [[Difficulty scaling#Ecosystem::LevelSensor::calculatePoints|converting these kill counts to points]] using a [[Difficulty scaling#Ecosystem::LevelSensor::loadByml|configuration file]].


The subsystem provides two functions ([[Difficulty scaling#Ecosystem::LevelSensor::loadWeaponInfo|<code>loadWeaponInfo</code>]] and [[Difficulty scaling#Ecosystem::LevelSensor::loadActorInfo|<code>loadActorInfo</code>]]) that may be called when a weapon or enemy actor is loaded.
The subsystem provides two functions ([[Difficulty scaling#Ecosystem::LevelSensor::scaleWeapon|<code>scaleWeapon</code>]] and [[Difficulty scaling#Ecosystem::LevelSensor::scaleActor|<code>scaleActor</code>]]) that may be called when a weapon or enemy actor is created.


== Scaling inhibitors ==
== Scaling inhibitors ==
Line 26: Line 26:


== Weapons ==
== Weapons ==
'loadWeaponInfo' is called (i.e. weapons may be scaled) for a weapon if:
'scaleWeapon' is called (i.e. weapons may be scaled) for a weapon if:
* '''For standalone weapons''': The actor property 'LevelSensorMode' is higher than 1 '''and''' it wasn't already picked up.
* '''For standalone weapons''': The actor property 'LevelSensorMode' is higher than 1 '''and''' it wasn't already picked up.
* '''For treasure chest drops''': Always upon opening or destroying the chest.
* '''For treasure chest drops''': Always upon opening or destroying the chest.
Line 61: Line 61:


=== <code>LevelSensorMode</code> ===
=== <code>LevelSensorMode</code> ===
This actor property controls whether scaling is enabled for an enemy or weapon. Also applies to any weapons held by an enemy since 'loadWeaponInfo' is called when an enemy drops their weapon.
This actor property controls whether scaling is enabled for an enemy or weapon. Also applies to any weapons held by an enemy since 'scaleWeapon' is called when an enemy drops their weapon.


Note that this doesn't apply to weapons that are attached to a Hinox's necklace, because Hinoxes use a different underlying enemy actor which overrides the 'on weapon dropped' function and ignores 'LevelSensorMode'.
Note that this doesn't apply to weapons that are attached to a Hinox's necklace, because Hinoxes use a different underlying enemy actor which overrides the 'on weapon dropped' function and ignores 'LevelSensorMode'.
Line 120: Line 120:
In practice, settings have never been modified. 1.5.0 (which will likely be the last game update) still has the same Level2WeaponPower and Level2EnemyPower.
In practice, settings have never been modified. 1.5.0 (which will likely be the last game update) still has the same Level2WeaponPower and Level2EnemyPower.


=== <code>Ecosystem::LevelSensor::loadWeaponInfo</code> ===
=== <code>Ecosystem::LevelSensor::scaleWeapon</code> ===
Called from treasure chest code, enemy actors{{Check}}, <code>Ecosystem::LevelSensor::loadActorInfo</code>
Called from treasure chest code, enemy actors{{Check}}, <code>Ecosystem::LevelSensor::scaleActor</code>


Given a weapon name, its modifier and current point status, this function returns the weapon to actually spawn and the modifier to use (if possible).
Given a weapon name, its modifier and current point status, this function returns the weapon to actually spawn and the modifier to use (if possible).
Line 129: Line 129:
Pseudocode (1.0.0):
Pseudocode (1.0.0):
<source lang="c++">
<source lang="c++">
bool Ecosystem::LevelSensor::loadWeaponInfo(StringView weapon_to_look_up,
bool Ecosystem::LevelSensor::scaleWeapon(StringView weapon_to_look_up,
                                             WeaponModifier required_modifier,
                                             WeaponModifier required_modifier,
                                             const char** weapon_to_use_name,
                                             const char** weapon_to_use_name,
Line 182: Line 182:
</source>
</source>


=== <code>Ecosystem::LevelSensor::loadActorInfo</code> ===
=== <code>Ecosystem::LevelSensor::scaleActor</code> ===
Analogous to <code>LevelSensor::loadWeaponInfo</code>.
Analogous to <code>LevelSensor::scaleWeapon</code>.


Pseudocode (1.0.0):
Pseudocode (1.0.0):
Line 223: Line 223:
     modifier = get_random_blue_modifier(actor->getWeaponName());
     modifier = get_random_blue_modifier(actor->getWeaponName());


   if (loadWeaponInfo(weapon_name, &weapon_to_use, &modifier_to_use)) {
   if (scaleWeapon(weapon_name, &weapon_to_use, &modifier_to_use)) {
     actor->setProperty("SharpWeaponJudgeType", modifier_to_use);
     actor->setProperty("SharpWeaponJudgeType", modifier_to_use);
     *actor_to_use = weapon_to_use;
     *actor_to_use = weapon_to_use;