Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Tiberian Technologies / Blackhand Studios » Tiberian Technologies Forum » Set_Attack no longer seems to account for Bullseye offset
Set_Attack no longer seems to account for Bullseye offset [message #487630] Sun, 18 May 2014 07:11 Go to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3806
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
Ever since I started using 4.1 I've been noticing AI shoot at the feet of infantry and the origin of vehicles, which looks especially bad when they have sniper rifles.

Its also an issue on hilly terrain because AI avoids firing half the time they can see the enemy because they can't get a clear shot at the units feet.

Is there a new param I have to pass in to the Set_Attack functionality or did we just accidently misplace a line of code?


Re: Set_Attack no longer seems to account for Bullseye offset [message #487632 is a reply to message #487630] Sun, 18 May 2014 08:44 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
There is a new target bone you can create which overrides the targeting position for anything. As for shooting at feet it depends which ai code you're using?

http://steamsignature.com/card/1/76561197975867233.png
Re: Set_Attack no longer seems to account for Bullseye offset [message #487634 is a reply to message #487632] Sun, 18 May 2014 16:23 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3806
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)

ActionParamsStruct params;
params.Set_Basic(this,999,10);
params.Set_Attack(target,7.5f,1,true);
Commands->Action_Attack(obj,params);

As for making use of this new target bone, its a bit late to put it into the skeleton for deer, cats, bears, human males, human females, and mutants as that would require redoing ~3,000 animations (because if you change the base skeleton's bones all the animations using it fall apart, so you have to reexport about ~500 animations a piece with each skeleton).


Re: Set_Attack no longer seems to account for Bullseye offset [message #487640 is a reply to message #487630] Mon, 19 May 2014 03:53 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Vector3 SoldierGameObj::Get_Bullseye_Position()
{
  if (Vehicle)
    return Vehicle->Get_Bullseye_Position();

  RenderObjClass* model = Peek_Physical_Object()->Peek_Model();

  int boneIndex = model->Get_Bone_Index("target");
  if (boneIndex > 0)
    return model->Get_Bone_Transform(boneIndex).Get_Translation();

  boneIndex = model->Get_Bone_Index("C SPINE1");
  if (boneIndex > 0)
    return model->Get_Bone_Transform(boneIndex).Get_Translation();

  return model->Get_Position();
}



You are correct in that it doesn't seem to make use of the Z offset in the preset definition, unlike the stock code which does appear to use it and even has a special case for Is_Crouched(). You'd have to ask jonwil why we no longer use the bullseye Z offset for that, although my guess is that it was assumed all infantry had a C_SPINE1 bone to aim at (this is roughly in the middle of the chest of all standard rigs)


Jerad Gray wrote on Mon, 19 May 2014 00:23

you have to reexport about ~500 animations a piece with each skeleton).


You can cut down the number of skeletons you need to export by only exporting one weapon pose set since it sounds like most of those won't be holding weapons anyway. Also I wasn't aware anyone had actually gone to the effort of making fully functioning skeleton sets in W3D, the reason BHP has never implemented dog units is because the skeleton animation sets are poorly documented and it's always considered to be too much work for a single unit to create all the animations.

Not that I'm suggesting you should do this, just pointing out that for future skeletons you can reduce the amount of effort required.


http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Mon, 19 May 2014 03:59]

Report message to a moderator

Re: Set_Attack no longer seems to account for Bullseye offset [message #487641 is a reply to message #487640] Mon, 19 May 2014 05:44 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3806
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
danpaul88 wrote on Mon, 19 May 2014 04:53

Vector3 SoldierGameObj::Get_Bullseye_Position()
{
  if (Vehicle)
    return Vehicle->Get_Bullseye_Position();

  RenderObjClass* model = Peek_Physical_Object()->Peek_Model();

  int boneIndex = model->Get_Bone_Index("target");
  if (boneIndex > 0)
    return model->Get_Bone_Transform(boneIndex).Get_Translation();

  boneIndex = model->Get_Bone_Index("C SPINE1");
  if (boneIndex > 0)
    return model->Get_Bone_Transform(boneIndex).Get_Translation();

  return model->Get_Position();
}



You are correct in that it doesn't seem to make use of the Z offset in the preset definition, unlike the stock code which does appear to use it and even has a special case for Is_Crouched(). You'd have to ask jonwil why we no longer use the bullseye Z offset for that, although my guess is that it was assumed all infantry had a C_SPINE1 bone to aim at (this is roughly in the middle of the chest of all standard rigs)


C SPINE1 but yes that's true, I'd think if you were grabbing a bone position at run time you'd want to just grab c head that way your snipers don't look like dumbasses and go for that damage multiplier.

danpaul88 wrote on Mon, 19 May 2014 04:53


You can cut down the number of skeletons you need to export by only exporting one weapon pose set since it sounds like most of those won't be holding weapons anyway. Also I wasn't aware anyone had actually gone to the effort of making fully functioning skeleton sets in W3D, the reason BHP has never implemented dog units is because the skeleton animation sets are poorly documented and it's always considered to be too much work for a single unit to create all the animations.

Not that I'm suggesting you should do this, just pointing out that for future skeletons you can reduce the amount of effort required.


I'm pretty sure I'm the first to actually do it, and I do all positions because I let the player play as the animals in ECW, deer and bears hold guns in their muzzles just like real animals Very Happy

Cats, Deer, and Bears are all I've done so far. I never did dogs because I figured if any animal did get done it'd be dogs so I could leave that up to the rest of the Renegade community. Did cats like 7 years ago now, deer was just 1 year ago and bears I did 2 months ago in 3 days (gets so much easier the 3rd time) because Liquid wanted me to make a map in dedication to a Renegade player named bears, I've just been fine tuning it every day up to this point, almost got it done now!




[Updated on: Mon, 19 May 2014 05:52]

Report message to a moderator

Re: Set_Attack no longer seems to account for Bullseye offset [message #487644 is a reply to message #487641] Mon, 19 May 2014 06:00 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Jerad Gray wrote on Mon, 19 May 2014 13:44


I'm pretty sure I'm the first to actually do it, and I do all positions because I let the player play as the animals in ECW, deer and bears hold guns in their muzzles just like real animals Very Happy



I did a partial infantry skeleton rig for my TA mod about 5 years ago but I never finished it off, it went crazy-haywire when you crouched, jumped in an usual direction or used weapon poses I hadn't exported Razz Guess that makes me the second if your first was 7 years ago, although I'm not sure if a partially finished one counts.


http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Mon, 19 May 2014 06:01]

Report message to a moderator

Re: Set_Attack no longer seems to account for Bullseye offset [message #487646 is a reply to message #487630] Mon, 19 May 2014 06:26 Go to previous messageGo to next message
jonwil is currently offline  jonwil
Messages: 3556
Registered: February 2003
Karma: 0
General (3 Stars)

The relavent changes to Get_Bullseye_Position came as part of a commit labeled "Fixed target bone, ob->transport and backwalking ob bugs." and were done by StealthEye back in 2008.
No I dont know exactly why he did those changes or what their purpose is.

As for human animations, I made this post http://www.renegadeforums.com/index.php?t=msg&goto=480702 about a year ago that attempted to document all the human animations based on the human animation code.

Feel free to post (in that thread or in here) if you have any questions about human animations and I will do my best to answer them.

Oh and it should be possible to add another bone to a skeleton without needing to re-export any animations as long as the new bone have no child bones, geometry or animations attached to it anywhere. If adding a new bone and re-exporting causes the order/bone number of the bones in the output skeleton file to change, its possible to fix that up by taking the file containing the new bone and copying the new bone into the original skeleton such that the new bone is the last bone in the skeleton (keeping the numbers for the existing bones the same and hence keeping the animations functioning)


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies

[Updated on: Mon, 19 May 2014 06:32]

Report message to a moderator

Re: Set_Attack no longer seems to account for Bullseye offset [message #487648 is a reply to message #487646] Mon, 19 May 2014 06:56 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3806
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
I assume the Z leg style are a new addition?
Same for weapon styles G H I and J? (If not my export for ECW is bad and I better redo it).


Re: Set_Attack no longer seems to account for Bullseye offset [message #487649 is a reply to message #487630] Mon, 19 May 2014 07:03 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
G, H, I and J have been there since at least 2009 and I suspect are stock code. G is probably used during planting of a beacon (the "hold beacon in both hands at arms length" thing), H is used when the "no weapon" weapon is selected (weaponbag index 0), I is one of the hold styles (at chest, I think this is when the character relaxes from a firing pose to an "at ease" pose) and I'm not sure why J would be used.

The above uses are what I've surmised based on the things I know the engine can generally do, may not be 100% accurate.




The flying leg styles were added in 2009 as new code for the FLYING human animation state.


http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Mon, 19 May 2014 07:03]

Report message to a moderator

Re: Set_Attack no longer seems to account for Bullseye offset [message #487652 is a reply to message #487649] Mon, 19 May 2014 09:57 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3806
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
So what's the course of action here, are we going to phase bulls eye offset out of all the code and make it use the target bones, or are we going to just re-implement the bulls eye offset and make it work with crouch, or are we just going to leave it out of sync, let some chunks of code use the bulls eye off set and other chunks of code use target bones?

As a fun though, does the AI aim for the "c spine1" bone on visceroids? If so then AI won't shoot at them if there is a little ledge covering up their origin Very Happy

IE:
index.php?t=getfile&id=14947&private=0


OR could we just:
Vector3 SoldierGameObj::Get_Bullseye_Position()
{
  if (Vehicle)
    return Vehicle->Get_Bullseye_Position();

  RenderObjClass* model = Peek_Physical_Object()->Peek_Model();

  int boneIndex = model->Get_Bone_Index("target");
  if (boneIndex > 0)
    return model->Get_Bone_Transform(boneIndex).Get_Translation();

  boneIndex = model->Get_Bone_Index("C SPINE1");
  if (boneIndex > 0)
    return model->Get_Bone_Transform(boneIndex).Get_Translation();

  Get_Bullseye_Position();//Pretty sure all GameObjects have a bullseye offset  and definitely all soldiers do
}
  • Attachment: Untitled.jpg
    (Size: 137.49KB, Downloaded 369 times)


[Updated on: Mon, 19 May 2014 10:04]

Report message to a moderator

Re: Set_Attack no longer seems to account for Bullseye offset [message #487653 is a reply to message #487652] Mon, 19 May 2014 10:43 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Calling Get_Bullsye_Position recursively isn't going to help you out much.... Razz

The bullseye has already been removed from all code, that function I quoted is where it used to be used, now it isn't. The only places that still refer to it are in the pathfinding and action code and it only uses it to make the soldier aim forward at eye level when running around without a target to shoot.


The original version of that code looked something like this;

Vector3 SoldierGameObj::Get_Bullseye_Position( void )
{
  if (Get_Vehicle() != NULL)
    return Get_Vehicle()->Get_Bullseye_Position();

  Vector3 pos;
  Get_Position(&pos);
  pos.Z += Is_Crouched() ? 0.5f : Get_Bullseye_Offset_Z();

  return pos;
}


http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Mon, 19 May 2014 10:46]

Report message to a moderator

Re: Set_Attack no longer seems to account for Bullseye offset [message #487654 is a reply to message #487653] Mon, 19 May 2014 12:08 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3806
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
Yeah sorry about that, bit distract just typing up my responses at work, I don't have access to this chunk of code your showing. I do see we have Get_Bullseye_Offset_Z, so obviously we might still be able to do
Vector3 SoldierGameObj::Get_Bullseye_Position()
{
  if (Vehicle)
    return Vehicle->Get_Bullseye_Position();

  RenderObjClass* model = Peek_Physical_Object()->Peek_Model();

  int boneIndex = model->Get_Bone_Index("target");
  if (boneIndex > 0)
    return model->Get_Bone_Transform(boneIndex).Get_Translation();

  boneIndex = model->Get_Bone_Index("C SPINE1");
  if (boneIndex > 0)
    return model->Get_Bone_Transform(boneIndex).Get_Translation();


  Vector3 pos;
  Get_Position(&pos);
  pos.Z += Is_Crouched() ? 0.5f : Get_Bullseye_Offset_Z();
  return pos;
}

Unless that stuff has been changed as well.


Re: Set_Attack no longer seems to account for Bullseye offset [message #487655 is a reply to message #487630] Mon, 19 May 2014 16:40 Go to previous messageGo to next message
jonwil is currently offline  jonwil
Messages: 3556
Registered: February 2003
Karma: 0
General (3 Stars)

Weapon styles G,H,I and J are most definatly stock weapon styles.
And yes, Z was added for flying infantry.
As for bullseye position, I dont know what to do.


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
Re: Set_Attack no longer seems to account for Bullseye offset [message #487656 is a reply to message #487630] Tue, 20 May 2014 00:57 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
My guess would be that the only cases that are ever hitting the last return statement in the current code would be Jerad's custom rigs, since all the stock rigs have C SPINE1. Thus changing it to add the Z bullseye offset to that last return value shouldn't impact any other scripts users nor stock Renegade.

That said, it might be better for Jerad to be more specific about where he wants the AI and homing missiles to aim at on his units and add the custom bone as per

jonwil wrote on Mon, 19 May 2014 14:26

Oh and it should be possible to add another bone to a skeleton without needing to re-export any animations as long as the new bone have no child bones, geometry or animations attached to it anywhere. If adding a new bone and re-exporting causes the order/bone number of the bones in the output skeleton file to change, its possible to fix that up by taking the file containing the new bone and copying the new bone into the original skeleton such that the new bone is the last bone in the skeleton (keeping the numbers for the existing bones the same and hence keeping the animations functioning)




@Jerad it's a shame you weren't testing this stuff whilst 4.x was being beta tested, it was more likely to get fixed at that time...


http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Tue, 20 May 2014 01:00]

Report message to a moderator

Re: Set_Attack no longer seems to account for Bullseye offset [message #487657 is a reply to message #487656] Tue, 20 May 2014 05:38 Go to previous message
Jerad2142 is currently offline  Jerad2142
Messages: 3806
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
danpaul88 wrote on Tue, 20 May 2014 01:57

My guess would be that the only cases that are ever hitting the last return statement in the current code would be Jerad's custom rigs, since all the stock rigs have C SPINE1. Thus changing it to add the Z bullseye offset to that last return value shouldn't impact any other scripts users nor stock Renegade.


Actually visceroids is what it would hit, I planned on adding the bone to my rigs the way Jonwil suggested however it stuck the new bone right in the middle of the file, and while I assume moving it to the end would work, I also have the suspicion that sticking it on the end of the file would make it attach to the wrong bone, so as it animates the target bone could very well end up outside the body. So instead beings the animations do just use the bone position numbers I'll probably just rename one in the skeleton and just never look at it again so it doesn't bother me (like rename c head to target).

danpaul88 wrote on Tue, 20 May 2014 01:57


That said, it might be better for Jerad to be more specific about where he wants the AI and homing missiles to aim at on his units and add the custom bone as per


To be fair I'd want missiles to home toward the center of the deer's body and snipers to aim at the head of deer, missiles are never going to manage to hit deer as they prance around if they're trying to hit the face due to how much they move up and down as they prance across the field.

danpaul88 wrote on Tue, 20 May 2014 01:57


@Jerad it's a shame you weren't testing this stuff whilst 4.x was being beta tested, it was more likely to get fixed at that time...

I was determined to get ECW as stable as possible before we moved to 4.X, that way I'd be able to know what 4.X breaks and what was already broken, with a team of 2 (that's really all that's left now, Blazea does the modeling and I do the programming and LE work) this was quite a task so it took me quite a while to complete the last public release. Also I never was invited to be a tester, but with the number of people that don't even know Rp2/ECW exists/is still in progress I guess that shouldn't surprise me.


[Updated on: Tue, 20 May 2014 06:19]

Report message to a moderator

Previous Topic: Level Edit
Next Topic: nulling damage script?
Goto Forum:
  


Current Time: Wed Jul 24 04:44:02 MST 2024

Total time taken to generate the page: 0.00936 seconds