Page 1 of 2
					
				Preferred target category
				Posted: 23 Feb 2013, 08:38
				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.
			 
			
					
				Re: Preferred target category
				Posted: 23 Feb 2013, 11:51
				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.
			 
			
					
				Re: Preferred target category
				Posted: 23 Feb 2013, 13:51
				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.
 
			
					
				Re: Preferred target category
				Posted: 24 Feb 2013, 04:18
				by KingRaptor
				A noTargetCategory would also be nice.
			 
			
					
				Re: Preferred target category
				Posted: 24 Feb 2013, 08:43
				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.
			 
			
					
				Re: Preferred target category
				Posted: 24 Feb 2013, 09:23
				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.
			 
			
					
				Re: Preferred target category
				Posted: 24 Feb 2013, 10:23
				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.
 
			
					
				Re: Preferred target category
				Posted: 24 Feb 2013, 11:41
				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.
 
			
					
				Re: Preferred target category
				Posted: 24 Feb 2013, 18:54
				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
 
			
					
				Re: Preferred target category
				Posted: 24 Feb 2013, 19:04
				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.
 
			
					
				Re: Preferred target category
				Posted: 24 Feb 2013, 19:35
				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.
			 
			
					
				Re: Preferred target category
				Posted: 25 Feb 2013, 03:22
				by Forboding Angel
				Well then, if that's the case, it's broken.
			 
			
					
				Re: Preferred target category
				Posted: 25 Feb 2013, 08:12
				by smoth
				how is the engine's internal handling of armor damage types kludgy forb?
			 
			
					
				Re: Preferred target category
				Posted: 25 Feb 2013, 13:47
				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.
 
			
					
				Re: Preferred target category
				Posted: 25 Feb 2013, 17:56
				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.
			 
			
					
				Re: Preferred target category
				Posted: 25 Feb 2013, 19:15
				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
 
			
					
				Re: Preferred target category
				Posted: 25 Feb 2013, 19:27
				by smoth
				
Hmm I was told that it made the unit inaccurate to the target? it de-priortizes the target?
 
			
					
				Re: Preferred target category
				Posted: 25 Feb 2013, 19:55
				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.
 
			
					
				Re: Preferred target category
				Posted: 25 Feb 2013, 20:56
				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.
 
			
					
				Re: Preferred target category
				Posted: 26 Feb 2013, 13:21
				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