title: Advanced Progressive difficulty monster spawner
body: <p>i am creating a progressive monster spawner just like the one in risk of rain 2. The goal is to have tiers that are full of tiers of monsters. as time increase more and more tiers become available for the spawner to spawn monsters. So that towards the end of the game the strongest tier monsters are spawned. However, i want the tiers and the tiers within the tiers to be weighted depending on the amount of tiers available and that towards the end of the game, tier 7 is more likely to spawn than tier 1. but at the in the middle tier 1 is equally available.</p>
  
  <p>i have one struct within a struct. The first struct determines the Tier that the enemy is in and the second struct the tier within the tier that the enemy is in.</p>
  
  <p>There is a currentTierDifficulty variable which is based on the TimeElapsed. The current tiercap starts at 1 and finishes at whatever number of tiers there are. (realistically around 8 or less). The currenttierdifficulty increases around 0.002 every second which should make it reach tier 8 in around an hour.</p>
  
  <p>The CurrenttTierCap is the currentTierDifficulty rounded to the nearest integer.</p>
  
  <p>any tier below the the currentcap is available to be chosen.</p>
  
  <p>i want each tier to be weighted.</p>
  
  <p>for example: CurrentTierDifficulty = 3.6 currentTierCap = 4</p>
  
  <p>tier 1 &lt;=== (0.4)</p>
  
  <p>tier 2 &lt;=== (0.2)</p>
  
  <p>tier 3 &lt;=== (0.15)</p>
  
  <p>tier 4 &lt;=== (0.05)</p>
  
  <p>tier 5 not available because lower than currenttiercap</p>
  
  <p>tier 6 not available because lower than currenttiercap</p>
  
  <p>tier 7 not available because lower than currenttiercap</p>
  
  <p>etc</p>
  
  <p>but i also want the weight to slowly shift towards the end of the tier list so that toward the end of the one hour, you will only have tier 5, 6 and 7 monsters spawning.</p>
  
  <p>so whenever i decide to spawn an enemy, a function checks the two struct and randomly selects a monster based on all of this information</p>
  
  <p>i tried to make it as clear as i possibly can.</p>
  
  <p>Here i will add all of the enemies in the inspector of unity. </p>
  
  <pre><code>[Serializable]
       public struct EnemyTier
       {
           public float BaseWeight;
           [Serializable]
           public struct NamedEnemy
           {
               public string name;
               public int BaseHealth;
               public float BaseDamage;
               public float BaseSpeed;
               public GameObject EnemyPrefab;
           }
           public NamedEnemy[] Enemie;
       }
       public EnemyTier[] Enemies;
  
       int TotalNumberofTiers;
       public int TimeinMinutes = 400;
       public float TierDifficulty = 1;
       public float TierIncreasePer10Seconds;//default is 0.002 per sec = 7.2 in one hour
  
       private void Start()
       {
           TotalNumberofTiers = Enemies.Count();
           TierIncreasePer10Seconds = TotalNumberofTiers / TimeinMinutes;
           InvokeRepeating("DifficultyAdjustment", 10,10);
       }
  
  
  
       /// &lt;summary&gt;
       /// selects the appropriate enemy from the structs
       /// &lt;/summary&gt;
       public GameObject EnemySelection()
       {
  
           int PrecentageChance = 100 / TotalNumberofTiers;
           int CurrentTierCap = Mathf.RoundToInt(TierDifficulty);
   public void DifficultyAdjustment()
  {
      TierDifficulty += TierIncreasePer10Seconds;
  }
  </code></pre>
  
  <p>i am stuck here and cant get further cuz it requires allot of math work.</p>