Jump to content
The Dark Mod Forums

Flee Points


grayman

Recommended Posts

I'm working on a problem involving flee points (AI doesn't flee when you bump into him).

 

I've fixed the problem, but in the process I've learned a few things about flee points that bear discussion.

 

The wiki page says that when an AI wants to flee, he'll follow these steps:

 

1 - If there's a guarded and friendly ('team' spawnarg is friendly to the AI) flee point, run there

 

2 - If not, if there's a friendly flee point, run there.

 

3 - If not, pick a spot that's far away and run there.

 

The code follows these steps.

 

I put a single unguarded flee point in my test map, and didn't set the 'team' spawnarg (let's call this 'indifferent'). When there's only one flee point in a map, this works fine, because the code doesn't check for friendliness or whether it's guarded.

 

When I used two unguarded and indifferent flee points, the AI ignored them both because neither satisfied step 1 or step 2 above. The AI used step 3.

 

I checked the published maps. Here are a few examples of flee point use:

 

Alchemist uses 13 flee points like the ones I tested with, which leads me to believe that none of them would ever be used.

 

Ditto for Betrayal (11 flee points).

 

Business v3 has 3 guarded flee points, but none have a 'team' spawnarg, so they're indifferent. This means AI would fail to use them.

 

Since we don't want to update released missions, and we want these flee points to be used as the authors thought they would be used (even though the wiki page said otherwise), I propose changing the steps to be the following:

 

1 - If there's a guarded and friendly ('team' spawnarg is friendly to the AI) flee point, run there

 

2 - If not, if there's a guarded and indifferent flee point, run there

 

3 - If not, if there's a friendly flee point, run there.

 

4 - If not, if there's an indifferent flee point, run there.

 

5 - If not, pick a spot in a galaxy far far away and run there.

 

This should let the non-working flee points start working w/o updating maps.

 

Does anyone have a problem with this?

 

(Does anyone think the flee points work in the examples I cited? If so, I'll test them explicitly to see what I got wrong.)

 

Thanks.

  • Like 3
Link to comment
Share on other sites

That sounds fine to me, as long as #2 doesn't result in AI running towards a flee point with enemy guards that will proceed to kill him.

Link to comment
Share on other sites

So to get this straight, the way it works right now is as described by the wiki: the description is correct. But (1) it doesn't seem quite right that flee points work only with a matching team spawnarg, and (2) it's clear that the authors of the maps you checked expected a different behaviour: that flee points would work without a team spawnarg.

 

I like your proposed solution. It'll be impossible to completely rule out oddities happening as a result because we can't parse map files to find out who is guarding a flee point, but the one time a mapper would certainly pay attention to the team spawnargs is when they have enemy factions in a map and separate flee points for each faction. So I'd say the risk is minimal.

 

How about switching the order of new rules (2) and (3)? That way, if a mapper has deliberately set team spawnargs, then they'll always take precedence.

Link to comment
Share on other sites

That sounds fine to me, as long as #2 doesn't result in AI running towards a flee point with enemy guards that will proceed to kill him.

 

The only way I can see to prevent this is to have the flee code check the teams of armed AI in the neighborhood of the guarded flee point. If they're on the same team as the fleeing AI, let it happen. If not, skip that flee point.

 

This is probably a good thing to do for all flee points.

 

And for selecting a "far away" point when no flee points will satisfy. No use in throwing the fleeing AI to the wolves.

Link to comment
Share on other sites

If they're on the same team as the fleeing AI, let it happen. If not, skip that flee point.

 

I don't think it has to be that strict...friendly/neutral teams should be fine, just skip if there are enemy teams in the vicinity.

Link to comment
Share on other sites

The only way I can see to prevent this is to have the flee code check the teams of armed AI in the neighborhood of the guarded flee point. If they're on the same team as the fleeing AI, let it happen. If not, skip that flee point.

I don't think it has to be that strict...friendly/neutral teams should be fine, just skip if there are enemy teams in the vicinity.

 

That sounds a very cool extension to current AI behaviour. Would it make the "team" spawnarg redundant? (not necessarily a bad thing of course)

Link to comment
Share on other sites

  • 5 years later...

@grayman Just trying to understand the "new" flee point rules, before I make some fancy flee handling. Evidently not updated in the wiki; I can do that update as follows, if you can clarify 2 things (see Questions):

Defining some terms:

  • ·         A “guarded” flee point is one with spawn_arg “is_guarded 1”.

  • ·         An “indifferent” flee point is one without spawnarg “team” specified.

  • ·         A “friendly” flee point is one with “team” spawn_arg set to the same team as the fleeing AI.

Here is what the AI tries to do (as of TDM 2.03):

  1 - If there's a guarded and friendly flee point, run there

  2 - If not, if there's a friendly flee point, run there.

  3 - If not, if there's a guarded and indifferent flee point, run there

  4 - If not, if there's an indifferent flee point, run there.

  5 - If not, pick a spot far away and run there.

Questions:

In steps 1-4, if there are multiple candidate flee points for that step, the previous code would reportedly choose the nearest one. Is that still true?

In steps 1-4, once the AI has run to the flee point, if the enemy is still visible, the previous code would reportedly resume the search from step 1, but look for the farthest flee point in each case. Is that still true (assuming it was ever true)?

Link to comment
Share on other sites

Perhaps this is more accurate?

Defining some terms:

  • ·         A “guarded” flee point is one with spawn_arg “is_guarded 1”.
  • ·         An “indifferent” flee point is one without spawnarg “team” specified, or the team specified is "neutral" to the fleeing AI's team (see [[Teams]])
  • ·         A “friendly” flee point is one with “team” spawn_arg set to either the same team as the fleeing AI, or one that is "friendly" (see [[Teams]])
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • nbohr1more

      Was checking out old translation packs and decided to fire up TDM 1.07. Rightful Property with sub-20 FPS areas yay! ( same areas run at 180FPS with cranked eye candy on 2.12 )
      · 2 replies
    • taffernicus

      i am so euphoric to see new FMs keep coming out and I am keen to try it out in my leisure time, then suddenly my PC is spouting a couple of S.M.A.R.T errors...
      tbf i cannot afford myself to miss my network emulator image file&progress, important ebooks, hyper-v checkpoint & hyper-v export and the precious thief & TDM gamesaves. Don't fall yourself into & lay your hands on crappy SSD
       
      · 3 replies
    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 7 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
×
×
  • Create New...