As a player, I want a building that increases my chances of balloons spawning using the new AI system.
Additionally, as a developer, I want to be able to tweak the balance of this building without having to edit any code (i.e. entirely through @export-ed values).
Design
The religious building has one effect (currently): increasing the probability that a higher number of buildings than normal will spawn per day
Don't worry about creating new variations for now; that's mostly an art/writing task
Implementation
The religious building should always return an empty bonus in the get_bonus() function.
When determining the number of buildings to spawn each day (i.e. querying the weighted probability distribution), the game should add a table of offsets multiplied by the number of religious buildings in the grid. So, for a simplified example:
Do not edit the values in the existing weight table - instead, construct a new dictionary each time the day ends. This isn't very performant, but it's lightweight and infrequent enough that players won't notice. It also eliminates the possibility for nasty bugs down the line.
The religious building should also increase the probability of spawning adjacent buildings. This is best done by storing another offset table with buildings as keys, e.g.
apartment (weight offset 1)
park (weight offset 0.8)
solar farm (weight offset 4)
...
So, if the initial weight for the park is 1, and there is one religious building in the grid adjacent to two parks, the new weight for the park should be 1 + 0.8 * 2 = 2.6.
Just like the bonus described above, the new table shouldn't be stored, nor should the existing weight table be overwritten. It should instead be generated every day.
This functionality should be implemented alongside that described above, in a way that is possible to adjust without having to edit any code.
As a player, I want a building that increases my chances of balloons spawning using the new AI system. Additionally, as a developer, I want to be able to tweak the balance of this building without having to edit any code (i.e. entirely through
@export
-ed values).Design
Implementation
get_bonus()
function.Say the initial weight table is:
And the offset table is:
So, if there are 2 religious buildings in the grid: