Fixing "Dogfight" to fix strikecraft behavior

I’m not going to talk much about sphere, wall, and defensive.
Thing is, those all mostly work right in HW2. You can make scouts that stay in a sphere, stay in that formation as you move them around, and they point their gun around to shoot stuff that comes in range.
The only problem with it is that those are behaviors that are set at match load and there is no way to change them when the formation and/or tactics(stance) changes.

The bigger problem is that you can’t correctly emulate aggressive behavior with claw/line/delta/x/etc. And here’s why:

HW2 has an “AttackStyle” called “Dogfight” in the engine. It’s just virtually unused. Its not used in any of the higg/vaygr MP units.
It’s not used, probably for two reasons:
AttackRun, the style most SC use, is actually really consistent and predictable. Put 5 squads of interceptors vs each other 10 times and you get similar outcomes each time.
Dogfight, is freaking broken.

I played around with Dogfight a lot TRYING to get it to work more like HW1, because the thing is that it’s the most realistic and sensical one.
The problem with “AttackRun” is even removing out tons of randomness, things still want to spread out all over the place. Multiple squads and units eventually stop working together. They break from the flock.
With Dogfight, though, they seem to keep a flock well and rejoin the flock, even though they get out of formation position. Like some ships will slow down and speed up similar to when you give movement orders to join the rest. It makes me think it would be easier to get them to stay closer to formation positions with this if I had the source. You know, just speculating on how things are written and how easy getting things to work right would be, here.

I decided to revisit it and play with the stats some more and see what can be done with modding, and record a video to show the problem(s). @scole was considering changing some ships to dogfight earlier and I pointed out some issues that’d arise.

AttackStyleName = DogFight
Data = 
    -- when approaching the target use this method to split the formation and transition in to the attack style
    howToBreakFormation = StraightAndScatter,
    -- Ships will try to go no slower than this fraction of their max speed in a dogfight
    minSpeedFraction        = 1.0,
    -- done every sim frame
    RandomActions = {},
    BeingAttackedActions =  {},
    FiringActions = {},

So usually the “actions” lists would include some things like jinking, looping, changing targets.
I removed all those because that randomness basically is them disobeying orders. That wasn’t something in HW1.
Now for “Evasive”, yeah it’d be nice to have random actions that make them juke and tumble around. But I was trying to get aggressive behavior working.

One of the big things here was “minSpeedFraction”
In other things using dogfight style, this is never 1.0.
This really creates problems when it’s set any lower. What happens is that one ship will slow down to stay on a slower ships tail. This creates problems because against another dogfight behavior ship, they just turning war on each other and the one on the tail can’t get its weapon on the other. Or, if it can shoot, it auto-wins the fight because it’s on their tail. Both are bad.
With it set to 1.0, they get forced to break off, which fixes many issues.

The other, is that I modified ship stats roughly like so

Kus Interceptor
NewShipType.thrusterMaxSpeed=325*0.77 --was 310*0.77
NewShipType.mainEngineMaxSpeed=325 --was 310
NewShipType.thrusterAccelTime=2 --was 2.3
NewShipType.thrusterBrakeTime=2 -- was 1.1
NewShipType.mainEngineAccelTime=2 --was 2.3
NewShipType.mainEngineBrakeTime=4 --was 1.1
NewShipType.rotationAccelTime=0.75 --was 0.6
NewShipType.rotationBrakeTime=0.75 --was 0.33
NewShipType.thrusterUsage=0.35 --was 0.25
NewShipType.accelerationAngle=175 --no idea what this does
NewShipType.mirrorAngle=30 --no idea what this does
NewShipType.secondaryTurnAngle=90 --no idea what this does

So a lot of what was going on wrong here even if you used a DogFight style with 1.0 minSpeed is that they still seemed to turn on a dime which would still get ships stuck on one anothers’ tail a lot.

The big thing here is brake times being too short. Making the main engine brake time quite slow makes them overshoot and fly backwards. It takes man times longer to break than the turn around, so you get those cool flying backwards things going on.

Another was the thruster usage. It seems higher thruster usage helps them get guns on target better with dogfighting. I didn’t want to make fighters have 1.0 thruster usage though, but maybe they should.

Now this is what it looks like:

There’s two key things I forgot to point out in overlaying text on the video:
If you select some ships and give them an attack order with this DogFight attack style, they seem to be good about grouping themselves up.
They do split up after passing over a target they’re attacking, but that happened in HW1 as well(albeit in a more predictable spline like manner…). Like the part where a big x crosses into some interceptors than fans out behind them, criss crossing to either side, is fairly cool.

The other thing is that this both makes microing ships far more effective, but it also introduces a lot more randomness to the outcomes since groups of ships can randomly get locked into patterns where they never attack.

Now, to point out more of the problems and what needs changed/added to make this really work(because currently, just giving all the strikecraft ships that attack type will create more issues than fixes I think).
I mentioned some in the sticky, but now that I’ve played with it more and have a better understanding and have thought about it more, it bares going over again:

They have WAY too much of a one track mind of keeping the gun on target and just end up doing a bad job of that.
Once they pass a target, they’re just immediately trying to spin around to attack again.
Perhaps some sort of check that their target ship isn’t in the 180 degree hemisphere ahead of them anymore and to have a variable for how long they’ll keep flying straight after a ship is no longer in that hemisphere before they try to put gun on target again? That way after intersecting head on, they’ll keep going a little before turning back around. This will create jousts depending on the arguments given.

The other problem is when ships go into each other, then just by chance they decide to both turn the same way on the same axis.
Then they wind up in far away turning wars where they can’t get their gun on the target on one another. And they just… don’t give up and break off or try something else.
There should be some sort of argument where if dogfighting ships are within some distance of a target, yet have been unable to shoot for a given duration, that they can be ordered to do something else like reverse their turning direction, or to do a half loop.

Then there’s the lack of functionality and arguments to support “Evasive” tactics. You can’t make dogfight ships protect one another. There should be a way to have the closest ship in a group to one that is being attacked change its target to the one shooting its ally.
There are “RandomActions” and “FiringActions” etc but these things are useless here. Especially since the “ChangeTarget” function/flag just makes them change to a random target and not the one attacking their ally.

Not sure how to really close this out. But there you go.

Oh, and about the light corvs thing, I was working on giving them more HW1 like stats than I currently had, balancing them around a 2.7s attack interval. So I gave them 50% more accuracy and damage. Well somehow this 50% increase of damage and accuracy while making their attack speed almost 3x slower(so really it’s a DPS decrease on paper) made them like 3x stronger.
Accuracy just seems to get calculated in a really really screwy way. 40% accuracy vs fighters seems to make something like 4 or 5x more accurate against fighters than 27% does.


Very cool work! The video helped show what you were talking about. I look forward to see if the engine can be upgraded to include some of those options you describe.

1 Like

so you’ve basically said this is exploitable, if i read that correctly?

As in exploitable by players in a negative way, or as in exploitable by the devs to help create better unit behavior?

as in, you can basically write custom ai scripts and use them in pvp. or maybe the interaction doesn’t go that far.

Er, I don’t think he was saying that at all. He’s finding ways to edit unit behaviour. Not scam wins in multiplayer.

i’m not implying anything as per his intentions, only the content of his message.

although, that might not be possible with the level of control you have over the .lua (i havent looked at it, so just threw this hypothetical up there)…

this is simply possible with many games that use a lua api… i won’t mention which, but recently there was one with a legit wallhack due to the fact that the entities collections and all unit positions were accessible from within lua, so it could display various hud info above players ;p

game mechanics should simply not be accessible from lua. or not to such an extent, as could confer an advantage.

ie: if the server sends all unit position info and sensors are done on client, it might even be possible for a quick ‘no-sensors’ hack… so youd better hope thats not done on client hehe (maybe one day i will look at the lua, i dunno, honestly im tired…) ;o

No… you’d get an incompatible mod error.

I’m pretty sure even if you could do it by a “hack” instead of mod, you’d get an out-of-sync error because the other player has a different unit behavior for your units and just by merit of how typical RTS netcode works. Unit positions aren’t sent; perfectly replicatable commands in lock-step are.

Please don’t derail the discussion any further.


Bump, this is actually pretty cool. Did you have both the Hig and the Kus with this dog fight behavior?

These are flight patters already in the engine as well right? and the dogfight pattern is the one @scole is proposing for multi guns when engaging one of the groups? (forgot if it was vettes or fighters)

As per the text at the top, at the very start Hiig Interceptors had AttackRun behavior, and after that they were DogFight behavior when the text comes up saying they are.

He has it on Multigun which works okayish(same as I have it in my mod). He also had them on scouts and in that thread I pointed out issues and buggy behavior it creates and that that would need to be removed, which he did.

Here I was testing it further to see if I could fix some of those issues and/or better point out the problems I mentioned in that other thread to scole as to why it generally can’t be used in its current state.
This is basically the best I can get them to behave (with those deadlocking issues and increased randomness, namely) without engine changes. Modding is very limited.

It seems this behavior may have been there in the start of making the engine but then Relic never used it or finished it. “AttackRun” makes for much more consistent behavior and makes balancing easier. “Dogfight” has issues that need to be fixed like I pointed out.
But the behavior is similar to HW1s, just with those issues that need resolved. It also fixes a lot of the issues HW1 units had like in large claw formations and such, so it’s not all bad at all.

Further slowed breaking speed and increased turning speed will reduce the deadlocking/turnlocking, but that makes its own weird behaviors that are further from HW1.

Dave and I talked today about this today (not the nitty-gritty details but giving AttackStyles a going over) and making Dogfight viable seems feasible if we need it.

Support Frigates are using Frontal for the healing turret. Somebody here suggested Frontal for the Turanic Mothership and the Kadeshi Mothership but I haven’t had time to implement this to see how it affects the game. I know that the Support Frigate shipped with “MovetoTargetandShoot” and I’m guessing that has a lot to do with them running out in front of everything but haven’t changed that yet either.

The latter I’m thinking because it is dated 07/29/02 in the code comments, making it one of the newest ones. Just a trivia FYI. This has been the AttackStyle news of the day.


I would suggest basically subclassing off the current ones and not actually replacing them. Which is probably what you meant. That way the HW2 Campaign or even HW2 Deathmatch can keep their “AttackRun” behavior.
Call it “DogfightRun” or something.
Part of the change probably needs to be done to the “Scatter” part of “StraightAndScatter”. I’m not sure if AttackRun accepts arguments for that “scatter” part in its break angles, or if that’s something hard coded into it, but it seems Dogfight has no way to change the angles they break off at, if any. Or that they even use the whole “Scatter” thing and it’s not just a consequence of what happens when they overshoot.
I couldn’t find a lot of information on “AttackStyles” and what definitions each one takes.

I probably forgot to note that it’s going to create the need for balance changes. HW1 style of attacking gets many more shots off so these furballs end quicker. (Hiig Interceptor guns were the default HWRM stats)

I think this is favorable though, because you can make something that is an improvement over both in the end. It’s not a "compromise’, it’s just better.

Heh, so more earlier on internally they had this AttackRun thing, then they thought “Well this isn’t that great and has problems” and tried to make it more like HW1 which had its own problems then gave up since they had a game to ship? :relaxed:

1 Like

I understand the concerns for gameplay when putting this on fighters. Fighter combat is doing fine as is though.

This could potentially fix HW1 corvettes.

Yea but it looks sooooo damn good! The way those fighters were moving may be the best representation of zero G fighter dog fighting I’ve ever seen Hollywood or otherwise. Whoever from relic who originally designed that must still be heartbroken that it didn’t make it into the game. That looked WAY better than HW2 or HW1 fighters did.


That was me. The biggest thing it does is fix a bug in mission 4 when the turanic carrier should but doesn’t attack the mothership after the ion arrays are neutralized, but it also fixes a couple of issues where Kadeshi motherships were trying to attack but couldn’t do so.


I think there is a lot of issues with the current system of fighters that a lot of casual players don’t actually notice but would appreciate when they got to use them for themselves. (Assuming some of these issues were fixed, of course)

It gives you a lot more control over your fighters, like you had in HW1. Micro does A LOT more.

There is a lot of behavior with “AttackRun” that strike craft generally use vs other strike craft that feels unresponsive, buggy, etc. This is because when you order them to attack, they won’t actually turn and attack unless they’re past a certain range due to these distances they’re told to break off at and such.

I guess I left it out in those videos because the issues that happen all happen when you don’t mess with them, but they’re very responsive to when you change attack orders and such and such this way.

It is very hard to stay up to date on all the topics in this forum. There is SO MUCH to read EVERY DAY.

So, I want to ask a simple question. Does the prognosis for strikecraft behavior look positive?

Eh it’s really worth reading, even though it’s long. It’d help a lot of others toward understanding this stuff.

I know I could make it work. I would think GBX would be able to. It’s just mostly about making the right decisions and priorities.

It’s a lot more positive than I first though because of the way “Dogfight” naturally reflocks fighters, which AttackRun does not do. That’s a somewhat difficult thing that’s already working. The main issue is simply how overly focused they are on trying to keep gun on a target, which leads to dead locking and such. They simply need some behavior that makes them overshoot a bit before they loop back around for the most part. Though something that detects and breaks off from that turn deadlocking would also be helpful.

so basically, it’s exploitable (simply by bypassing steam mod verification). thanks for confirmation.

also, as per the quote, that’s not how they work. they send events with properties. if those properties match, ie: if dogfight/attackrun are valid properties for an assault craft squadron, then it will work just fine.

anyways, just another day in the neighbourhood.

peace out.

mr. rogers.

i feel all hope is lost. this is a mod on top of a patch, on top of a port.

I have to say: WOW! The dogfight style looks REALLY cool! It always annoyed me how even in HW1, fighters still seemed to think that they were flying in atmosphere, and this style fixes that issue. I really like how they actually look like they are fighting for their lives to hit one another, rather than just flying around following set paths. I would LOVE to see this implemented in HW1 campaign, but I honestly think that it could definitively work in multiplayer as well if all races had it. That is, with some of the necessary tweaks you mentioned regarding deadlocking. But overall, good find, Innociv! Can’t wait to see where this goes.

1 Like