[Guide] Flee Behaviors Explained

This forum is the ideal place for all discussion relating to X4. You will also find additional information from developers here.

Moderator: Moderators for English X Forum

Post Reply
Rezoken
Posts: 13
Joined: Sat, 6. Feb 16, 09:54
x4

[Guide] Flee Behaviors Explained

Post by Rezoken » Wed, 13. May 20, 19:24

Hi everyone,

So I got kind of sick of not understanding the flee behavior and the available options in the Flee Command (in your behavior tab) and not understand why it did it what it did at times. Here is what I uncovered, please add your feedback if you have any other ideas or found differeing behaviors.

Flee Methods

1 - Highway
2 - Dock
3 - Boost
4 - Maneuver
5 - ? (Same as Highway)


Flee Basic Behavior
  • Ships will attempt to flee a maximum of 20km away
  • Ships will only boost for a maximum of 30 seconds
  • If Ships have Laser Towers then they will deploy them as they are fleeing as long as you are not on a highway.
  • If Ships have some wares then there is a chance it will drop it based on Morale and your Flee Method is not set to 4 (Maneuver)
  • If hold fire is set all it does is set weapon modes to hold fire.
  • Flee behavior has some logic to check how FAR a ship must flee before the attacker can no longer see it.
  • Fleeing will grant pilot XP if they successfully escape, the amount of XP depends on the difficulty of the engagement (ship hull and damage per second are factors)
  • Fleeing with the flee methods will follow a set flow: Order is 1 (Highway), 2 (Dock), 3 (Boost), 4 (Maneuver)
  • If after that order is complete the attacker is still in range then it will start the flee attempt again starting at 1 (Highway) regardless of setting.
  • If after 3 re-attempts at fleeing it will give upo and wait between 3-10 seconds before attempting to flee again. (this is why we may see ships getting stuck in the Flee then attack logic)
  • Setting your Flee option to a different value changes the starting point of the order. Setting Flee option to "3" means it will not attempt to dock and/or use highways if possible. "5" is the same as "1" as far as I can tell.
  • After successful flee it will re-arm weapons.

1 - Flee Highway Behavior
  • If Ship Type is L or XL then it will exit this method immediately and go to next method (Dock).
  • If a Highway is within Radar Range of the Ship then it will target it and attempt to use it. It will attempt to boost for a maximum of 30 seconds towards that Highway.
  • I am unsure what it considers a Highway at this point. Might be Highway Ring, Super Highway or might be Sector Jump Gates or might be all? But since L and XL ships are excluded I assume it is just referring to the Highways you can hop on and off at any time. If you have the mod remove super highways turned on then this flee method does next to nothing?

2 - Flee Dock Behavior
  • If Ship Type is L or XL then it will exit this method immediately and go to next method (Boost).
  • If the ship is already docked then it will check if it is safe by ensuring the attacker is greater than 15 KM away. If the attacker is more than 15 KM away then resume behavior. If less than 15 KM it will wait for 1-2 minutes, after which will recheck. If rechecked 3 times then it will just risk it and resume behavior.
  • The ship will check for any stations in the zone that are neautral or higher relation and choose the closest one. If no stations then will go to next method (Boost).
  • If a ship has subordinates it will attempt to recall them (indefinitely....) before attempting to dock.
  • Ship will attempt to dock, and if docking fails (no docking ports, they are all full etc) it will method to next method (Boost).
  • If able to dock, then it will boost towards the assigned dock, if it takes longer than 10 minutes to get to the dock it will then attempt default behavior I believe?
  • If the attacker dies during this time, it will cancel docking request and resume default behavior.
Major issue here! It only considers Stations for docking. It does not consider L or XL player ships that have a dock capable to hold your ship.
3 - Flee Boost Behavior
  • Will boost only a maximum of 20km and a maximum of 30 seconds.
  • If the ship does not have any shields and can't boost then it will go to next method (Maneuver)
  • If there are no L, XL or Stations in its flight path (25 degrees in a cone in front of it then it will boost in a straight line in the opposite direction of the enemy). Note that if the enemy is on the outskirts of the fight then there is a high chance that your ships will attempt to boost in the opposite direction straight into the middle of the main group of enemies.
  • It will attempt to fly away 20km.
Important!! If the shields are less than 50% it will NOT boost at all. Greater than 50% it will boost. If you want your ships to flee then make sure you initiate before 50% shield dmg.

4 - Flee Maneuver Behavior
  • If Ship Type is L or XL then it will exit this method immediately and attempt to go back to Boost after 3 attempts it will just move slowly and do nothing... kind of pointless of L and XL ships haha. Best option for all L and XL ships is definitely stack with Laser Towers, and escorts.
  • This will just perform random movements for a period of time, going in random directions. Not very helpful if the ships do not have any additional supplies such as Laser Towers.

aurelcourt
Posts: 132
Joined: Fri, 20. Oct 17, 09:20
x4

Re: [Guide] Flee Behaviors Explained

Post by aurelcourt » Wed, 13. May 20, 22:32

Whoa awesome explanations!

Can we have that kind of guide in the wiki for all behaviours and commands ?? 😀😀😀


Rezoken
Posts: 13
Joined: Sat, 6. Feb 16, 09:54
x4

Re: [Guide] Flee Behaviors Explained

Post by Rezoken » Wed, 13. May 20, 23:19

aurelcourt wrote:
Wed, 13. May 20, 22:32
Can we have that kind of guide in the wiki for all behaviours and commands ?? 😀😀😀
If someone has edit abilities for the Wiki and the Developers can confirm that my understand is correct, then they can put it up.

Also, since this is probably a moving target (with patches and also the ability to be modified via Mods) it might be a bit hard to keep it up todate.

The main one for me that needs to be fixed as soon as possible is the Flee using Dock command. That would be AMAZING if using Flee with option 3 causes your fighters to run into your Carrier with their tail between their legs. I plan to mod it as soon as I can... but just finding the time between work, family and getting the small amount of play time in makes me less inclined, and I know we have some very smart cookies out there in the modding world that can do it better and quicker than me.

Rezoken
Posts: 13
Joined: Sat, 6. Feb 16, 09:54
x4

Re: [Guide] Flee Behaviors Explained

Post by Rezoken » Wed, 13. May 20, 23:23

A couple of small tweeks I would like to make, either Devs to include in base game, or a modder.
  • The Flee Dock mechanic should check for both stations and friendly L and XL ships with Docks and sort by distance
  • Add the ability to override the 50% boost mechanic, this is because a Carrier or Destroyer at 50% shield is still as HELL of a lot shield, and my destroyers can boost away at 1500 m/s with mods

easternsun
Posts: 166
Joined: Fri, 15. Nov 19, 23:17

Re: [Guide] Flee Behaviors Explained

Post by easternsun » Wed, 13. May 20, 23:56

Interesting finding. In my game all i ever see from ships when they flee is to fly to the edges of the galaxy forever. I'll start loading them with laser towers and mines now that I know they will use them.

User avatar
Nort The Fragrent
Posts: 623
Joined: Fri, 5. Jan 18, 22:00
x4

Re: [Guide] Flee Behaviors Explained

Post by Nort The Fragrent » Thu, 14. May 20, 03:08

I have got it all wrong !

I thought it meant my ship has Flea’s

And needs to quarantine out in deep space till the infestation has subsided.




Goodness knows what es mean by flee.
my ships just hang around waiting to get deaded.
Even though they have the flee command as default.

chip56
Posts: 132
Joined: Mon, 13. Apr 20, 21:52

Re: [Guide] Flee Behaviors Explained

Post by chip56 » Thu, 14. May 20, 08:12

I think this shows beautifully why i was cursing so often about the flee function when i build my first 2 destroyers to stop xenon invasions.
There is no logic to use a jump gate at all.

I had mine defending a jump gate (not the one to the xenon sector, but the one to the next friendly sector) and when i gave them an order to flee through the jump gate cause an I or multiple K attacked:
The flee command overwrote the "move to the other sector" command. End result: my destroyers moved away from the gate and got themselves killed even though they were pretty much sitting on the gate and could have simply moved through it and then safely active their travel drive to get far enough away

leoriq
Posts: 196
Joined: Wed, 20. Mar 13, 07:42
x3ap

Re: [Guide] Flee Behaviors Explained

Post by leoriq » Thu, 14. May 20, 08:20

Behavior 5 is for moving into neighboring sectors.
Behavior 1 works only in current sector.

Andrey12y
Posts: 69
Joined: Mon, 7. May 18, 21:06
x4

Re: [Guide] Flee Behaviors Explained

Post by Andrey12y » Thu, 14. May 20, 14:02

@Rezoken
Interesting information, thanks.

Just wondering where there is check for at least 30-40% recharged shield before set to previous command.
I saw my ships flees and then immediately jump to fight again and die because no shields. No much point of such flee maneuver.

Can you also extract info about Morale skill earning from fight and trade activities?
Like if my pilot bought spaceweed for 200 cr and sold it on black market with crazy margin - did it make him happy, more motivated and more experienced?

Rezoken
Posts: 13
Joined: Sat, 6. Feb 16, 09:54
x4

Re: [Guide] Flee Behaviors Explained

Post by Rezoken » Thu, 14. May 20, 18:26

leoriq wrote:
Thu, 14. May 20, 08:20
Behavior 5 is for moving into neighboring sectors.
Behavior 1 works only in current sector.
I didn’t see any code or conditions that would cause that? Can you point out where you see that behavior in the files?

Rezoken
Posts: 13
Joined: Sat, 6. Feb 16, 09:54
x4

Re: [Guide] Flee Behaviors Explained

Post by Rezoken » Thu, 14. May 20, 18:31

Andrey12y wrote:
Thu, 14. May 20, 14:02
Just wondering where there is check for at least 30-40% recharged shield before set to previous command.
I saw my ships flees and then immediately jump to fight again and die because no shields. No much point of such flee maneuver.
Unfortunately I do not see that behavior at all. However, I see no reason why it couldn't be added? It should all be possible in the files that I saw. Currently it only checks to see if the attacker is still in the area and then resumes (or it tried to flee to many times). However, an attacker is a single attacker for the most part, and so if it runs from the single heavy fighter that then dies, but 40 of his buddies are still around it can then fly back into the frey.
Andrey12y wrote:
Thu, 14. May 20, 14:02
Can you also extract info about Morale skill earning from fight and trade activities?
Like if my pilot bought spaceweed for 200 cr and sold it on black market with crazy margin - did it make him happy, more motivated and more experienced?
The experience gain and when and where it does it is beyond me. There are too many files that deal with experience and really don't want to go through hundreds of files trying to pull it out.

I do know however that trading will increase both Pilot and Morale skill. I am not sure if you get more or less depending on the quantity of wares traded or the % of profit made. I also know that Morale can decrease slowly over time if your ship is just idling and do nothing.

Sao t'Lp
Posts: 107
Joined: Tue, 17. Nov 09, 22:18
x4

Re: [Guide] Flee Behaviors Explained

Post by Sao t'Lp » Fri, 15. May 20, 18:42

I took the liberty of putting some of your findings into a wiki article. It's not as detailed as your guide but that's by choice because I did not wanted the guide to be too close to the actual implementation.
You want Split? :split:

leoriq
Posts: 196
Joined: Wed, 20. Mar 13, 07:42
x3ap

Re: [Guide] Flee Behaviors Explained

Post by leoriq » Sat, 16. May 20, 16:43

Rezoken wrote:
Thu, 14. May 20, 18:26
leoriq wrote:
Thu, 14. May 20, 08:20
Behavior 5 is for moving into neighboring sectors.
Behavior 1 works only in current sector.
I didn’t see any code or conditions that would cause that? Can you point out where you see that behavior in the files?
I saw that in game, not in files.

Post Reply

Return to “X4: Foundations”