Saturday, 15 October 2011

NTS Next To Shoot aka TAB targeting

[NTS] Left Upper button. Next To Shoot is the ubiquitous video game cycle through targets. Or TAB target if you play MMOs.

I've touched upon how radar works in this blog entry from August  - Radar - A Discussion

The Apache can automatically selecting priority targets based on some sort of criteria. This short blog post touches on how I've elected to do this. Again if you're familiar with the 1996 classic, Janes Longbow 2 there's nothing unfamiliar here.

The TSD (tactical situation display) collects data from visual cues (look at object), radar and TADS (again look at and store). A linked-list of 3D entities is stored and sorted by range. The list is re-sorted by what type of object it is.

Target object sorting as follows:

  • Fast Movers
  • Helicopters
  • Air Defence with Radar
  • Air Defence
  • Armour
  • Wheeled
Aircraft normally only show up in air targeting modes. The image above has one on the GTM Radar which is a BUG but that helicopter (another Apache) is on the ground.

Then these are sorted by range.

The [Cycle Target] key (default: TAB) steps through the list. This is different to the [Padlock Cycle] key (default: LCTRL F4) which applies to your head view and steps outward through visual targets sorted by range only. Sometimes the nearest isn't closest to the centre of view.

I'll touch on how I've programmed the game internally. A linked list of objects that are picked up in the FCR footprint are added to a TSDcontact list if the entity pointer (an entity is a vehicle) is not already present.

The game maintains separate lists from sensors and a Tactical(Situation Display) list which is used for referencing entities on the TSD. It also allows for messages received by the THelicopter message handler to add entities to the TSD when the player presses the 'ABCC download' button to download shared targets from a shared digital battlespace (fancy name for a simple array). To upload your TSD list you press the 'ABCC upload' function. I will think about expanding this to work on several channels in later versions.

Tactical Sensor Lists

The TSD used in our Apache vehicle is simply an instance of the TacticalSensor class which is used for all AI but the inputs are wired up differently.

These inputs are updated when in use, typically triggered by a player pushing keys. I've colour coded the inpus accoring to type. FCR is radar type area scan, high volume, Orange (HMD) is using the Mk1 eyeball, TADS in blue is an optical sensor (longer range eyeball) and Red is known data from external source, which you can imagine as a radio or some data modem.

As potentially there might be a hundred active AI vehicles in close proximity having all of these using all kinds of sensors, doing lots of volume searches and entity queries is woefully inefficient. Fortunately the natural hierarchical structure of unit can be simply used to make things much more efficient.

Since entities are grouped into Formations which share waypoints and mission targets, they share a common awareness. The same TacticalSensor class we use in our Apache. Only this time the inputs come from the different entities in the formation. Some will have an active sensor system, some are unable to supply input.

They periodically perform a sensor scan (interleaved to spread the load) to refresh their group TacticalSensor list.

Oh NO! The MIG! Target Priority

I'm sorting the linked list when updated based on criteria that I want based on experience from other games of this type. Worked for them, works for me.

In LB2 a Mig was triggered at random if flying over 250 ft. If not spotted quickly it was almost certain virtual death. To give these a high priority I added a Priority field to the SensorClass and arranged the icon IDs (1,2,3,4 etc) so by default the Priority value can be taken from the icon ID then modified later. Now the most dangerous entities can be simply sorted on this field but we could for example assign an entity as a "Primary Target" and add +10 to the Priority to have it automatically sit at the top of the TAB target list.

Very handy for scripting tutorials and the like. For example we can now spawn a virtual waypoint marker on a target range and command the avionics to give top priority.

So whatever the first entry on the linked list is, that's the NTS object, the second in the list would be the ANTS.


Another often asked about feature in Combat-Helo is the ability to create PFZs. Which is something that only applies to the Hellfire missile system which is coming in a later update as we've not yet implemented it. However our Tactical list makes this a trivial matter to implement. We have a static list of entities, mouse input on the TSD map and mouse driven events. Everything needed to add PFZs and NFZs.

Correct weapon symbology coming soon(tm)
Whole HMD needs a going over.


  1. I rolled my comment into an expanded post to make it easier to read.

  2. Thanks Rich... very informative...

  3. It's getting to be a reasonably fun blast. I'm worried about giving folks enough to do on the range.

    I was able to clear 3 ranges with 1200 rounds in about 10 mins doing a mad dash from one to the other, ran out of ammo so couldn't do the other 2, not without landing.

    Keep thinking about adding a "range officer" to talk you through the range and announce hits etc. A bit hokey but will elevate the experience. It would be nice to hear someone confirm a target kill as it zooms past, out of sight.

    Another idea we had was adding some static AI radar systems that give you 'vis'. To encourage wreckless NOE flight challenges, pop-up and snipe attacks.

    Dave was the one who suggested a simple text based user mission file players can edit. I'm looking into putting that together at the last minute.

    The trees are kind of pissing me off atm. There's a problem with collision in that there's no direct way to determine if you've made a collision with the terrain, or a tree. The engine is currently missing some index to make this determination. It will be needed to make the rotor clipping finally work.