Limited fire-arc behaviour problem

Limited fire-arc behaviour problem

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Limited fire-arc behaviour problem

Post by Warlord Zsinj »

In IW, our stormtroopers have a limited fire arc so that they cannot twist their torsos 360 degrees.

However, in many instances when a stormtrooper is attacked from behind, or even anywhere outside his fire arc, he will not turn to face the attacker in order to move the attacker into his fire arc.

As far as I can tell this is a spring-related problem, not mod-related.

This is not a consistent problem - sometimes units will turn to face the attacker, other times they will sit around and be shot in the back. My guess is that if units need to move to intercept a unit that is in LOS but not range then they will turn around, because the 'move to intercept' orients them the right way, but if the unit is in range and LOS at the same time, then the unit does not turn to engage.

A fix for this would be greatly appreciated, limited-arc behaviour is common to many non-TA mods, so this sort of behaviour is really essential.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Limited fire-arc behaviour problem

Post by smoth »

yeah it is annoying.

WIGGLE WIGGLE WIGGLE
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Re: Limited fire-arc behaviour problem

Post by Warlord Zsinj »

So, according to that thread, the problem will be fixed next Spring release?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Limited fire-arc behaviour problem

Post by Argh »

I wrote all of that whilst getting your infantry functional, over a year ago.

And no, it still doesn't work perfectly. The invisa-weapon thing doesn't really fix it completely. I've considered other things, but haven't experimented with them yet- among other things, Lua could almost certainly handle this, by giving the unit a new heading. That'd badly break patrol behaviors, though, without a lot of complex overhead.

And I know for a fact that units will turn if fired upon, but won't automatically turn to engage the closest target that's in LOS.

The CAI code is supposed to make units turn to a heading that will allow Weapon1 to fire, always. It doesn't work. I dunno whether it's because it's not reading the vector right, isn't reading the right vector, or has another problem, but that's almost certainly what's wrong with this. I don't know vector mathematics, though, so I could be wrong. My guess, though, is that it's always reading from the Y vector, and doesn't deal with the cones right, because it doesn't read from the center of the cones, or reads it as if the cone points straight up. Because when the unit is turned the right way, it engages correctly.
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Re: Limited fire-arc behaviour problem

Post by Warlord Zsinj »

Yeah, I thought you might've. At the moment our infantry require a hell of a lot of babysitting, or else they can die without firing a shot, which is shockingly frustrating for players.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Limited fire-arc behaviour problem

Post by KDR_11k »

My ships in THIS won't turn at all if they have secondary weapons that can shoot at the target, it's the reason I limited all turrets to forward firing on ships that have forward weapons.
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: Limited fire-arc behaviour problem

Post by yuritch »

WZ, take a look at turretless vehicles in S'44 svn (Marder has this for sure, and maybe StuG III). We have a script that makes them turn to face the enemy, it involves the use of

Code: Select all

set HEADING
This may work for your inf, too.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Limited fire-arc behaviour problem

Post by Argh »

set HEADING is not ideal, imo.

It flat-out changes the unit's heading, and it looks rough, if not done very slowly. Getting to KDR's point, though- wtf? I thought Weapon1 was always supposed to provide the heading the CAI turns the unit to... hmm, I guess I'll take a look at the code for this again, but meh, not for a few days.
User avatar
ILMTitan
Spring Developer
Posts: 410
Joined: 13 Nov 2004, 08:35

Re: Limited fire-arc behaviour problem

Post by ILMTitan »

Could I get a beta copy of IW so I can take another crack at fixing this engine side?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Limited fire-arc behaviour problem

Post by KDR_11k »

Argh wrote:It flat-out changes the unit's heading, and it looks rough, if not done very slowly.
Meh. Units don't turn any smoother than what you can do with set HEADING anyway. The pointer in KP turns perfecly fine.
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: Limited fire-arc behaviour problem

Post by yuritch »

Argh: you don't have to set HEADING right to the needed value at once. Do a loop and set it in small increments, the unit will look like it's turning on its own (Spring lacks a 'Turn this direction' interface button btw, OTA had little use for that, but newer mods would need it. LuaUI job?). As I said before, take a look at new S'44 Marder script, it has that (I'm not sure you have S'44 svn access though, ask on S'44 forums if you want to get it).
User avatar
ILMTitan
Spring Developer
Posts: 410
Joined: 13 Nov 2004, 08:35

Re: Limited fire-arc behaviour problem

Post by ILMTitan »

Revision 5996 wrote:Add a section of MobileCAI::IdleCheck() that checks for the targetUnit, and assigns an attack command on it. This should remove at least one case where a unit with restricted fire-arc weapons fails to turn to attack.
Test case used: Give enemy imp_i_stormtrooper. Give self rep_i_veterantrooper. Set trooper to hold fire and cloak. Move behind storm. Uncloak. Storm should turn and fire. Cloak. Move behind again. Uncloak. Prior to fix, storm will not turn and fire, but post fix it should.

Hopefully that is the only problematic case. If you still have problems, please let me know, preferably with specific units to use to test, or even a full test case.
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Re: Limited fire-arc behaviour problem

Post by Warlord Zsinj »

Thanks Titan, we really appreciate the effort.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Limited fire-arc behaviour problem

Post by Argh »

If it's committed, I'll test it when I get home...
User avatar
ILMTitan
Spring Developer
Posts: 410
Joined: 13 Nov 2004, 08:35

Re: Limited fire-arc behaviour problem

Post by ILMTitan »

If it wasn't committed, it wouldn't have a revision number
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Limited fire-arc behaviour problem

Post by Argh »

LOL, yes, well I got done driving a long way, then I did a bunch of stuff involving 90% humidity and trees, so I apparently lost the ability to read ;)

Home in air-conditioning now, thank goodness, and compiling.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Limited fire-arc behaviour problem

Post by Argh »

Tested with Rev. 6005.

No real change in behavior seen. Units did not turn to face enemy Units until attacked, then moved towards attackers. Roam behavior seemed to indicate that units were only leaving patrol paths to see enemies who came within the cone of the aiming arc.

I tested this with P.U.R.E., not IW, but meh, I wrote most of that stuff in IW over a year ago, and what I'm doing in P.U.R.E. is essentially the same. Whatever reaction is occuring, happens far too slowly to matter, at least in P.U.R.E., where by the time a unit starts changing direction, it's probably already dead. I'm sure the same happens in IW, with all of the troops. The reaction needs to happen as soon as stuff enters LOS, or it's not effective.
User avatar
ILMTitan
Spring Developer
Posts: 410
Joined: 13 Nov 2004, 08:35

Re: Limited fire-arc behaviour problem

Post by ILMTitan »

Could you tell me a specific unit in PURE to test with?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Limited fire-arc behaviour problem

Post by Argh »

Sure. Use Heavy Shells.

Testing routine's straightforward, just /give some to yourself, north of some you give to the enemy (to really watch the whole dynamic, put them far enough away they don't start in LOS).

Since, when you /give, units always face South, you can then march your units up behind the Heavy Shells, and see what happens next. When I just tested it, the Heavy Shells didn't even start turning, until well after the units behind them had gotten into range and attacked them. I think it's the weapon range that is causing this to happen, so this may be the real issue- maybe try increasing the range of the Heavy Shell's gun to the same length as LOS, see if it keeps happening?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Limited fire-arc behaviour problem

Post by KDR_11k »

Careful, spawned and never turned units can have weird reactions that units that were moved even once don't exhibit.
Post Reply

Return to “Engine”