Difficulty scaling/en: Difference between revisions

Updating to match new version of source page
(Updating to match new version of source page)
(Updating to match new version of source page)
Line 1: Line 1:
<languages/>


'''Difficulty scaling''' is a mechanic in ''Breath of the Wild'' that results in enemies and weapons being progressively replaced by more powerful variants during a playthrough.
'''Difficulty scaling''' is a mechanic in ''Breath of the Wild'' that results in enemies and weapons being progressively replaced by more powerful variants during a playthrough.
Line 194: Line 196:


Interestingly, the game calculates a single point value based on the kill counter flags but calculates two separate values for weapons and enemies with two different multipliers. This format makes it possible to easily change the scaling.
Interestingly, the game calculates a single point value based on the kill counter flags but calculates two separate values for weapons and enemies with two different multipliers. This format makes it possible to easily change the scaling.
<source lang="c++">
<source lang="c++">
float points = 0.0;
float points = 0.0;
Line 199: Line 203:
     int kill_count = GameData::getIntegerFlag(kill_flag["name"]);
     int kill_count = GameData::getIntegerFlag(kill_flag["name"]);
     points += kill_count * kill_flag["point"];
     points += kill_count * kill_flag["point"];
 
\\
this->points = points;
this->points = points;
this->weapon_points = points * this->byml["setting"].Level2WeaponPower;
this->weapon_points = points * this->byml["setting"].Level2WeaponPower;
this->enemy_points = points * this->byml["setting"].Level2EnemyPower;
this->enemy_points = points * this->byml["setting"].Level2EnemyPower;
</source>
</source>
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.


Line 214: Line 220:


Pseudocode (1.0.0):
Pseudocode (1.0.0):
<source lang="c++">
<source lang="c++">
bool Ecosystem::LevelSensor::scaleWeapon(const sead::SafeString& weapon_to_look_up,
bool Ecosystem::LevelSensor::scaleWeapon(const sead::SafeString& weapon_to_look_up,
Line 222: Line 230:
{
{
   // some checks using 'unknown' here which seems to be a pointer to the actor
   // some checks using 'unknown' here which seems to be a pointer to the actor
 
  //
   for (weapon_table : this->byml["weapon"]) {
   for (weapon_table : this->byml["weapon"]) {
     // find the first weapon entry for which the player has enough points
     // find the first weapon entry for which the player has enough points
Line 230: Line 238:
       entry = weapon_table["actors"][j];
       entry = weapon_table["actors"][j];
       float points_for_next_transition = entry["value"];
       float points_for_next_transition = entry["value"];
 
      //
       if (this->weapon_points > points_for_next_transition &&
       if (this->weapon_points > points_for_next_transition &&
           weapon_to_look_up == entry["name"] &&
           weapon_to_look_up == entry["name"] &&
Line 238: Line 246:
       }
       }
     }
     }
 
    //
     if (i == -1)
     if (i == -1)
       continue;
       continue;
 
    //
     do {
     do {
       entry = weapon_table["actors"][i];
       entry = weapon_table["actors"][i];
 
      //
       // not_rank_up means there is no link between weapons;
       // not_rank_up means there is no link between weapons;
       // this table is just used to look up modifiers.
       // this table is just used to look up modifiers.
Line 251: Line 259:
       if (weapon_table["not_rank_up"] && entry["name"] != weapon_to_look_up)
       if (weapon_table["not_rank_up"] && entry["name"] != weapon_to_look_up)
         break;
         break;
 
      //
       // otherwise, just go down the list until we reach the end or a weapon which
       // otherwise, just go down the list until we reach the end or a weapon which
       // requires more points. this will possibly upgrade the weapon (e.g. Knight -> Royal).
       // requires more points. this will possibly upgrade the weapon (e.g. Knight -> Royal).
       if (this->weapon_points <= entry["value"])
       if (this->weapon_points <= entry["value"])
         break;
         break;
 
      //
       ++i;
       ++i;
     } while (i < weapon_table["actors"].size);
     } while (i < weapon_table["actors"].size);
 
    //
     *weapon_to_use_name = entry["name"];
     *weapon_to_use_name = entry["name"];
     *modifier_to_use = convert_to_modifier(entry["plus"]);
     *modifier_to_use = convert_to_modifier(entry["plus"]);
Line 272: Line 280:


Pseudocode (1.0.0):
Pseudocode (1.0.0):
<source lang="c++">
<source lang="c++">
if (actor->params["LevelSensorMode"] < 1)
if (actor->params["LevelSensorMode"] < 1)
   return false;
   return false;
 
//
if (actor_name.contains("Enemy")) {
if (actor_name.contains("Enemy")) {
   for (enemy_table : this->byml["enemy"]) {
   for (enemy_table : this->byml["enemy"]) {
Line 286: Line 296:
       }
       }
     }
     }
 
    //
     if (i == -1)
     if (i == -1)
       continue;
       continue;
 
    //
     do {
     do {
       entry = enemy_table["actors"][i];
       entry = enemy_table["actors"][i];
Line 296: Line 306:
       ++i;
       ++i;
     } while (i < enemy_table["actors"].size);
     } while (i < enemy_table["actors"].size);
 
    //
     *actor_to_use = entry["name"];
     *actor_to_use = entry["name"];
     return true;
     return true;
Line 302: Line 312:
   return false;  // cannot scale up
   return false;  // cannot scale up
}
}
 
//
if (actor_name.contains("Weapon")) {
if (actor_name.contains("Weapon")) {
   weapon_name = actor->getWeaponName();
   weapon_name = actor->getWeaponName();
Line 308: Line 318:
   if (modifier == WeaponModifier::RandomBlue)
   if (modifier == WeaponModifier::RandomBlue)
     modifier = get_random_blue_modifier(actor->getWeaponName());
     modifier = get_random_blue_modifier(actor->getWeaponName());
 
  //
   if (scaleWeapon(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);
826

edits