How should I structure this?

I’m re-writing my object generator for bravely bear and I’m trying to figure out the best way to structure it.

Basically it’s an infinite runner and the further you go the harder it gets and it cycles in new objects.

Each object will start appearing at a starting point and increase in frequency until it reaches its mid point then it will start to decrease in frequency until it reaches its stopping point.

I’m wanting to have every object in the game have:
-A point where it starts to appear
-A mid point where it is most prevalent
-A point where it stops showing up
-A max number of the object so that when it is at the mid point that would be how many there are.
-A list to atlas the instances of the object

So how would you structure this?

I was thinking that I would update one object type per frame so that it doesn’t need to run through everything. The object update would:

  1. Check the position of the character.
  2. Get the number of instances needed by comparing the position to the start, mid, and stop points.
  3. Compare the number needed to the number of instances already made, then make new ones as they’re needed. If it is past the stop point it would clear out the list. The game has GC points in place.
  4. Count how many on the list are awake and compare it to how many are needed.
  5. Awaken additional objects if needed.
  6. The objects will be turn themselves off based on position or collision with the player.

what is your “structure” actually and why did you want it to change ?.

Right now I have a very old and poorly optimized script that just instantiates and chews up memory and needlessly burns through the cpu.