MATH: Calculating the DF factor
as mentioned in the 1.1 public beta announcement it's our final goal to be able to calculate the df factor for each map automatically. For that I created a first approximation:
1. Calculate the "weight" of each path segment
The weight of a segment means "how often does a creep come along". So, a normal path segment always has a weight of 1.0 while a segment behind a 50:50 alternate has a weight of 0.5. Underground segments are not reachable and therefore have zero weight. When there are stops, there will be N path segments with a weight of 1.0 (N*1.0 total).
2. For each buildable cell calculate the reachable weight by looking 2 cells in each direction
Around each buildable cell a range is approximated (5x5 square without edges) and the weight of every path segment in that range is collected into the final sum that will somewhat reflect the "usefulness" of that building cell. So, a buildable cell that reaches 3 path segments with a weight of 1.0 each will result in a sum of 3.0, meaning "the average creep path reachable from this cell is 3 segments (usefulness=3)".
3. [unsure] AI_df_raw=totalUsefulness/totalCells
Finally I flatten all the collected values by calculating the average usefulness of every single cell on the map.
Some values:
QUADCORE=6.703
RICHTUNGSWECHSEL=5.258
REDWORLD=3.734
VORTEX=2.175
SPEEDVECTOR=1.391
FLYINGORB=0.9375 (not so smart!)
A higher AI_df_raw value means that the AI needs to be stronger while a lower value means that the AI needs to be weaker to make playing the map fun. The final task would be to adjust the AI_df_raw values to match the real AI_df (income factor of the AI) by linear scaling.
However, I am not yet sure if this approximation really reflects the difficulty of each map. I assume it will be required to just focus on the "top X" spots on a map to make that work out (see FLYINGORB). What do you think? Any improvements?