Valid targets and tcs

Issues in the game itself, so no crash report but anything that works badly / or other way it should- but without a crash.
Post Reply
Midonik
Posts: 5325
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Valid targets and tcs

Post by Midonik »

I observed some weird behaviours and I'm able to deduce that units with trnValidTargets (also effects) can only be used on units inside tcs if the tc's category is in their valid targets.
Further conclusions:
a) Including the tc in the valid targets lets units attack other units in it, even though they can't attack other buildings
b) Those units (with trnValidTargets, excluded buildings, included tcs) attacking units in tcs deal damage
c) Those units (like above) can always attack a unit inside the tc, even if that unit isn't included in their valid targets.

@Savra @Endru1241 we need to figure out a solution (cause the change will affect all variants). @Stratego (dev)'s suggestions:
a)
- tc not set as target
- but you still can target it if there is a targetable unit and that will get the shot (so practically you can "peek" into tc what kind of units are there)

b)
- tc set as target
- but it will only let the target sigh appear if there is any unit in it
- but if in there only unit what is not valid target it will simply be not damaged (attacker will not know if attack was effective or not)
- b1) it only attacks the first unit (and damages if it was valid target)
- b2) it attacks the first VALID target unit inside, if none deals no damage.


For me b2 seems like the nicest idea.
Support new AoS variant, Age of Galaxy: http://ageofstrategy.net/viewforum.php? ... 608408ebc8
All help will be welcome.
User avatar
Endru1241
Posts: 2717
Joined: Fri Sep 11, 2015 8:43 am
Location: Poland

Re: Valid targets and tcs

Post by Endru1241 »

I haven't checked what happens if unit has validTargets set(there is none in AoS), but when effects have effectAffect with ValidTargets, which doesn't include TC they can be casted on TC with valid target inside (on top) if effect has spec CAN_TARGET_TC_FIRST.
This is the case for e.g. Rajput throw chakram and it works in newest AoS dev version.
I'll check the other spec and unit validTargets.
Age of Strategy design leader
Midonik
Posts: 5325
Joined: Mon Sep 05, 2016 5:27 pm
Location: Poland

Re: Valid targets and tcs

Post by Midonik »

Perhaps.
With effects, what I tested was that a abilities that only affect buildings can attack units inside tcs (that obviously aren't buildings).
Support new AoS variant, Age of Galaxy: http://ageofstrategy.net/viewforum.php? ... 608408ebc8
All help will be welcome.
User avatar
Endru1241
Posts: 2717
Joined: Fri Sep 11, 2015 8:43 am
Location: Poland

Re: Valid targets and tcs

Post by Endru1241 »

I have checked with units and it works in AoS exactly like described by you.
UNIT1 with added "trnValidTargets":{"categories":["U_FLESH_AND_BLOOD"]}, line cannot target TC, even though there is flesh and blood unit in this TC.
UNIT2 with added "trnValidTargets":{"categories":["U_UTILISE_ROAD"]}, can target TC and attacks unit inside, while this is the same flesh and blood unit, that doesn't have U_UTILISE_ROAD category.

As for solution:
I think it should work like effect with CAN_TARGET_TC_FIRST, so:
- checking if unit is targettable should be then something like that imho

if (
( targetUnit.hasSpec(IS_CARRIED_DAMAGABLE) || targetUnit.hasSpec(IS_TC) ) //checks if it even matters that target is carrying any unit
&& targetUnit.carriedUnits().Length > 0 // checks if it is carrying any unit
&& CheckIfCanBeAttacked(unit, targetUnit.carriedUnits()[0]) // checks if carried unit is able to be attacked
)
canTarget=true;
else if (CheckIfCanBeAttacked(unit, targetUnit) ) // otherwise just checks if unit itself is possible to be attacked
canTarget=true;
else
canTarget=false;

It assumes that CheckIfCanBeAttacked is currently used method and this part of code is inserted somewhere around the call.
Of course it could be changed and inserted in the method itself as a recursive call to be a little more precise (in case there is a carrier with IS_CARRIED_DAMAGABLE spec and some unit inside a carrier with IS_CARRIED_DAMAGABLE (or TC) ).
Anyway in original method or in later parts of the code it should check the other things it already checks - validTargets, IS_INATTACKABLE spec etc.

So I'd say a variation of your option a), but including non-TC targets, that are also concerned about the same issue (probably - haven't checked).
Option b) assumes too much unclear rules. It may be fine right now, but sooner or later it could bite us.
Age of Strategy design leader
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Valid targets and tcs

Post by Stratego (dev) »

my approach would be hiding the internal units from the attacker.
so not "telling him" what is inside.

i would say if TC has units in it (and is that is visible to attacker too) then always let target - but damage should not be dealt on unit that is not capable to target.

as your way the attacker can "figure out" what unit is inside just by test-targeting the TC with different valid target sete units.
User avatar
Endru1241
Posts: 2717
Joined: Fri Sep 11, 2015 8:43 am
Location: Poland

Re: Valid targets and tcs

Post by Endru1241 »

And yet any unit has 100% effective ability to discover stealth unit on adjacent range.
Why try to keep it hidden at all cost and create a precedent of weird behaviour?

Where does the damage go then?

If e.g. there is some special specialised bomber, that can only attack ground units and attacks tc, but it turns out there was one fighter on top and 2 ground units below.
Yet there is no damage after bombing?

As normally there is actually no case of units attacking and not dealing damage at all it would be very confusing to players, that such thing started to happen.

Additionally it's bad for AI.

Effects doesn't even get the option to have such behaviour.
Either they can target and affect or doesn't target at all.
If CAN_TARGET_TC_FIRST is added then they can only target if top unit is targetable, otherwise they are prevented from targeting.
If CAN_TARGET_TC_FIRST_TARGETABLE is added then they skip over first unit, like such bomber maybe should.

Why not make attacks like that too:
- by default cannot target TC if doesn't have it in valid targets
- copy spec CAN_TARGET_TC_FIRST resolve to unit attack logic
- copy spec CAN_TARGET_TC_FIRST_TARGETABLE resolve to unit attack logic too
- new spec with some description, that would give some hint to player CAN_TARGET_TC_NO_DAMAGE_IF_INVALID_TARGET - that one working with disappearing damage.
Age of Strategy design leader
User avatar
makazuwr32
Posts: 7830
Joined: Tue Oct 17, 2017 9:29 am
Location: Moscow, Russia

Re: Valid targets and tcs

Post by makazuwr32 »

My personal 5 cents from balancer view:
1. All units in tcs must be targetable by enemy units (i do not touch here valid targets though). They are crowded there, they do not have space to fly and such. Even further, i want to make for units in tc to receive full damage (not reduced by various invisibilities like "flying unit attacked by enemy who can't hit flyers").

2. Attackers with "valid targets" set must be able to attack tc but only first valid target and if enemy is not in the list of valid targets than they should deal no (or reduced) damage (so you attack tc anyway but you won't do damage to enemy if there are no valid targets). For example in aof there is planned flying unit that can target only enemy flyers but not ground units (simply because this aerostat-based unit has a stationary weapon and you can't change height or angle to attack ground units fast) — it must be able to attack tc but not being able to deal any (or at least full) damage to units who are not flying.

3. As result: you can attack tc for sure but you can't know if you damaged enemy in tc or not (or at least if you damaged enemy for full power or for halved).

For me solution a with change when you can target tc with units inside no matter what they are is best. Especially because similar thing will be done to other capturable buildings as well — you target unit inside no matter what it is but you must not know outcome of your attack.

I am fine if "no damage if no valid targets" will be replaced with "halved damage if no valid targets" as well.
Main point is that unit with valid targets set must not be able to deal full damage to non-valid targets in tc.
makazuwr32 wrote: Mon Sep 16, 2019 7:54 amWhen you ask to change something argument why...
Put some numbers, compare to what other races have and so on...
© by Makazuwr32™.
AoF Dev Co-Leader
Image
User avatar
Endru1241
Posts: 2717
Joined: Fri Sep 11, 2015 8:43 am
Location: Poland

Re: Valid targets and tcs

Post by Endru1241 »

If a logic with targeting units that hide carried ones, but still allow damage and not dealing any damage would be implemented as a default, then the same behaviour should be given at least as a spec for effects, because some effects are essentially used as secondary attacks.
There are some differences already between effects and attacks (damage on area only on enemies, miss chance related to speed, miss chance creating attack on adjacent tile) - let's not create another one.
Age of Strategy design leader
User avatar
makazuwr32
Posts: 7830
Joined: Tue Oct 17, 2017 9:29 am
Location: Moscow, Russia

Re: Valid targets and tcs

Post by makazuwr32 »

About effects:
It is different in different games.

In aof for example exorcism which must be able target only undeads should not be able to target any non-undead unit. And in general in aof abilities are not "different ways to attack" in in the first place.

As for targeting: i am fine if in such situations damage will be simply halved from base.
makazuwr32 wrote: Mon Sep 16, 2019 7:54 amWhen you ask to change something argument why...
Put some numbers, compare to what other races have and so on...
© by Makazuwr32™.
AoF Dev Co-Leader
Image
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Valid targets and tcs

Post by Stratego (dev) »

Endru1241 wrote: Thu Sep 23, 2021 11:44 pm And yet any unit has 100% effective ability to discover stealth unit on adjacent range.
Why try to keep it hidden at all cost and create a precedent of weird behaviour?

Where does the damage go then?

If e.g. there is some special specialised bomber, that can only attack ground units and attacks tc, but it turns out there was one fighter on top and 2 ground units below.
Yet there is no damage after bombing?

As normally there is actually no case of units attacking and not dealing damage at all it would be very confusing to players, that such thing started to happen.

Additionally it's bad for AI.

Effects doesn't even get the option to have such behaviour.
Either they can target and affect or doesn't target at all.
If CAN_TARGET_TC_FIRST is added then they can only target if top unit is targetable, otherwise they are prevented from targeting.
If CAN_TARGET_TC_FIRST_TARGETABLE is added then they skip over first unit, like such bomber maybe should.

Why not make attacks like that too:
- by default cannot target TC if doesn't have it in valid targets
- copy spec CAN_TARGET_TC_FIRST resolve to unit attack logic
- copy spec CAN_TARGET_TC_FIRST_TARGETABLE resolve to unit attack logic too
- new spec with some description, that would give some hint to player CAN_TARGET_TC_NO_DAMAGE_IF_INVALID_TARGET - that one working with disappearing damage.
i have not talked about stealth.
i talked about TC internal units.

---------

so u suggest to "tell" the attacker the internals by the targeting icon - so showing or not showing the target sign?
For me solution a with change when you can target tc with units inside no matter what they are is best. Especially because similar thing will be done to other capturable buildings as well — you target unit inside no matter what it is but you must not know outcome of your attack.
here i feel you say the same as me: if tc has ANY unit inside it should be TARGETED, but maybe it will deal no damage if any setting of unit prevents is (eg. not a valid target), or a flying so it will only get 1 damage (or 0 damage if we later change them to not deal any to flayers - just an example).

If a logic with targeting units that hide carried ones, but still allow damage and not dealing any damage would be implemented as a default, then the same behaviour should be given at least as a spec for effects, because some effects are essentially used as secondary attacks.
There are some differences already between effects and attacks (damage on area only on enemies, miss chance related to speed, miss chance creating attack on adjacent tile) - let's not create another one.
i agree both attack and spells/ablilityies should work the same way
As for targeting: i am fine if in such situations damage will be simply halved from base.
this seems off topic, we do not make any random halved damage - this topic is about targeting (target sign) and dealing or not dealing damage on "invalid target" cases.
User avatar
Endru1241
Posts: 2717
Joined: Fri Sep 11, 2015 8:43 am
Location: Poland

Re: Valid targets and tcs

Post by Endru1241 »

Stratego (dev) wrote: Fri Sep 24, 2021 10:33 am
Endru1241 wrote: Thu Sep 23, 2021 11:44 pm And yet any unit has 100% effective ability to discover stealth unit on adjacent range.
Why try to keep it hidden at all cost and create a precedent of weird behaviour?

Where does the damage go then?

If e.g. there is some special specialised bomber, that can only attack ground units and attacks tc, but it turns out there was one fighter on top and 2 ground units below.
Yet there is no damage after bombing?

As normally there is actually no case of units attacking and not dealing damage at all it would be very confusing to players, that such thing started to happen.

Additionally it's bad for AI.

Effects doesn't even get the option to have such behaviour.
Either they can target and affect or doesn't target at all.
If CAN_TARGET_TC_FIRST is added then they can only target if top unit is targetable, otherwise they are prevented from targeting.
If CAN_TARGET_TC_FIRST_TARGETABLE is added then they skip over first unit, like such bomber maybe should.

Why not make attacks like that too:
- by default cannot target TC if doesn't have it in valid targets
- copy spec CAN_TARGET_TC_FIRST resolve to unit attack logic
- copy spec CAN_TARGET_TC_FIRST_TARGETABLE resolve to unit attack logic too
- new spec with some description, that would give some hint to player CAN_TARGET_TC_NO_DAMAGE_IF_INVALID_TARGET - that one working with disappearing damage.
i have not talked about stealth.
i talked about TC internal units.
It was only a comparison to show that there are already things in game, that should work differently according to the same logic.
I feel weirded out by sudden overall agreement, that hiding from player if unit can attack is top priority.
Over consistency, over logic, over screwing AI and making players confused.

You quoted my whole post and only referenced first line.
The one that had the least to do with my whole post.
The only one less relevant.

That was a low one.
Age of Strategy design leader
Stratego (dev)
Site Admin
Posts: 15741
Joined: Fri Apr 25, 2014 9:28 pm

Re: Valid targets and tcs

Post by Stratego (dev) »

that hiding from player if unit can attack is top priority.
no one said this.

sorry for bad quoting.

ok, i dont post here more illogic things :)

-> please everyone get to a conclusion and i will make it...
User avatar
Endru1241
Posts: 2717
Joined: Fri Sep 11, 2015 8:43 am
Location: Poland

Re: Valid targets and tcs

Post by Endru1241 »

makazuwr32 wrote: Fri Sep 24, 2021 9:34 am In aof for example exorcism which must be able target only undeads should not be able to target any non-undead unit. And in general in aof abilities are not "different ways to attack" in in the first place.
Yet even in AoF there are some effect that indeed work just like attack.
Whip attack, Throw spear, multiple different whirlwind attacks.

In AoS the number of such effects is possibly actually lower, but is bigger percentage of all.
Stratego (dev) wrote: Fri Sep 24, 2021 12:54 pm
that hiding from player if unit can attack is top priority.
no one said this.

sorry for bad quoting.

ok, i dont post here more illogic things :)

-> please everyone get to a conclusion and i will make it...
I am sorry if I wrote something too harsh.
Over consistency, over logic, over screwing AI and making players confused.
was only referencing points of earlier post. Points, about which I was disappointed when were ignored.
I got too concentrated on writing things related to it and didn't check how it sounded.

I am afraid of a case similar to old damage bonuses logic (there are still some leftovers).
If unit has bonus damage then 1 thing happens and if it doesn't - another.
Complex and perfectly balanced to the needs at the time of implementation.
But with time needs can change and it's extremely hard to change whole algorithm then (especially as it would probably be fixed and changed further over time).

I was especially hoping for your opinion on:
Effects doesn't even get the option to have such behaviour.
Either they can target and affect or doesn't target at all.
If CAN_TARGET_TC_FIRST is added then they can only target if top unit is targetable, otherwise they are prevented from targeting.
If CAN_TARGET_TC_FIRST_TARGETABLE is added then they skip over first unit, like such bomber maybe should.

Why not make attacks like that too:
- by default cannot target TC if doesn't have it in valid targets
- copy spec CAN_TARGET_TC_FIRST resolve to unit attack logic
- copy spec CAN_TARGET_TC_FIRST_TARGETABLE resolve to unit attack logic too
- new spec with some description, that would give some hint to player CAN_TARGET_TC_NO_DAMAGE_IF_INVALID_TARGET - that one working with disappearing damage.
I tried to think of solution to be consistent with existing effects logic and to avoid too complex in-code rules.
Age of Strategy design leader
Post Reply

Return to “Game”