Jump to content

Formation-Keeping


TonyE

Recommended Posts

2017.012 and newer obviously have serious issues with formation-keeping. I'm finally getting a better picture of what is happening code-wise.

 

In these builds I've tightened up how often various functons check and change paths (path following, station-keeping, close to attack, etc. That exposed the lack of a formal state machine telling units when to turn, when not to turn, etc. Now they just sit and fight each other. Ships trying to close to attack other ships have their intercept course set each second and over-ridden every 60 seconds when they try to follow their plotted path. It goes on and on like that. This is all without even broaching the topic of staying in your formation zone.

 

I'd like to explore what these state machines might look like, comments appreciated.

Link to comment
Share on other sites

Formation Zones for surface and submarine units (air are treated by loadout/patrol type)

  • 0 - Main Body
    • Maintain position relative to group center
  • 1 - AAW Ring
    • Maintain position in assigned sector(s)
    • There is no value in assigning units to multiple sectors in the AAW ring
  • 2 - ASW Ring
    • Sprint and drift around the assigned sector(s)
  • 3 - Picket Ring #1
    • Meander around the assigned sector(s)
  • 4 - Picket Ring #2
    • Meander around the assigned sector(s)
  • 5 - Picket Ring #3
    • Meander around the assigned sector(s)
What to do when a unit is assigned to multiple rings (i.e. a sector in ASW and a sector in Picket #1)? The behavior of the inner-most ring in the selection will define the behavior. ASW + Picket #1 selected will result in Sprint & Drift.I think any cross-ring assignment should be treated as a picket, meandering around the combination of sectors.

 

Currently formation-keeping will not change the heading of a unit. This needs to change.

 

See also http://harpgamer.com/harpforum/index.php?/topic/3426-tactics-101-naval-formations-part-1/

Edited by TonyE
input from CV32
  • Thanks 1
Link to comment
Share on other sites

Surface & Submarine navigation

 

Things that Groups do...

  • Follow a plotted course
  • Ignore a plotted course to...
    • Evade a threat
    • Intercept a target
    • Localize a target
  • Slow down to allow formation-keeping
  • Speed up to plotted speed
Link to comment
Share on other sites

Formations and formation keeping is a critical foundation of HCE. It is one of the reasons I tackled the subject matter in Tactics 101.

What to do when a unit is assigned to multiple rings (i.e. a sector in ASW and a sector in Picket #1)? I think any cross-ring assignment should be treated as a picket, meandering around the combination of sectors.


I am fine with this approach.

 

That said, one alternative would be to have the outermost portions of multiple rings conform to the role/purpose of the innermost rings.

 

For example:

 

A unit assigned both a sector in the ASW ring and a sector in Picket #1 would perform as though it were in an ASW ring.

A unit assigned both a sector in the AAW ring and the ASW wing would perform as though it were in an AAW ring.

And so on.

Link to comment
Share on other sites

Formations and formation keeping is a critical foundation of HCE. It is one of the reasons I tackled the subject matter in Tactics 101.

 

What to do when a unit is assigned to multiple rings (i.e. a sector in ASW and a sector in Picket #1)? I think any cross-ring assignment should be treated as a picket, meandering around the combination of sectors.

I am fine with this approach.

 

That said, one alternative would be to have the outermost portions of multiple rings conform to the role/purpose of the innermost rings.

 

For example:

 

A unit assigned both a sector in the ASW ring and a sector in Picket #1 would perform as though it were in an ASW ring.

A unit assigned both a sector in the AAW ring and the ASW wing would perform as though it were in an AAW ring.

And so on.

 

Thank you for the suggestion, I'm happy to switch to that approach as it brings more flexibility to the situation and extends the unique behaviors of the inner rings.

Link to comment
Share on other sites

What was the last version where formation keeping, intercepts, and such worked generally correctly? I'm pondering going back to that codebase and porting in as many later fixes as possible.

 

Enrique's test scenario in http://harpgamer.com/harpforum/index.php?/tracker/issue-204-red-subs-and-ships-not-change-speed-or-course-after-foe-detection/is a good first place to start to see if the AI will intercept the player.

  • Like 1
Link to comment
Share on other sites

This does not change my interest in making formations even better than they were before but I have a semi-realistic perspective that it'll be a long time before that vision can be implemented.

Link to comment
Share on other sites

  • 3 weeks later...

and I thought I was getting a sore head.

I like the approach of multi ring patrols behaving as per the inner most ring of its assignment.

perhaps surface vessel should also vary from course to avoid shallowing water?

Interestingly enough, when Bret was working on altitude/depth-based path-finding using global elevation and bathymetry maps he was also tinkering with squishing formations to get thru choke points. The use-case was always the Strait of Hormuz. His pathfinding code works quite well, a shame I haven't made it something the game can use (it is a series of separate experimental programs).

 

A little napkin state machine:

If no part of group will ground, continue on course.

If main body of group will ground, divert group course. I use divert since there is a handy fDivert flag in the game engine code.

If main body will not ground but units in other rings will, squish the formation as needed.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Started writing a formation-keeping ExportDLL. I'll be writing utility functions for a while (where am I supposed to be? where am I? Where is the center of my formation sector(s)?, ...) but just wanted to pop in and say there is thought and even some tap tap tapping on the keys occurring.

Link to comment
Share on other sites

  • 1 month later...

Fun little algorithm puzzle for you if you need some Friday fun...

 

So I'm trying to find where the formation arc for a particular unit starts and stops. What would your algorithm look like?

 

What we know... We know each sector and each ring that was selected in the formation editor.

Examples:

1) 000-045 degree sector, AAW ring.

2) 000-045 degree sector, 315-360 degree sector, ASW ring.

 

Expected output:

1) 000-045 degrees

2) 315-045 degrees

 

Hint: Looking for gaps in sectors is important to determine the start and end sectors.

  • Like 1
Link to comment
Share on other sites

hmm,I think I'd go in two parts: 1/ set max (clckwise limit), start at 000-045 sect and step thru each sector clockwise, if the sector is used set (reset) the max limit to the clockwise boundary for that sector; 2/ then set min (counterclock limit) by starting with the 315-360 sctor and going counter clockwise, if the sector is used set (or reset) the counterclock boundary to the sectors min boundary.However I suspect that once that was put into code it would be a bit cumbersome and I'd think of something else :wacko:

Nope, that'sno good :blink:

Link to comment
Share on other sites

Don, I think there might be a couple of gaps in your approach but it is close to mine (not yet coded, just mocked up in Excel. The shortcoming that pops up is that the max could be 045-090 if the min is > 135.

 

Find Start

1. Go clockwise from 0

2. Where previous sector is unselected and current sector is selected, start is found

 

Find End

1. Go counter-clockwise from 0

2. Where previous sector is unselected and current sector is selected, end is found

 

Gap (whole ring is selected)...

1. If start not found (i.e. all sectors selected), Start = 000, End = 360

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...