Gunboat targeting
Gunboats will now pickup a new target each time they reverse direction down the shipping lane. Ideally they should probably pickup a new target in the same manner as normal Units, but this is a bit more complicated as they always use the Hunt AI in the campaigns, which is basically "go banzai on something", and multiple places in the code re-assign Gunboats to Hunt if they get into any other state. They're definitely more troublesome than they used to be.
Orca/Apache fly-in location
I built a rather Orca-heavy map, but whenever you built new Orca's, and they didn't have a Helipad to land on, they'd pick a random Y co-ordinate to fly in from. Which could mean they'd overfly SAM's halfway across the map. So this change is to make them fly in at the Y co-ordinate of the primary Helipad, similar to Cargo drops.
Using Orcas/Apaches in temporary Reinforcement Teams
I was trying to use Apaches in a Reinforcement Team, to have them fly in, attack some targets, then fly off map again. But instead they would empty all their ammo, then idle over the enemy base for a period, before flying back to their own base and landing in a big mess. So this sets Reinforcement Orca/Apache Teams to be "Loaner" craft if they are owned by a non-human. When they've finished using all their ammo, they'll fly-off map. It doesn't affect transports, new-build Orcas/Apaches or anything player-owned (that one Covert Ops mission where Reinforcement Apaches are used).
I suggest using "Rampage:3" or "Attack Buildings:3" on the Apaches if you want to try this. Otherwise they'll still idle over the enemy base for a bit when empty.
SAM popup logic
Lastly, I've put a short delay on SAM's before they Lock into the North position before lowering. During this time they will scan for new targets. This prevents the previous jack-in-a-box behaviour. It doesn't affect the current firing delays, either for the two-shot (~3 game ticks), or for the subsequent two-shot (~45 game ticks).
I've attached the changed code below, but I probably need to figure out how to use Git, and upload it there.
There are some other AI gremlins I'd like to look at sometime, the Ambush Mission, Engineers trying to capture turrets (which they can't) and the age-old one of AI bases getting clogged up with too many units.
I've also included a fix to how Mission Ambush is initiated. It was meant to send the unit to Hunt when it was revealed from the shroud, but never worked. Now it does, but requires the unit to be fully revealed from the shroud. It may be of use in some niche situations. In the meantime I'm going to try to think of a way to get it to initiate when the unit is partially revealed. QUICK_EDIT
In short, teamtypes using 15 simply stop when some building is attacked and then just stand forever stupid around.
20 makes them move to the target regardless if their or someone elses base is under attack
Maybe now with access to the code, people can shed some light into these ominous numbers and actually explain how teamtypes work and what each number is good for. _________________ SHP Artist of Twisted Insurrection: Nod buildings
As best as I can tell the U# or RecruitPriority is used in the following places in the code. It seems to initialize the value as "7", so I guess all the instances of "15" we see in the base campaigns are from the higher-priority Teams which get better treatment when being built and are less likely to lose their members.
team.cpp
- If a Team is judged to be understrength, then it will try to "pull in" available units of the correct type. Either ones who aren't in a Team, or who have a lesser RecruitPriority than the current Team
techno.cpp
- If the base is attacked, then every Team with a RecruitPriority of less than 20 will have it's members booted out. The Team they were in will be suspended for a period of time (so it doesn't try to re-recruit), and the code will loop through trying to find Infantry and Units it can send back to the base to defend.
There's then a fairly hairy calculation of how much "threat" the unit can apply, based on whether it's already trying to attack the base attacker, and how far away it is. I guess this is what's falling over when the units drop their Team orders and just cease moving when the base is attacked.
teamtype.cpp
- When an AI House is trying to figure out which Teams to build, it tries to build the highest RecruitPriority Teams for which there are the correct Unit/Infantry currently in existence. If the Units/Infantry don't already exist for the Team it's looking at, then for the purposes of determining which Team it should build, the RecruitPriority is considered to be halved. QUICK_EDIT
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum