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 Tue Mar 19, 2024 9:19 am
All times are UTC + 0
Single Player AI Triggers (***)
Moderators: Global Moderators, Tiberian Sun Moderators
Post new topic   Reply to topic Page 1 of 1 [21 Posts] Mark the topic unread ::  View previous topic :: View next topic
Author Message
krnyoshi
Cyborg Engineer


Joined: 22 Nov 2003
Location: California

PostPosted: Fri Apr 06, 2007 9:03 pm    Post subject:  Single Player AI Triggers (***) Reply with quote  Mark this post and the followings unread

Credits:
-Aro and his topic of AI triggers for making me think on this.
-scorpionim6@msn.com, not sure what his forum name here is.
-OrcaCommander for refering me to scorp.

Okay here's the thing that sets the difference between Aro's AI Trigger tutorial and mine.
Aro's is for multiplayer, and I have tested this myself on a single player test map. I tested this for about 3 days now, and I finally achieved the result I wanted.

First thing's first. Set up teamtypes, scripts, and taskforces. You will need to construct a total of 1 taskforce, 2 scripts, and 2 teamtypes. I will go into this in detail.
The most important part, other than creating the AI triggers itself, is activating them. Be sure that your triggers allow Production and AI triggers to begin. Otherwise, your AI is a sitting duck.

First, let's know what we want the AI to build shall we? Let's do something small, like light infantry.


Now we set up two scripts. One is for them to just stand around and look pretty while the other one is what they're REALLY going to do.


Now it's time for the teamtypes. One is something that rings a bell: Pools, while the other is the actual attack. While researching Westwood maps and the AI.ini file, I saw what was called pools. Doing further research, I've noticed that they used the same taskforce as the actual attack action they're supposed to do. Priority and options selected between the pool and attack are different from what I've seen. Pool teamtypes have a priority of 6, while attack teamtypes have a priority of 7. The Max are generally the same, unless you want some units in reserve for another AI script or just to defend the base. Pool teamtypes MUST have the option "AreTeamMembersRecruitable" checked, while IsBaseDefense is actually optional, but recommended.

AreTeamMembersRecruitable is crucial due to the fact that these units NEED to be recruitable in order for the other AI trigger to fire and send these units on their mission.
IsBaseDefense is optional, but recommended because, while these units are in reserve, if the base or harvester is to be attacked, then these units will respond to the attack. CORRECTION: IsBaseDefense is crucial as well. It NEEDS to be checked.

In our attack team, we need to have recruiter checked so that the AI can recruit any available units (preferably our pool units) to launch a strike force. The rest are optional. Waypoint NEEDS to be blank in order for the AI to look throughout the whole map instead of in one particular area to recruit units. If there aren't any available. The AI will create "pool" units to use. Here's a screenshot to sum it all up for you.
NOTE: For the attack scripts, be sure to have "Success" be the second action.


And now, for the last part. The AI triggers itself. I will copy and paste what Aro wrote in his post on the descriptions on AI triggers. As well as commentary on some additions.
Aro wrote:
Enabled: Do not forget to check this if the AI trigger shall be used

Type: This specifies the general event type for the AI Trigger. You can choose between several different types, The selected one specifies that the house that accesses the AI trigger must have a certain amount of certain objects. The exact amount, and the object type, is specified later on.

Name: Just a descriptive name of the AI Trigger

House: Usually this should be all, except you want only a certain house to access the AI trigger

Teamtypes: They specify the teams that shall be created as result of the AI trigger

Multi-Side: Specify if this trigger is for Everybody, Soviets, Allies or Yuri
This is for Multiplayer only. You can set this to <none>

Base defense: If this is checked, this AI trigger may be used even if the house doesn´t have a hated enemy yet

Available in Skirmish: Check this, and the AI trigger may be used in multiplayer games
We will not be using this option for Singleplayer maps.

Easy, Medium, Hard: In which difficulty modes is this AI trigger available?

Weight: Starting weight of the AI trigger. As higher, as more likely it is that the house decides to build the teamtype

MinWeight: The minimum weight that this AI trigger must have

MaxWeight: The maximum weight that this AI trigger can have


For pools, be sure that the weights are relatively close together. For example: Min. Weight: 30.000000, Weight: 40.000000, Max Weight: 40.000000.
For attackers, it doesn't really matter. It's based on you.

Note: AI trigger types for Pools are generally set to -1 None, but if a certain building requirement is needed you can change it to 1 House Owns (CONDITION) N of type X. They also tend to repeat the same teamtype pool so more units are in reserve.

Here's screen shots:


Basically, my AI will pool units when the AI triggers begin, and once 2 GDI Power plants are built, the AI (depending on whether or not it feels like it) will launch an attack on the base.

And now comes the moment of truth, testing.

AI builds the pool team.


Conditions are met.


AI launches strike force.


And there you go, the AI successfully fired both triggers!

Known issues: The AI tends to sit there after pooling units. I'm not sure if it's due to the fact that I have only 2 AI triggers or not, but it'll eventually send its forces at you. Sometimes you need to give him a little "kick" to start him up.

-Yoshi


Key Words: #Tutorials #Modding #Mapping #TiberianSun #Firestorm #Rules.INI #AI.INI #FinalSun 

_________________
Creator of Tiberian Sun: Firepower

Last edited by krnyoshi on Fri Apr 06, 2007 9:59 pm; edited 2 times in total

Back to top
View user's profile Send private message Visit poster's website Skype Account Yahoo Messenger Account AIM Address
Aro
Alcohol Fueled


Joined: 10 Sep 2006

PostPosted: Fri Apr 06, 2007 9:08 pm    Post subject: Reply with quote  Mark this post and the followings unread

Yeah, well done for making a better version, Yoshi... And thanks for crediting. Smile

Back to top
View user's profile Send private message
Crash
Cyborg Commando


Joined: 30 Jan 2007
Location: Norway

PostPosted: Fri Apr 06, 2007 9:50 pm    Post subject: Reply with quote  Mark this post and the followings unread

Nice Tutorial, Yoshi! This is very useful.

Back to top
View user's profile Send private message
Aro
Alcohol Fueled


Joined: 10 Sep 2006

PostPosted: Fri Apr 06, 2007 9:55 pm    Post subject: Reply with quote  Mark this post and the followings unread

Oh by the way, yoshi... You type:

[quote="Aro"]

Just wanted to clarify that so you're able to fix it. Smile

Back to top
View user's profile Send private message
krnyoshi
Cyborg Engineer


Joined: 22 Nov 2003
Location: California

PostPosted: Fri Apr 06, 2007 10:15 pm    Post subject: Reply with quote  Mark this post and the followings unread

Fixed.

_________________
Creator of Tiberian Sun: Firepower

Back to top
View user's profile Send private message Visit poster's website Skype Account Yahoo Messenger Account AIM Address
Ixith
Cyborg Commando


Joined: 12 Apr 2006
Location: under there!

PostPosted: Fri Apr 06, 2007 11:57 pm    Post subject: Re: Single Player AI Triggers (***) Reply with quote  Mark this post and the followings unread

krnyoshi wrote:

-scorpionim6@msn.com, not sure what his forum name here is.

his user name here is *Tony* Wink

and glad to see you being active here and making this nicely detailed tut (yes i know Aro made one so congrats to him to #Tongue )

keep up the good work yoshi. it would be nice to see some good fixes to the FSData.ini sometime in the future. (well more further fixes to it) Smile

_________________
Kalistia Crestland (2)
In Soviet Russia, grass grows on tiberium!

Back to top
View user's profile Send private message Send e-mail Skype Account AIM Address
krnyoshi
Cyborg Engineer


Joined: 22 Nov 2003
Location: California

PostPosted: Sat Jan 12, 2008 12:55 pm    Post subject: Reply with quote  Mark this post and the followings unread

This tutorial should be scrapped. Upon 5 hours of further research on AI Triggers I've noticed that "IsBaseDefense=" is VERY limited by the rules.ini entry "MinAIDefensiveTeams" and "MaxAIDefensiveTeams". Depending on the difficulty setting is what determines how many "defense" teams should be created. I started noticing that the computer usually built a couple units from my "pool" list, but sometimes did not pool every team type, or even didn't build the team all the way (it was a rather odd bug I suppose).

I've also tested various combinations of options for Teams to try and make the AI pop new units out of the structures, but all to no avail. Prebuild and Autocreate do not create units. Same with keeping "waypoint=" blank (this works with the fourth trigger action, Create Team, however). Also, when "IsBaseDefense" is switched to yes, SOMETIMES the AI will allow its base defense units to be recruited in another AI trigger, while other times it would disallow recruitment of units regardless of "AreTeamMembersRecruitable" being chosen as yes.

It's still kind of funny and strange how I modeled my test AI system like how WW made theirs (even copied one for research purposes) and it still failed. Perhaps I'm doing something wrong? I'm not even sure.

Pooling may allow SOME recruitment to other AI triggers, but it doesn't seem very reliable. From both missions that I've done in my campaign that contain AI triggers, it appears that sometimes they work fine for a little while, but then crash and burn as time goes on, or from the very beginning.

Other than trying the "pool" option, I attempted to create a simple AI trigger that is supposed to create a taskforce by scratch, and have them move along a VERY simple linear path of waypoints. Weights were adjusted to where it was a very high percentage chance that the AI would trigger this, fired up the game, loaded the map, and it failed miserably. Sitting on the computer for about 3-5 minutes on the fastest setting, and nothing happened.

In conclusion, single player AI triggers seem to cause more of a headache than multiplayer ones. Can anyone who actually got the AI triggers to work in single player without the use of "pooling" can shed light into this? By use of AI triggers, I mean using them to produce new units.

I swear to god, at this rate, my mapping production rate will become stagnant again because of this, unless I go back the way I used to make the AI build, which would cause difficulty to shoot up the roof again. Rolling Eyes

EDIT: By the way, I already went and read up http://www.steffke.de/jbbs/doc/CC/KuenstlicheIntelligenz/AI-Engine/lang_en/index.html and I still got problems. The AI engine helped with identifying the tags easier, but it didn't seem to clarify much for single player. Mostly multiplayer it seems. Confused

_________________
Creator of Tiberian Sun: Firepower

Back to top
View user's profile Send private message Visit poster's website Skype Account Yahoo Messenger Account AIM Address
Dutchygamer
President


Joined: 18 Jun 2005
Location: Dordrecht, the Netherlands

PostPosted: Sat Jan 12, 2008 1:11 pm    Post subject: Reply with quote  Mark this post and the followings unread

Can't you just add MinAIDefensiveTeams" and "MaxAIDefensiveTeams" to your map file. Then you can set the minimal and maximal amount of defence teams for that specific map. That may help solving one of your problems Wink

Back to top
View user's profile Send private message Send e-mail Skype Account
krnyoshi
Cyborg Engineer


Joined: 22 Nov 2003
Location: California

PostPosted: Sat Jan 12, 2008 1:30 pm    Post subject: Reply with quote  Mark this post and the followings unread

Unfortunately, it's under [General], and I don't think you can add in that entry if I could remember. I don't want to edit the rules.ini entry either, but I'd really like to know how to get this functioning right.

_________________
Creator of Tiberian Sun: Firepower

Back to top
View user's profile Send private message Visit poster's website Skype Account Yahoo Messenger Account AIM Address
John Galt
Commander


Joined: 01 Aug 2003
Location: Galt's Gulch

PostPosted: Sat Jan 12, 2008 1:53 pm    Post subject: Reply with quote  Mark this post and the followings unread

You can add any code from the rules to a map, except those which deal with GUI settings, such as Money/MaxMoney.

Back to top
View user's profile Send private message Visit poster's website Skype Account
krnyoshi
Cyborg Engineer


Joined: 22 Nov 2003
Location: California

PostPosted: Sat Jan 12, 2008 1:57 pm    Post subject: Reply with quote  Mark this post and the followings unread

That answers my shaky thoughts, but back on topic though. Single Player AI Triggers when it comes to building a unit. Has there been any successful SP AI Triggers that were triggered successfully when it came to constructing a unit without the use of "IsBaseDefense"?

_________________
Creator of Tiberian Sun: Firepower

Back to top
View user's profile Send private message Visit poster's website Skype Account Yahoo Messenger Account AIM Address
Dutchygamer
President


Joined: 18 Jun 2005
Location: Dordrecht, the Netherlands

PostPosted: Sat Jan 12, 2008 3:59 pm    Post subject: Reply with quote  Mark this post and the followings unread

Why don't you try c/p a normal taskforce+script+team+trigger from the ai.ini? See if that works...

Back to top
View user's profile Send private message Send e-mail Skype Account
krnyoshi
Cyborg Engineer


Joined: 22 Nov 2003
Location: California

PostPosted: Sat Jan 12, 2008 9:33 pm    Post subject: Reply with quote  Mark this post and the followings unread

Quote:
It's still kind of funny and strange how I modeled my test AI system like how WW made theirs (even copied one for research purposes) and it still failed. Perhaps I'm doing something wrong? I'm not even sure.

_________________
Creator of Tiberian Sun: Firepower

Back to top
View user's profile Send private message Visit poster's website Skype Account Yahoo Messenger Account AIM Address
Dutchygamer
President


Joined: 18 Jun 2005
Location: Dordrecht, the Netherlands

PostPosted: Sun Jan 13, 2008 11:54 am    Post subject: Reply with quote  Mark this post and the followings unread

I guess WW made their AI with some kind of program, like DCoder's AI editor, only a professional version...

Back to top
View user's profile Send private message Send e-mail Skype Account
CCHyper
Defense Minister


Joined: 07 Apr 2005

PostPosted: Sun Jan 13, 2008 12:22 pm    Post subject: Reply with quote  Mark this post and the followings unread

I would think so too, maybe the editor had it built in.

Back to top
View user's profile Send private message
Aro
Alcohol Fueled


Joined: 10 Sep 2006

PostPosted: Sun Jan 13, 2008 4:39 pm    Post subject: Reply with quote  Mark this post and the followings unread

DCoders AI Editor is good, but for some reason, It can't seem to get custom ones to work correctly. The only time it works sucessfully, is when you just edit some features in the existing ones.

Last edited by Aro on Mon Jan 14, 2008 1:34 am; edited 1 time in total

Back to top
View user's profile Send private message
Dutchygamer
President


Joined: 18 Jun 2005
Location: Dordrecht, the Netherlands

PostPosted: Sun Jan 13, 2008 5:16 pm    Post subject: Reply with quote  Mark this post and the followings unread

Ehmm, Aro, we ain't discussing the usefullnes of DCoder's AI coder, but something else...

Back to top
View user's profile Send private message Send e-mail Skype Account
Aro
Alcohol Fueled


Joined: 10 Sep 2006

PostPosted: Sun Jan 13, 2008 5:24 pm    Post subject: Reply with quote  Mark this post and the followings unread

Quote:
like DCoder's AI editor

Quote:
Aro, we ain't discussing the usefullnes of DCoder's AI coder, but something else..


I know what you're discussing, but I noticed someone bring it up, so I just thought I'd give my input. Rolling Eyes But yeah, WW must've used something simmilar, Otherwise It wouldn't be so damn difficult to get these AI Triggers working. Confused Just read through THIS.

Back to top
View user's profile Send private message
krnyoshi
Cyborg Engineer


Joined: 22 Nov 2003
Location: California

PostPosted: Sun Jan 13, 2008 11:04 pm    Post subject: Reply with quote  Mark this post and the followings unread

Too bad Westwood never fully implemented Prebuild and Autocreate in Teams. It would've made this a whole lot easier, especially combined with the AI editor that's built into FinalSun. It appears that I have to create my pools by scratch, which will amplify the difficulty level and will further amplify the percentage that an AI pool will fail (as in units getting stuck). If you want to know what I mean by difficulty level, you can look at my campaign demo that I released years ago and see that.

_________________
Creator of Tiberian Sun: Firepower

Back to top
View user's profile Send private message Visit poster's website Skype Account Yahoo Messenger Account AIM Address
Dutchygamer
President


Joined: 18 Jun 2005
Location: Dordrecht, the Netherlands

PostPosted: Mon Jan 14, 2008 10:40 am    Post subject: Reply with quote  Mark this post and the followings unread

@ Aro: I have that file already, and I use it to edit my AI, and I have learned much from it Wink

Back to top
View user's profile Send private message Send e-mail Skype Account
Allied General
General


Joined: 19 Mar 2004
Location: United Kingdom

PostPosted: Tue Jul 26, 2011 8:57 pm    Post subject: Reply with quote  Mark this post and the followings unread

krnyoshi wrote:
That answers my shaky thoughts, but back on topic though. Single Player AI Triggers when it comes to building a unit. Has there been any successful SP AI Triggers that were triggered successfully when it came to constructing a unit without the use of "IsBaseDefense"?


Ok massive bump but did anyone ever get this working?

Something is really screwy with AI building units with preplaced bases on maps and yes I have copied westwood code for research with the same results.

Back to top
View user's profile Send private message Visit poster's website ModDB Profile ID Facebook Profile URL Twitter Channel URL
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [21 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.1710s ][ Queries: 11 (0.0083s) ][ Debug on ]