morvael
Posts: 10870
Joined: 9/8/2006 From: Poland Status: offline
|
quote:
ORIGINAL: Helpless The most decisive factor is the amount of planes in the pool - it should be less than 200. New plane should either have 4x of original in pool or there should be 300 or more planes in the pool. Ouch, such algorithm will almost never use the less-produced planes like P-47 or some Yaks. If I were allowed to code this I would do something like this: for every plane model skip planes with start year before 1941 find out air groups using such plane and calculate the maximum number of planes these groups may use (A) and current number of planes used (B) take the number of planes in the pool, substract the number of planes needed to fill existing air groups (A-B), and substract again 20% of A if the number of "free planes" calculated above is above max single airgroup size (20 for the Soviets), add the plane to the possible upgrade list sort the possible upgrade list by 1) produced planes first, not produced planes second 2) higher year and month of start of production first 3) higher year and month of end of production first 2) higher number of free planes first then for every air group set to auto upgrade, randomly select 20% of them and calculate score add 3.0 if the plane used is not produced calculate normalized score from morale (100=1.0...0=0.0) and add to total calculate normalized score from experience and add to total calculate normalized score from (max planes-total planes)/max planes (for example 4 planes in a 20 plane unit would give 16/20=0.8) and add to total add the air group to upgrade list sort the upgrade list by score (highest first) for every air group on the list (starting from the first) find out (starting from the first plane model on the possible upgrade list) whether there is a correct plane model available for upgrade (Ftr/FB for FB trained as Fighters, TacB for TacB and FB trained as Bombers, for the rest keep the same type) and if there is enough free planes available - perform the upgrade, and reduce the number of free planes for that specific model; proceed to next air group That way the AI would work similarily to player, and upgrade air groups that needs it most (old planes, low number) and deserves most (high morale and experience) to the newest planes that have relatively high number of "free" planes in the pool.
|