[AI] performance cost of mutliple CAs
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
-
- Posts: 1231
- Joined: August 26th, 2018, 11:46 pm
- Location: A country place, far outside the Wire
[AI] performance cost of mutliple CAs
I'm looking at creating a few units whose mission is to target a human-controlled leader. At the moment, using the simple_attack micro_ai. Each time I create one of these units, I create a CA for it, so I end up with something like this:
In this particular case, I doubt I have to worry about performance, but I want to learn. Is there a point when adding a CA for each unit would be a bad idea, when I could, with a bit of work if I want to do it right, instead create one CA that filters on "hates_Efraim-*" (assuming that is valid, if not I can probably come up with something else to filter on if I work at it)?
If I had 100 units, would there be a difference between having one CA to match them all and having 100 CAs each matching one unit?
TIA
Code: Select all
[candidate_action]
enabled=yes
engine="lua"
id="mai_simple_attack_move"
location="ai/micro_ais/cas/ca_simple_attack.lua"
max_score=110050
name="mai_simple_attack_move"
score=0
type=""
[args]
ai_id="mai_simple_attack"
ca_score=110050
[filter_second]
id="Efraim"
[/filter_second]
[filter]
id="hates_Efraim-1"
[/filter]
[/args]
[filter_own]
[/filter_own]
[/candidate_action]
[candidate_action]
enabled=yes
engine="lua"
id="mai_simple_attack1_move"
location="ai/micro_ais/cas/ca_simple_attack.lua"
max_score=110050
name="mai_simple_attack1_move"
score=0
type=""
[args]
ai_id="mai_simple_attack1"
ca_score=110050
[filter_second]
id="Efraim"
[/filter_second]
[filter]
id="hates_Efraim-3"
[/filter]
[/args]
[filter_own]
[/filter_own]
[/candidate_action]
If I had 100 units, would there be a difference between having one CA to match them all and having 100 CAs each matching one unit?
TIA
Speak softly, and carry Doombringer.
- lhybrideur
- Posts: 371
- Joined: July 9th, 2019, 1:46 pm
Re: [AI] performance cost of mutliple CAs
I now nothing about ai, but could this work with a role?
like
Then you would give this role to all the units you want to hate Efraim
like
role="hates-Efraim"
Then you would give this role to all the units you want to hate Efraim