Jump to content
  • Sign Up

How Next Enemy(TAB targeting) works?


len.7809

Recommended Posts

I vaguely remember reading something about this a while ago, where it was concluded the initial target is picked based on how close they are to the middle of your screen/viewpoint - in the same way autotarget highlights people.

 

Pretty sure it follows the same logic and code, meaning it will also prioritize closer targets and start cycling through enemies currently in your view based on proximity and position relative to the center of your screen. Since it always picks a target within range, there's a chance it just does so at random however after the initial pick.

 

But yeah try enabling autotargeting to see who it would lock onto if that helps, after that initial lock-on it most likely just makes an array of whoever are in your view (they are added as they enter) allowing you to cycle through all before it repeats. Like mentioned my theory is that it adds another filter moving players further up in that array the closer to you they are, but so far this is just speculation.

 

Edit: Actually autotarget specifically use range as an identificator so there is no reason TAB-targeting shouldn't. Then it's simply a matter of dividing your screen by a line in the middle, and the parameters for 5 targets become:

1. Who's closest to the dividing line (either left or right side).

2. Who's closest to you (this comes second based on what I remember from my autotarget days)

3. If it's not your first target, the client makes a list of people currently on your screen and will cycle through it in it's entirety unless they move beyond targeting range. People detargeting/leaving your screen will be removed from the list, but it always runs the current list through before targeting the initiator again.

Link to comment
Share on other sites

Edit 3: There definitely is a vertical component aswell, meaning there's a hypothetical horizontal x-axis to boot - but I think this difference is overridden by proximity when using TAB-target.

 

The only way I see it functioning with multiple enemies from a coding perspective is that they are

1. Added to the list upon entering your screen ("visible clients")

2. Upon first pressing TAB it uses proximity and position relative to the center of your screen, aka the action cam reticle (unlike the "Target Nearest Enemy", it requires you have them in view and you need to be aiming their way)

3. When taking the next target, it still uses relative position to center but disregards proximity

4. After you have been targeted once, you are ignored until every current client on the list (meaning stealthed/out of range/out of view ones are removed, new ones entering frame are added). What this means is basically as long as you are on the list (in view) and already targeted your position there is solidified. Once you drop target through stealth f.ex, you are removed from the list (meaning 2nd becomes 1st) and added last as you reappear. You are no longer solidified and will be targeted again before the original 2nd and now 1st person does.

5. It keeps running through the list (when you TAB until all positions are solidified, then it will loop. Note however as it loops positions stay solidified unless changes are made (you can see this if you have a group of people standing still, and you cycle through them in the same pattern over and over)

 

Come to think of it, I believe the PvE aggro system functions using these same arrays as it makes sense if you've ever tried to detarget a boss, or take an action to change aggro parameters (ressing or adding toughness). After all the game is all about clients v other clients, so there is always a simplest solution to these functions - even better ones that can be repurposed and used again. This would explain why they don't really have the option to change TAB-targeting behaviour, since the AI (read "mobs") depend on it aswell.

 

Having this data already in the engine is probably what allowed the creation of action-cam, it just added a UI on top of the already existing system (x and y axis, origo at center of screen) for easier access to relevant info, as more precision was needed in first person view in order to avoid guesswork when aiming.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...