[MOD] Improved Explore Command Behaviour

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

User avatar
MegaJohnny
Posts: 2195
Joined: Wed, 4. Jun 08, 22:30
x4

[MOD] Improved Explore Command Behaviour

Post by MegaJohnny » Sat, 8. Dec 18, 14:54

This mod overhauls the behaviour of the Explore command for player ships. Whereas the vanilla AI navigates to the nearest undiscovered space and waits around a lot, this one flies in expanding concentric circles, ignoring any existing discovered space. It flies to different waypoints in a circle, waiting for the gravidar to finish a scan, then repeats this at a larger radius. It finishes when it has explored a certain radius around the order's centre point.

It takes into account the ship's radar range, so if you have another mod which changes radar ranges, this mod will adjust its behaviour to match.

As a test, I commanded a Discoverer to explore an undiscovered sector, and you can see images of the progress below. I have almost no ships in this save - everything in that sector was revealed by the Disco, and nothing else.
Initial state - sector is undiscovered
Part-way through the command
Just after the command finishes

Download
Nexusmods

Plans/Todo
Need ideas...!

Changes
0.52 - 2018-12-21
  • Remove save-game stickiness
  • Radius now begins from the nearest undiscovered hex, if that wouldn't be too close
0.51 - 2018-12-10
  • Fix content.xml missing placeholder language tags
0.50 - 2018-12-09
  • Initial release
Last edited by MegaJohnny on Sat, 22. Dec 18, 13:39, edited 8 times in total.

Guest242
Posts: 86
Joined: Sun, 12. Feb 17, 19:11
x4

Re: [WIP] Improved Explore Command Behaviour

Post by Guest242 » Sat, 8. Dec 18, 17:51

Cool! If you release, I will test it :)

redshift690
Posts: 35
Joined: Tue, 26. Feb 13, 20:43
x4

Re: [WIP] Improved Explore Command Behaviour

Post by redshift690 » Sat, 8. Dec 18, 18:07

Sweet! Thanks for working on this, can't wait to test it out. :)

morbideth
Posts: 391
Joined: Sun, 9. Nov 08, 03:07
x3tc

Re: [WIP] Improved Explore Command Behaviour

Post by morbideth » Sat, 8. Dec 18, 18:09

I was thinking about this and wanted to know if it uses travel mode? It seems to me that part of the reason the current mods are still slow is that they don't go far enough to build up speed in travel mode. So I was wondering if it was possible to just set up the whole exploration of a sector using waypoints, then leave them to fly around with their travel drive. It should, I think, greatly increase the speed of exploration if the waypoints are far enough apart from each other.

User avatar
MegaJohnny
Posts: 2195
Joined: Wed, 4. Jun 08, 22:30
x4

Re: [WIP] Improved Explore Command Behaviour

Post by MegaJohnny » Sat, 8. Dec 18, 18:55

morbideth wrote:
Sat, 8. Dec 18, 18:09
I was thinking about this and wanted to know if it uses travel mode? It seems to me that part of the reason the current mods are still slow is that they don't go far enough to build up speed in travel mode. So I was wondering if it was possible to just set up the whole exploration of a sector using waypoints, then leave them to fly around with their travel drive. It should, I think, greatly increase the speed of exploration if the waypoints are far enough apart from each other.
Oh, yes, unconditionally. I'm arranging the distance between waypoints to be equal to twice the radar range (if I've got the math right), and 80km is a good distance for travel mode.

The trouble it has to wait several seconds on average for the gravidar to scan, but it's unavoidable. I've tested it, and you can get a ship to go so fast in travel mode that it passes right by stations without discovering them.

rusky
Posts: 454
Joined: Sun, 4. Jan 09, 17:17
x4

Re: [WIP] Improved Explore Command Behaviour

Post by rusky » Sat, 8. Dec 18, 19:30

How far out does it go ? Since sectors are of varying sizes and there's usually no need to expand a sector beyond the bit with the stations.

Is there anyway to configure this as a parameter that you can set in the behavior panel ?

User avatar
MegaJohnny
Posts: 2195
Joined: Wed, 4. Jun 08, 22:30
x4

Re: [WIP] Improved Explore Command Behaviour

Post by MegaJohnny » Sat, 8. Dec 18, 19:33

rusky wrote:
Sat, 8. Dec 18, 19:30
How far out does it go ? Since sectors are of varying sizes and there's usually no need to expand a sector beyond the bit with the stations.

Is there anyway to configure this as a parameter that you can set in the behavior panel ?
I don't know how you'd set it via UI, but the Explore order does have a parameter for radius, and my code will stop after exceeding that radius. The default radius is 350km, and that's what the screenshots show.

rusky
Posts: 454
Joined: Sun, 4. Jan 09, 17:17
x4

Re: [WIP] Improved Explore Command Behaviour

Post by rusky » Sat, 8. Dec 18, 19:33

Aha cheers! Thanks for this :)

captainradish
Posts: 190
Joined: Sat, 30. Apr 05, 06:09
x4

Re: [WIP] Improved Explore Command Behaviour

Post by captainradish » Sat, 8. Dec 18, 20:10

Does it take into account differing radar ranges? I ask because mine are changed (S is 50km, M is 100km, and L/XL are 250km)?

User avatar
MegaJohnny
Posts: 2195
Joined: Wed, 4. Jun 08, 22:30
x4

Re: [WIP] Improved Explore Command Behaviour

Post by MegaJohnny » Sat, 8. Dec 18, 20:43

captainradish wrote:
Sat, 8. Dec 18, 20:10
Does it take into account differing radar ranges? I ask because mine are changed (S is 50km, M is 100km, and L/XL are 250km)?
I haven't tried it with anything but the vanilla 40km, but it does use the radar range as part of the calculations. :) I'm glad you told me about your radar ranges, because with the default radius of 350km, your L ships might stop without doing any circles at all. So I'll set it to always do at least one circle before stopping.

If you have a link to download the mod you're using I'd be happy to test with it.

Skaeger
Posts: 6
Joined: Fri, 7. Dec 18, 09:18
x4

Re: [WIP] Improved Explore Command Behaviour

Post by Skaeger » Sat, 8. Dec 18, 22:42

This sounds absolutely amazing, and I cannot wait to try it out!

captainradish
Posts: 190
Joined: Sat, 30. Apr 05, 06:09
x4

Re: [WIP] Improved Explore Command Behaviour

Post by captainradish » Sat, 8. Dec 18, 23:39

MegaJohnny wrote:
Sat, 8. Dec 18, 20:43
captainradish wrote:
Sat, 8. Dec 18, 20:10
Does it take into account differing radar ranges? I ask because mine are changed (S is 50km, M is 100km, and L/XL are 250km)?
I haven't tried it with anything but the vanilla 40km, but it does use the radar range as part of the calculations. :) I'm glad you told me about your radar ranges, because with the default radius of 350km, your L ships might stop without doing any circles at all. So I'll set it to always do at least one circle before stopping.

If you have a link to download the mod you're using I'd be happy to test with it.
Here you go: https://www.nexusmods.com/x4foundations/mods/77/

Osbot
Posts: 108
Joined: Sun, 10. Jan 10, 19:49
x4

Re: [WIP] Improved Explore Command Behaviour

Post by Osbot » Sun, 9. Dec 18, 02:10

I need this! I pretty much refuse to ever restart again, because I can't stand dragging out hexagonal search patterns for every sector and will never do it again :)

Tkdmaster
Posts: 21
Joined: Sat, 4. Feb 17, 04:13
x4

Re: [WIP] Improved Explore Command Behaviour

Post by Tkdmaster » Sun, 9. Dec 18, 02:26

Interesting idea! Though, if i'm understanding correctly, there will always be unscanned areas in all the corners and edges with this, as in the pictures? As someone who is a bit OCD when it comes to sector scanning, this sadly kills it for me :(

sulu244
Posts: 25
Joined: Wed, 5. Dec 18, 02:07
x4

Re: [WIP] Improved Explore Command Behaviour

Post by sulu244 » Sun, 9. Dec 18, 03:00

Tkdmaster wrote:
Sun, 9. Dec 18, 02:26
Interesting idea! Though, if i'm understanding correctly, there will always be unscanned areas in all the corners and edges with this, as in the pictures? As someone who is a bit OCD when it comes to sector scanning, this sadly kills it for me :(
Because the sectors expand there will always be some unscanned areas visible, even if you fly the missions yourself, as far as I can tell anyway.

morbideth
Posts: 391
Joined: Sun, 9. Nov 08, 03:07
x3tc

Re: [WIP] Improved Explore Command Behaviour

Post by morbideth » Sun, 9. Dec 18, 10:28

Can we get a beta or alpha version to play with? Anything is better than the vanilla version.

User avatar
MegaJohnny
Posts: 2195
Joined: Wed, 4. Jun 08, 22:30
x4

Re: [WIP] Improved Explore Command Behaviour

Post by MegaJohnny » Sun, 9. Dec 18, 16:21

morbideth wrote:
Sun, 9. Dec 18, 10:28
Can we get a beta or alpha version to play with? Anything is better than the vanilla version.
Sometime today. :)

I've tested the mod with the radar range mod, here are my findings:

M ship - 4677m/s travel speed - 100km radar range - Before - After
An M ship does 2 rings at the time of writing, and overall it took 35 minutes of game time.
L ship - 6830m/s travel speed - 250km radar range - Before - After
That one did 1 ring, and overall it took 15 minutes of game time. Not sure what happened with the kink at the end, I have a suspicion there's a bug in the coordinate system or something.
TODO - the L ship also went anticlockwise, when the code should in theory always go clockwise? I need to investigate this.

Both of this happened in low attention, so bear in mind there were no complications from collisions or turning speed.

Unmodded, it takes much longer, of course - a Pericles takes about 20 minutes for a baseline scan, and I got bored of waiting after about an hour. :p
Progress: 1 - 2 - 3 - 4

Edit: Now released, check it out!

Kadatherion
Posts: 1021
Joined: Fri, 25. Nov 05, 16:05
x4

Re: [MOD/WIP] Improved Explore Command Behaviour

Post by Kadatherion » Mon, 10. Dec 18, 02:32

Thank you, this is exactly what I hoped for, effective, and it won't use the vanilla exploring mechanic that I fear might completely mess up the default sector zoom size. I'm using the increased radar range mod as well (although I modified it to more conservative defaults, max is 100km for L/XL ships), so knowing that it adapts accordingly is the cherry on top.

You will want, however, to include the placeholder languages ids in your content.xml, or the mod will crash the game on startup for people running a non english installation:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<content id="MeJ_Improved_Explore_Behaviour" name="Improved Explore Behaviour" description="Overhauls the behaviour of the Explore command for player ships to make it more efficient" author="MegaJohnny" version="050" date="2018-12-09">
<text language="7" name="Improved Explore Behaviour" description="Overhauls the behaviour of the Explore command for player ships to make it more efficient." author="MegaJohnny" />
<text language="33" name="Improved Explore Behaviour" description="Overhauls the behaviour of the Explore command for player ships to make it more efficient." author="MegaJohnny" />
<text language="34" name="Improved Explore Behaviour" description="Overhauls the behaviour of the Explore command for player ships to make it more efficient." author="MegaJohnny" />
<text language="39" name="Improved Explore Behaviour" description="Overhauls the behaviour of the Explore command for player ships to make it more efficient." author="MegaJohnny" />
<text language="44" name="Improved Explore Behaviour" description="Overhauls the behaviour of the Explore command for player ships to make it more efficient." author="MegaJohnny" />
<text language="49" name="Improved Explore Behaviour" description="Overhauls the behaviour of the Explore command for player ships to make it more efficient." author="MegaJohnny" />
<text language="86" name="Improved Explore Behaviour" description="Overhauls the behaviour of the Explore command for player ships to make it more efficient." author="MegaJohnny" />
<text language="88" name="Improved Explore Behaviour" description="Overhauls the behaviour of the Explore command for player ships to make it more efficient." author="MegaJohnny" />
</content>

User avatar
MegaJohnny
Posts: 2195
Joined: Wed, 4. Jun 08, 22:30
x4

Re: [MOD/WIP] Improved Explore Command Behaviour

Post by MegaJohnny » Mon, 10. Dec 18, 08:11

Kadatherion wrote:
Mon, 10. Dec 18, 02:32
Thank you, this is exactly what I hoped for, effective, and it won't use the vanilla exploring mechanic that I fear might completely mess up the default sector zoom size. I'm using the increased radar range mod as well (although I modified it to more conservative defaults, max is 100km for L/XL ships), so knowing that it adapts accordingly is the cherry on top.

You will want, however, to include the placeholder languages ids in your content.xml, or the mod will crash the game on startup for people running a non english installation:
Oops! I'm sure it fell back to the root content tag in XR. Good to know, I'll update this tonight.

Now uploaded with compliments to players with non-English games. ;)

captainradish
Posts: 190
Joined: Sat, 30. Apr 05, 06:09
x4

Re: [MOD/WIP] Improved Explore Command Behaviour

Post by captainradish » Wed, 12. Dec 18, 03:14

This mod is far superior to the vanilla behavior, IMO. Any way we can create a "galactic" version like X3's Universe Explorers? I'd love to be able to give my scout an explore command and totally ignore what it's doing from then on.

Post Reply

Return to “X4: Foundations - Scripts and Modding”