Preferred target category

Preferred target category

Requests for features in the spring code.

Moderator: Moderators

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Preferred target category

Post by Forboding Angel »

Basically just a tag to assign targeting priority. Atm the tags we have to control this are a bit clunky for that purpose.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: Preferred target category

Post by FLOZi »

Perhaps 'goodTargetCategory' to suggest it is the antithesis of badTargetCategory. Not all that clear I suppose. I for one can never remember how to spell preferred correctly. Except just then!

But yes, +1.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Preferred target category

Post by Forboding Angel »

It's easy :-) Just remember 1 f, 2 r's :=D

I agree with your logic, but good suggests something different than preferred.
User avatar
KingRaptor
Zero-K Developer
Posts: 838
Joined: 14 Mar 2007, 03:44

Re: Preferred target category

Post by KingRaptor »

A noTargetCategory would also be nice.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Preferred target category

Post by Forboding Angel »

+9001

Onlytargetcategory requires backwards logic. It's like only having access to a whitelist and not a blacklist.

I recently have been updating evo units so they shoot at unit types they do the most damage vs first, then anything else secondary, but the logic I've had to use is... strange to some extent.
klapmongool
Posts: 843
Joined: 13 Aug 2007, 13:19

Re: Preferred target category

Post by klapmongool »

Cool. Would be cool if it would be implemented in such a way that users could adjust this to their liking, via some widget.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Preferred target category

Post by knorke »

iirc units already prefer targets against which they deal more damage, there is even a funny random factor.

Would noTargetCategory just be all categories not in Onlytargetcategory?
Then maybe turn whitelist into blacklist in unitdef_post:

Code: Select all

local cats = "TANK SUB ZEPPELIN HORSE AIR"
local noTargetCategory = "ZEPPELIN AIR"
local Onlytargetcategory = ""

for c in cats :gmatch("%w+") do
 if string.find(noTargetCategory, c) == nil then
  Onlytargetcategory = Onlytargetcategory .. c .. " "
 end
end

io.write ("\nnoTargetCategory was:"..noTargetCategory .. "\n")
io.write ("and now Onlytargetcategory is:"..Onlytargetcategory )
---
noTargetCategory was:ZEPPELIN AIR
and now Onlytargetcategory is:TANK SUB HORSE 
I think better than more categories would be using AllowWeaponTarget callin. But it is shrouded in gloom.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Preferred target category

Post by Forboding Angel »

knorke wrote:iirc units already prefer targets against which they deal more damage, there is even a funny random factor.
Only if you're using the engine kludgy armordefs.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Preferred target category

Post by knorke »

What is the difference?

Code: Select all

weapondef:
damage = {
ARMORED = 100,
LIGHT = 100,
BUILDING = 200,
}
vs

Code: Select all

weapon def:
damage = 100
customParams = {
armortype   = "raider",

post:
if (damagetypelower == "raider") then
	wd.damage.ARMORED = weapondamage*1
	wd.damage.LIGHT = weapondamage*1
	wd.damage.BUILDING  = weapondamage*2
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Preferred target category

Post by smoth »

knorke wrote:What is the difference?

Code: Select all

weapondef:
damage = {
ARMORED = 100,
LIGHT = 100,
BUILDING = 200,
}
vs

Code: Select all

weapon def:
damage = 100
customParams = {
armortype   = "raider",

post:
if (damagetypelower == "raider") then
	wd.damage.ARMORED = weapondamage*1
	wd.damage.LIGHT = weapondamage*1
	wd.damage.BUILDING  = weapondamage*2
odd question coming from you. it is an automatic application of damage classes. Such things ease maintenance and ensure consistency.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: Preferred target category

Post by FLOZi »

Not an odd question at all - he's pointing out that, as far as the engine sees it, there is no difference. Thus making Forb's point moot.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Preferred target category

Post by Forboding Angel »

Well then, if that's the case, it's broken.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Preferred target category

Post by smoth »

how is the engine's internal handling of armor damage types kludgy forb?
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Preferred target category

Post by Forboding Angel »

Forboding Angel wrote:Well then, if that's the case, it's broken.
Maybe you misunderstood me. I'm telling you, it doesn't work the way flozi and knorke say it should. This is why I'm setting up categories for it.

smoth wrote:how is the engine's internal handling of armor damage types kludgy forb?
armordefs.lua is kludgy because it is extremely inefficient. It works, but it's very messy.


****************************************************

Stop derailing. This is about category tags that should be added.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Preferred target category

Post by smoth »

If the armordefs have to do with unit targeting that would be good to know with regards to unit targeting.

I am not sure what you are asking for based on the discussion at hand.

You only can do a white list yes..

onlytargetcategory = notair

etc

However, preferred target category would that be a NEW tag?

so you would do

preferedtargetcategory: air

and the weapon would priortize air targets only?


There is still the same damn problem I have had for years.. units locking into the first target they see. It worked in gundam like..

fly air unit at gundam, gundam targets air unit, run char it to shoot gundam while it is swatting at flies.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Preferred target category

Post by knorke »

If the armordefs have to do with unit targeting that would be good to know with regards to unit targeting.
The way I understand it: yes.
from looking at function GenerateWeaponTargets in rts/Game/GameHelper.cpp
(interessting to look at)
and the weapon would priortize air targets only?
already possible with badTargetCategory
For example in XTA missile turret and laser turret can both shot ground & air. Laser prefers groundtargets, missile prefers airtargets.

I wanted to look at evos amorblubs but the first thing I saw was like this and I did not understand:

Code: Select all

 -- add anything that can fly to the PLANES category
for name, ud in pairs(DEFS.unitDefs) do
  if (ud.customparams  and ud.customparams.armortype) then
        unitArmorType = string.upper(ud.customparams.armortype)
    table.insert(armorDefs[unitArmorType], name)
         Spring.Echo("Unit: ", ud.unitname, " Armorclass: ", unitArmorType) 
  end
end
I also noticed that
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Preferred target category

Post by smoth »

knorke wrote:
and the weapon would priortize air targets only?
already possible with badTargetCategory
For example in XTA missile turret and laser turret can both shot ground & air. Laser prefers groundtargets, missile prefers airtargets.
Hmm I was told that it made the unit inaccurate to the target? it de-priortizes the target?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Preferred target category

Post by knorke »

Hmm I was told that it made the unit inaccurate to the target?
It does not change accuracy of aim if you mean that.
it de-priortizes the target?
yes.
potential targets get a targetPriority based on on various things like distance etc.
Since lower targetPriority means more likely target (this sounds kinda backwards but whatever?) and badTargetCategory applies a do-not-target-this-factor of 100:

Code: Select all

if (targetUnit->category & weapon->badTargetCategory) {
  targetPriority *= 100.0f;
it means this unit gets less likely to be chosen.

In sim\weapons\weapon.cpp it says

Code: Select all

if ((nextTargetUnit->category & badTargetCategory) != 0) {
// save the "best" bad target in case we have no other
// good targets (of higher priority) left in <targets>
So I guess units in badTargetCategory will only be chosen if no other target is available.
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: Preferred target category

Post by Silentwings »

So I guess units in badTargetCategory will only be chosen if no other target is available.
That's the behaviour I saw when using badtargetcategory to make BA's T3 units & T2 def unlikely to target scouts.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Preferred target category

Post by Forboding Angel »

knorke wrote: I wanted to look at evos amorblubs but the first thing I saw was like this and I did not understand:
That's because you're looking in the completely wrong place:
https://code.google.com/p/evolutionrts/ ... ost.lua#86
Post Reply

Return to “Feature Requests”