Project Perfect Mod Forums
:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::


The time now is Fri Nov 08, 2024 6:01 am
All times are UTC + 0
Some small TD AI improvements
Moderators: Global Moderators
Post new topic   Reply to topic Page 1 of 1 [4 Posts] Mark the topic unread ::  View previous topic :: View next topic
Author Message
EGG
Civilian


Joined: 06 Sep 2020

PostPosted: Sun Sep 06, 2020 3:44 pm    Post subject:  Some small TD AI improvements Reply with quote  Mark this post and the followings unread

I thought I'd post these here, in case they're of use to anyone else in any other mods. I've made a couple of improvements to TD AI behaviour: https://steamcommunity.com/sharedfiles/filedetails/?id=2220995241

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.



AIRCRAFT.CPP
 Description:
Orca/Apache Reinforcement teams (enter_idle_mode)

Download
 Filename:  AIRCRAFT.CPP
 Filesize:  155.53 KB
 Downloaded:  7 Time(s)


REINF.CPP
 Description:
Orca/Apache Reinforcement teams (do_reinforcements)

Download
 Filename:  REINF.CPP
 Filesize:  26.77 KB
 Downloaded:  10 Time(s)


BUILDING.H
 Description:
SAM lowering delay (int definition)

Download
 Filename:  BUILDING.H
 Filesize:  11.15 KB
 Downloaded:  13 Time(s)


BUILDING.CPP
 Description:
Orca fly-in location (exit_object)
SAM lowering delay (mission_attack)

Download
 Filename:  BUILDING.CPP
 Filesize:  225.77 KB
 Downloaded:  16 Time(s)


UNIT.CPP
 Description:
Gunboat fix (per_cell_process)

Download
 Filename:  UNIT.CPP
 Filesize:  187.04 KB
 Downloaded:  12 Time(s)


Back to top
View user's profile Send private message
EGG
Civilian


Joined: 06 Sep 2020

PostPosted: Sun Sep 27, 2020 7:27 am    Post subject: Reply with quote  Mark this post and the followings unread

Finally gotten around to uploading this to Github after the recent hotfix: https://github.com/screamingchicken/CnC_Remastered_Collection/tree/CnC-Minor-AI-Fixes/TIBERIANDAWN

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.

Back to top
View user's profile Send private message
Lin Kuei Ominae
Seth


Joined: 16 Aug 2006
Location: Germany

PostPosted: Sun Sep 27, 2020 11:19 am    Post subject: Reply with quote  Mark this post and the followings unread

EGG wrote:
the age-old one of AI bases getting clogged up with too many units.

That's mostly because teamtypes use the wrong setup in the map.
See this ancient post of mine, where i explain this.
https://www.tiberiumweb.org/forums/index.php?showtopic=3743&st=0&p=45015&#entry45015

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

Public SHPs
X-Mech Calendar (28 Mechs for GDI and Nod)
5 GDI, 5 Nod, 1 Mutant, 1 Scrin unit, 1 GDI building

Tools
Image Shaper______TMP Shop______C&C Executable Modifier

Back to top
View user's profile Send private message
EGG
Civilian


Joined: 06 Sep 2020

PostPosted: Mon Sep 28, 2020 2:33 pm    Post subject: Reply with quote  Mark this post and the followings unread

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.

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [4 Posts] Mark the topic unread ::  View previous topic :: View next topic
 
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
Quick Reply
Username:


If you are visually impaired or cannot otherwise answer the challenges below please contact the Administrator for help.


Write only two of the following words separated by a sharp: Brotherhood, unity, peace! 

 
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


Powered by phpBB © phpBB Group

[ Time: 0.2221s ][ Queries: 13 (0.0087s) ][ Debug on ]