[engine] Add filters for attack_ and defense_weight
Moderator: Forum Moderators
Forum rules
Before posting a new idea, you must read the following:
Before posting a new idea, you must read the following:
[engine] Add filters for attack_ and defense_weight
Hello,
I'll start with the reasoning:
In many UMC's, including mine, there are a couple of custom weapon specials that work through events, and behave differently with different enemy units.(the variations are endless).
Arming the player with such weapon specials is fine, because the player will know when to use them effectively.
However, there is currently no way (or at least that I know of) to tell the AI that against a certain unit this attack should be used, because the weapon special will be devastating.
There is attack_ and defense_weight, but it is universal, regardless of the specific enemy.
So my suggestion is to change attack_ and defense_weight from being attributes to new tags, where a [filter_opponent] is available.
Maybe even make [filter_self] available? This could allow more a much more complex and precise AI play, where not only the player but the AI as well can use custom weapon specials effectively.
Opinions?
I'll start with the reasoning:
In many UMC's, including mine, there are a couple of custom weapon specials that work through events, and behave differently with different enemy units.(the variations are endless).
Arming the player with such weapon specials is fine, because the player will know when to use them effectively.
However, there is currently no way (or at least that I know of) to tell the AI that against a certain unit this attack should be used, because the weapon special will be devastating.
There is attack_ and defense_weight, but it is universal, regardless of the specific enemy.
So my suggestion is to change attack_ and defense_weight from being attributes to new tags, where a [filter_opponent] is available.
Code: Select all
[attack]
# some attack
[modifications]
{SOME_CUSTOM_SPECIAL}
[/modifications]
[attack_weight]
[filter_opponent] # let's say don't use it against trolls
race=troll
[/filter_opponent]
value=0
[/attack_weight]
[attack_weight]
[filter_opponent] # but is really favourable against the undead
race=undead
[/filter_opponent]
value=5
[/attack_weight]
[attack_weight]
[filter_opponent] # again not so favourable against very damaged units for I don't know what reason this is just an example
formula=hitpoints < 10
[/filter_opponent]
value=0.2
[/attack_weight]
# same could be done with a [defense_weight] tag
Opinions?
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Re: [engine] Add filters for attack_ and defense_weight
There is reason to believe that nonzero attack_weight is ignored viewtopic.php?p=638187#p638187.
Re: [engine] Add filters for attack_ and defense_weight
Well, that explains the odd behaviour I've been experiencing at times with this attribute.Ravana wrote: ↑February 3rd, 2019, 2:01 pm There is reason to believe that nonzero attack_weight is ignored viewtopic.php?p=638187#p638187.
But it's completely misleading in the wiki then. Is this intended and will stay this way, or will this be fixed at some point?
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Re: [engine] Add filters for attack_ and defense_weight
Not the answer to WhiteWolf's question, but I just fixed the 'wiki is misleading' bit.
Re: [engine] Add filters for attack_ and defense_weight
It has not been reported as issue so far.
- Celtic_Minstrel
- Developer
- Posts: 2214
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: [engine] Add filters for attack_ and defense_weight
I reported it as #3923.
Re: [engine] Add filters for attack_ and defense_weight
I think it'd be better to allow formula/Lua expressions in attack_weight. this is not only more flexible, it also avoids problems like "what should we do when multiple of those match"
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
- Celtic_Minstrel
- Developer
- Posts: 2214
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: [engine] Add filters for attack_ and defense_weight
I'm not quite sure what you mean, but I'm against allowing
attack_weight="(formula here)"
- if you want or need that, just use formula="formula here"
instead. If you're adding keys to the weapon filter to check attack and defense weight though, you certainly can't make do with just two keys. You'd probably want at least four, maybe six - attack_weight=
(exact match), attack_weight_at_least=
, attack_weight_at_most=
, and likewise for defense weight (names can be changed, of course).Re: [engine] Add filters for attack_ and defense_weight
This is about allowing the already existing [attacks]attack_weight key to accept formula,I don't see how the could be done with the current formula= key .Celtic_Minstrel wrote: ↑February 20th, 2019, 2:45 am I'm not quite sure what you mean, but I'm against allowingattack_weight="(formula here)"
- if you want or need that, just useformula="formula here"
instead.
I don't intend to change filters.Celtic_Minstrel wrote: ↑February 20th, 2019, 2:45 am
If you're adding keys to the weapon filter to check attack and defense weight though, you certainly can't make do with just two keys. You'd probably want at least four, maybe six -attack_weight=
(exact match),attack_weight_at_least=
,attack_weight_at_most=
, and likewise for defense weight (names can be changed, of course).
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
- Celtic_Minstrel
- Developer
- Posts: 2214
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: [engine] Add filters for attack_ and defense_weight
Ah, I see what you mean now, but... I don't get what the use of that would be?
Also, can you please explain this?
Also, can you please explain this?
Re: [engine] Add filters for attack_ and defense_weight
I think we're talking about:Celtic_Minstrel wrote: ↑February 20th, 2019, 5:39 am Ah, I see what you mean now, but... I don't get what the use of that would be?
Also, can you please explain this?
Code: Select all
[attack_weight]
[filter_opponent]
race=troll
[/filter_opponent]
value=5
[/attack_weight]
[attack_weight]
[filter_opponent]
[not]
level=1,0
[/not]
[/filter_opponent]
value=1.5
[/attack_weight]
One proposition, if I understood correctly, is to not only have the
value
key, but also something like value_min
and value_max
. So if there is a conflict between a value
and a value_min
, then if value < value_min then the value_min is applied, and if value >= value_min then value is applied. And with likewise logics for all other cases.It gives us the ability to avoid conflicts, but doesn't necessarily stop them from appearing (what if the designer doesn't use them, only
value
?). So yes, this is hardly resolved.Allowing formulas could be one way to do this.
Code: Select all
attack_weight=if(level > 1, 5, if(...))
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
- Celtic_Minstrel
- Developer
- Posts: 2214
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: [engine] Add filters for attack_ and defense_weight
I see, somehow I missed (or didn't properly read) the original post. Certainly a formula might be preferable to changing the weighting to a tag... so what would the formula be called on? The weapon? That's clearly not what you're expecting, at least. The weapon's owner? The battle context, containing both opponents and their chosen weapon is probably the ideal here...
And if you're adding formula support to attack weight and defense weight, you might want to think about why (or if) they should be special. What about formulas for damage, number of strikes, etc?
And if you're adding formula support to attack weight and defense weight, you might want to think about why (or if) they should be special. What about formulas for damage, number of strikes, etc?
Re: [engine] Add filters for attack_ and defense_weight
There is formula support for strikes at least.
Re: [engine] Add filters for attack_ and defense_weight
Exactly what I think. Note however, I haven't got a clue about just exactly how difficult it would be to implement it in the engine.Celtic_Minstrel wrote: ↑February 21st, 2019, 4:26 amThe battle context, containing both opponents and their chosen weapon is probably the ideal here...
Without further thinking, I think it would be a nice addition, but maybe unnecessary: The original reasoning was custom weapon specials, andAnd if you're adding formula support to attack weight and defense weight, you might want to think about why (or if) they should be special. What about formulas for damage, number of strikes, etc?
[damage]
and [attacks]
weapon specials can already access and modify these values, and also have the appropriate filters at their disposal. The weighting however can't be accessed through the specials in this way.It's not in the wiki. Does it simply work like this?
Code: Select all
[attack]
number="formula here"
[/attack]
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
- Celtic_Minstrel
- Developer
- Posts: 2214
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: [engine] Add filters for attack_ and defense_weight
If it works I assume it would be:
Note the extra set of parentheses around the formula, which is used to signal to the engine that it is a formula rather than just a number. This is always needed when placing a formula in a key that normally just takes a value. If it does work here, I wonder what the "self" is though... the attack? The unit? The battle context as I mentioned above?
So anyway, what you're saying is that if the weighting could be accessed through specials, then you wouldn't need this feature? I suppose the
Code: Select all
[attack]
number="(formula here)"
[/attack]
So anyway, what you're saying is that if the weighting could be accessed through specials, then you wouldn't need this feature? I suppose the
[disable]
special could always be extended to allow setting the weights to something other than 0... not sure if that would interfere with its functioning though.