DecoyFor FBI Tag

DecoyFor FBI Tag

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

DecoyFor FBI Tag

Post 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).
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post 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"
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post 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.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post 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...
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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?
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post 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.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post 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;
}
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post 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).
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post 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...
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post 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;
}
User avatar
Foxomaniac
Posts: 691
Joined: 18 Jan 2006, 16:59

Post 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.
danzel
Posts: 56
Joined: 30 Sep 2005, 01:49

Post 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
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Post 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.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post 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).
Last edited by trepan on 04 Feb 2007, 09:18, edited 1 time in total.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post 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?
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post 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/
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

User avatar
Foxomaniac
Posts: 691
Joined: 18 Jan 2006, 16:59

Post by Foxomaniac »

Cool, still shows the Techlevel though.

Or is that hidden from enemies?
Post Reply

Return to “Game Development”