Page 1 of 2
DecoyFor FBI Tag
Posted: 02 Feb 2007, 22:12
by trepan
I've added a "decoyFor" tag to the FBI file format. It solves a
couple of problems that exist in the current release, and makes
it easier to deliver enemy unit properties from LuaUI (without
giving away decoys).
Code: Select all
ARM_DECOY_COMMANDER.FBI:
decoyFor = arm_commander
CORE_DECOY_COMMANDER.FBI:
decoyFor = core_commander
If you do not apply this tag to your mod, then decoy commander
can be exposed in releases after 0.74b3 (assuming that this code
makes it into the next release).
Posted: 02 Feb 2007, 22:15
by Argh
Sweet. I'll have to play around with this a lot... "wait, that factory is moving..." "dude, it can't be..." "I swear I saw it move... OH NOOEEESS"
Posted: 02 Feb 2007, 22:21
by trepan
This doesn't really add any new functionality, it just corrects a couple
of tell-tales and prevents LuaUI cheats. You still have to match up the
model and unit name, and hide (or match) the health and resources
for decoys to be effective.
Posted: 02 Feb 2007, 22:26
by trepan
Note that "chains" of decoys are not supported.
Unit A is a decoy for Unit B
Unit B is a decoy for Unit C
etc...
Posted: 02 Feb 2007, 23:16
by AF
How exactly is this implemented? Will it mean AIs can rely on the UnitDef or AIs will have the false positive unitdef or AIs will see a bog standard default unitdef with a decoyfor tag?
Posted: 02 Feb 2007, 23:19
by trepan
I wasn't going to mention the current AI interface problem on the forum,
but as you already have... Yes, I've fixed CAICallback::GetUnitDef(), it
returns the decoy unitdef for decoy units for enemy units.
Posted: 02 Feb 2007, 23:32
by AF
Yes, I'd have liked that but at the same time ti poses a problem because I dont know what the unitdef will actualyl contain and what I should do about it.
I know that in this unitdef UnitDef::decoyfor == "unitname".
What about the other values? Are they all default values meanign I should check the unit this is a decoy for? Is it a copy of the decoys unitdef but with a decoy for tag? Is it just a seperate unit that has different unitdef values but hapens to have the decoyfor tag?
Also, if you start changing the AI interface to return Armfus untidef instead of armfusdecoy, then itll mess with AI algorithms currently in place and could start a raft of little changes that introduce ucnertainty that AIs werent designed for. The AI community in spring is already flailing as it is.
Posted: 02 Feb 2007, 23:43
by trepan
I have no desire to unramble your post, so:
Code: Select all
const UnitDef* CAICallback::GetUnitDef(int unitid)
{
verify ();
if (CHECK_UNITID(unitid)) {
CUnit* unit = uh->units[unitid];
if (unit == NULL) {
return NULL;
}
const UnitDef* unitDef = unit->unitDef;
const int allyTeam = gs->AllyTeam(team);
if (gs->Ally(unit->allyteam, allyTeam)) {
return unitDef;
}
if (unit->losStatus[allyTeam] & LOS_INLOS) {
const UnitDef* decoyDef = unitDef->decoyDef;
if (decoyDef == NULL) {
return unitDef;
} else {
return decoyDef;
}
}
}
return 0;
}
Posted: 02 Feb 2007, 23:48
by AF
-1.
Please change the getunitdef code back to what it used to be, else I'd reccomend AI makers use the cheat interface from now on so they can properly handle the decoy problem, and avoid groupAI development.
Posted: 03 Feb 2007, 00:04
by trepan
Please give a detailed example describing your problem with this change
(and realize that you get the real unitdef returned for allied units).
Posted: 03 Feb 2007, 11:59
by Tobi
I don't see a problem with the code posted above, it looks fine AFAICS. After all, an AI shouldn't be able to easily differentiate between enemy decoy coms and real coms, just like humans can't do that...
Since nothing changed for allied units nor in the decoy's UnitDef (except for the addition of the decoyFor tag), I really don't see how this could cause problems for AIs, unless they were exploiting this exploit...
Posted: 03 Feb 2007, 12:27
by trepan
Update (previously LOS'ed unitDef reporting):
Code: Select all
const UnitDef* CAICallback::GetUnitDef(int unitid)
{
verify ();
if (CHECK_UNITID(unitid)) {
CUnit* unit = uh->units[unitid];
if (unit == NULL) {
return NULL;
}
const UnitDef* unitDef = unit->unitDef;
const int allyTeam = gs->AllyTeam(team);
if (gs->Ally(unit->allyteam, allyTeam)) {
return unitDef;
}
const int losStatus = unit->losStatus[allyTeam];
const int prevMask = (LOS_PREVLOS | LOS_CONTRADAR);
if (((losStatus & LOS_INLOS) != 0) ||
((losStatus & prevMask) == prevMask)) {
const UnitDef* decoyDef = unitDef->decoyDef;
if (decoyDef == NULL) {
return unitDef;
} else {
return decoyDef;
}
}
}
return 0;
}
Posted: 03 Feb 2007, 19:28
by Foxomaniac
Um, so what you're saying is :
With this tag, the actual costs/energy production/metal etc etc shows up to the enemy but the true values are shown for you and your allies, allowing for TRUE decoys?
That'd be sweet.
Posted: 03 Feb 2007, 23:17
by danzel
Argh wrote:Sweet. I'll have to play around with this a lot... "wait, that factory is moving..." "dude, it can't be..." "I swear I saw it move... OH NOOEEESS"
Movable decoy buildings :D
Posted: 04 Feb 2007, 07:00
by REVENGE
Ok, so this means decoy fusions can be reimplemented in BA properly right? And I suppose this could also help hide everything from DCs to Moho Exploiter properly. Thanks man.
Posted: 04 Feb 2007, 08:59
by trepan
REVENGE:
I'm not sure that this change will do all that you're expecting it to.
For the most part, it only affects the AI and LuaUI interfaces
(and squashes a current tell-tale or two). As noted in the 3rd post
in this topic, you still have to match some parameters to have an
effective decoy.
Could you list the problems that with the current decoy system for
the units you mentionned? (If it's just a matter rigging the tooltip
display by scaling some values by [real / decoy], then I might be
able to do something about it before next release).
Posted: 04 Feb 2007, 09:05
by KDR_11k
Can we have a feature to make a unit look different for friendly and enemy players so we can put markings on units for telling them apart or displaying states without making that visible to the enemy?
Posted: 05 Feb 2007, 19:00
by trepan
I've got most of the code written for "full" decoys. As long as you
set "decoyFor" and use the same model, the units should be
indistinguishable. This includes faking the following properties:
- all tooltip text (including showPlayerName and hideDamage controls)
- all range circle types (decoys show with weapons even if the don't have them)
Most of the AI and LuaUI code has been adjusted too. Don't be
too surprised if I missed a couple of items though
KDR_11k: You can throw some graphics on units with LuaUI. Adding
dual model support (and tying it into the COB scripting), is not something
that I'd be doing any time soon. Examples:
-
http://trepan.bzflag.bz/spring/eta.jpg
-
http://spring.unknown-files.net/file/22 ... units.lua/
Posted: 05 Feb 2007, 20:39
by trepan
Posted: 05 Feb 2007, 21:08
by Foxomaniac
Cool, still shows the Techlevel though.
Or is that hidden from enemies?