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 Thu Mar 28, 2024 10:20 am
All times are UTC + 0
Map AI Scripting
Moderators: Global Moderators, Red Alert 2 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
McPwny
Cyborg Artillery


Joined: 29 Jan 2018

PostPosted: Sun Mar 18, 2018 1:41 pm    Post subject:  Map AI Scripting
Subject description: An epiphany of science.
Reply with quote  Mark this post and the followings unread

Hello! billy mays here to ask you "have you ever wondered how to script the AI in a skirmish map specifically?" It seems the world needs a tutorial for this.

Make a taskforce. fire trucks have been modded as different units, and i want the AI to actually use the units.

Make your script, detailing how the AI should behave. from elaborate and complex to simple ones that just say "GO"
Two references for script functions can be found here and here
script action Success will force the team to accomplish the previous objective until it successfully accomplishes it, so it can move into the next instruction, and is apparently used in AI trigger weighting
script action Gather at Enemy takes its distance from AISafeDistance= see the .ini section

For each taskforce, make a team. "House" and "Waypoint" have default values in a new team, delete them. Place your taskforce and a script on the team, and mind the checkboxes.
Its a good idea to familiarize yourself with what these controls do so here and here are two good references.
it seems Max: is simply the max amount of that team the AI is willing to create at once
the IsBaseDefense checkbox is related to MinimumAIDefensiveTeams= and MaximumAIDefensiveTeams= see the .ini section

Now for the AI triggers. make sure house is set to <all>,the teamtype is appropriate, Multi-Side: is set to the right faction for the units, uncheck Base defense.
Type: has several kinds of condition events, but the default "enemy owns" is simple. you can make 3 ai triggers for each team and set them not to fire until enemies build their respective tech buldings, this example shows the AI trigger is OK to fire if there is 1 enemy allied war factory
Alternatively you could set it to "house owns" rather than "enemy owns" and set the building to the prerequisite building of the unit you want built, and it can for example build tanks if it knows it has a war factory.
Weight controls the likelyhood of the AI building this team, higher weight is higher likelyhood.
you can specify two teams in a single AI trigger.

lastly and optionally most entry in rules.ini can be used by a map, here are some relevant knobs and dials for the AI itself
Spoiler (click here to read it):

[AI]
AlliedBaseDefenses=GAPILL,ATESLA,NASAM
SovietBaseDefenses=NALASR,NABNKR,TESLA,NAFLAK
ThirdBaseDefenses=YAGGUN,YAPSYT,NATBNK
NeutralTechBuildings=CAAIRP,CATHOSP,CAOILD,CAOUTP,CAMACH,CAPOWR

[General]
TeamDelays=2000,2500,3500
AIVirtualPurifiers=4,2,0  
TotalAITeamCap=30,30,30
AlliedBaseDefenseCounts=25,20,6
SovietBaseDefenseCounts=25,22,6
ThirdBaseDefenseCounts=25,22,6
AIHateDelays=30,50,70
AINavalYardAdjacency=20
AISafeDistance=20
MinimumAIDefensiveTeams=1,1,1    ;note these 2 will cause bugs if raised, and then not compensated for
MaximumAIDefensiveTeams=2,2,2


BUT WAIT THERES MORE!
A special thanks to E1 Elite for all of the useful informations.



Image99.jpg
 Description:
 Filesize:  223.11 KB
 Viewed:  4179 Time(s)

Image99.jpg




Key Words: #Tutorials #RedAlert2 #YurisRevenge #Mapping #FinalAlert2 #Rules.INI 

Last edited by McPwny on Thu Mar 22, 2018 4:09 pm; edited 2 times in total

Back to top
View user's profile Send private message
E1 Elite
General


Joined: 28 May 2013

PostPosted: Tue Mar 20, 2018 4:42 am    Post subject: Re: Map AI Scripting Reply with quote  Mark this post and the followings unread

McPwny wrote:
it seems priority and max only take effect when Autocreate is checked low priority numbers make it more important to build to the AI, and max= says how many times the AI will build the team. max should be set to 1 if Autocreate is not checked.
If autocreate is not checked the AI will instead use the weighting system and Type: entry on the AI Trigger Types panel to determine when the unit gets built. If you want the AI to build your units routinely like it would its own units, uncheck autocreate.

Those are completely wrong. Max is obeyed irrespective of priority or autocreate when teams are created by AITriggers. Max is not considered only when teams are created by other methods like Create Team action in maps. Both Priority and Autocreate are related to recruitment. Autocreate is not related to creating teams routinely or not. It is not related to weighting system usage or not also. Those are updated at ModEnc - Priority and Autocreate.

AttackDelay and AutocreateTime shown under [AI] don't work.

Could have added info regarding enabling AITriggers in maps using AITriggerTypesEnable and through Action in SP maps. Also usage of Make Enemy action in SP maps so that attack teams can target its enemies.

AITiggers brings in variation when there are more of them with similar weights. It can be used for locally modified units as well. Vanilla SP maps make something like 2 unit task force for easy and make 4 unit for normal and hard etc. That way AITriggers are used to make some difference in difficulty as most keys in [Easy]/[Hard] etc. doesn't work in RA2YR and most 3 valued rulesmd keys are for multiplayer.

Usage of map Tag/Trigger/Action/Events along with AI sections gives much better control. There is a tutorial for that.

There was a tutorial regarding AI usage (now images doesn't seem to be showing) - https://ppmforums.com/viewtopic.php?t=14506

Give references to ModEnc which has updated info like

ScriptTypes
https://www.modenc.renegadeprojects.com/ScriptTypes/ScriptActions

AITriggerTypes
https://www.modenc.renegadeprojects.com/AITriggerTypes

Search for TeamTypes keys also at ModEnc, only when you don't find it there, refer to older references.

Back to top
View user's profile Send private message
McPwny
Cyborg Artillery


Joined: 29 Jan 2018

PostPosted: Tue Mar 20, 2018 10:08 pm    Post subject: Re: Map AI Scripting Reply with quote  Mark this post and the followings unread

E1 Elite wrote:
Those are completely wrong. Max is obeyed irrespective of priority or autocreate when teams are created by AITriggers. Max is not considered only when teams are created by other methods like Create Team action in maps. Both Priority and Autocreate are related to recruitment. Autocreate is not related to creating teams routinely or not. It is not related to weighting system usage or not also.

this is good information! i was wrong about the AI and autocreate
i see now that AttackDelay is obsolete to AIHateDelays, but how do you know that AutocreateTime doesent work when its listed right there?

E1 Elite wrote:
AITiggers brings in variation when there are more of them with similar weights. It can be used for locally modified units as well. Vanilla SP maps make something like 2 unit task force for easy and make 4 unit for normal and hard etc. That way AITriggers are used to make some difference in difficulty as most keys in [Easy]/[Hard] etc. doesn't work in RA2YR and most 3 valued rulesmd keys are for multiplayer.

this is also good information. when i said "Map AI Scripting" i probably should have been more specific that this was all based off of using the multiplayer AI and multiplayer limited triggers in skirmish maps. so you cant take the same liberties as a singleplayer map such as spawning units, and the scripting is somewhat intricate in itself. the whole idea here is to understand what it is you can do and how with AI triggers, Scripts, and INI edits in skirmish maps whether you want the AI to subtly buy those 1 or 2 engineer and helicopter teams to capture the tech buildings for once, you want the AI to utilize new units as they would normal units, or you just to mix it up because you know the AI will send those (3 kirovs and 4 apocolypse, for example) every single time. perhaps you want the AI to build base defence MCV's and send them to the AISafeDistance via script and deploy?

thats what this thread is about, I do intend to update it with some more information though because there doesn't seem to be any tutorials for this specific thing at all.  and yes ive seen THIS and ive even tried it two or three times to no avail, because a visual tutorial without visuals is nothing at all.

_________________
visit my moddb profile for .shp downloads and stuff

Back to top
View user's profile Send private message
E1 Elite
General


Joined: 28 May 2013

PostPosted: Wed Mar 21, 2018 4:46 am    Post subject: Reply with quote  Mark this post and the followings unread

Game uses TeamDelays for creating teams at regular intervals.

AutocreateTime, AttackInterval, AttackDelay, Ratio/Limits etc. are leftovers from earlier game, they are obsolete. ModEnc entry would need correction, though it doesn't say AutocreateTime is for TS/RA2, where it doesn't work.

Edit: Recruiter=yes is not needed for recruitment as such. It is only needed when doing inter-Group recruitment or to execute scripts for teams produced from factories with Groups other than -1/-2. In general, Recruiter=no should be used for AI ini as well as in maps to avoid recruiting pre-placed units with different groups.

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
You cannot post new topics in this forum
You cannot 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.1636s ][ Queries: 14 (0.0100s) ][ Debug on ]