The Starlane Nexus
Moderators: Oberlus, Committer
Re: The Starlane Nexus
I think I've made my first PR, #2631, not sure if I did it right.
Re: The Starlane Nexus
I too am a little confused why we are losing this starlane when MIN_PERP_DIST=10. My best guess is it's a system outside of the screenshot. There is a test that allows close objects sufficiently far but the condition is:Oberlus wrote: ↑Tue Nov 05, 2019 9:57 am Edit: Notice the absent starlane between Ster beta and the pale blue empty system in the SW corner.It is just outside of the maximum distance (250). Does anyone thing it should be connected?
Edit 2: no, it's not outside the maximum distance, it was connected when using MIN_PERP_DIST = 10 and MAX_LANE_DOT_PRODUCT = 0.87. I don't understand why increasing MIN_PERP_DIST forbids that starlane.
Code: Select all
// if object is further from either of the lane end systems than they
// are from eachother, it is fine, regardless of the right-angle
// distance to the line between the systems
if (dist2_12 < dist2_o1 || dist2_12 < dist2_o2)
return false;
Your solution of simply upping the MIN_PERP_DIST seems to have done the trick.
If it is producing undesirable results in this case or another case, another possibility is tightening the condition quoted above:
Could have instead, e.g.
Code: Select all
if (dist2_12 < alpha * dist2_o1 || dist2_12 < alpha * dist2_o2)
Presumably, there is some minimum distance between any two systems (at least during universe generation?). If we have this constant it should be possible to come up with a good value for alpha.
Re: The Starlane Nexus
In order to alleviate the problem described here and here, I'm testing the following changes:
In the Starlane Bore (FOCS), add a restriction of 250 maximum distance (as in the Starlane Nexus):
I don't understand the syntax of this AddStarlanes effect, different from the one in the Starlane Nexus, I'm just guessing I put the WithinDistance condition in the right place.
In Conditions.cpp:
That is, forbid angles <20 degrees, while it was <30 before.
I don't have save files compatible with current master to test this, so I won't make the PR until I get some. But I have other things to do first, so if any of you stumble upon a situation good for this, please attach the save file here.
In the Starlane Bore (FOCS), add a restriction of 250 maximum distance (as in the Starlane Nexus):
Code: Select all
scope = Object id = Source.SystemID
effects = [
AddStarlanes endpoint = MinimumNumberOf
number = 1
sortkey = DirectDistanceBetween object = Source.ID object = LocalCandidate.ID
condition = And [
System
WithinDistance distance = 250 condition = Source // <- HERE
CanAddStarlanesTo condition = Source
]
GenerateSitRepMessage
message = "EFFECT_STARLANE_BORE"
label = "EFFECT_STARLANE_BORE_LABEL"
icon = "icons/tech/n-dimensional_structures.png"
parameters = tag = "system" data = Target.ID
empire = Source.Owner
]
In Conditions.cpp:
Code: Select all
const float MAX_LANE_DOT_PRODUCT = 0.94f; // minimum angle between starlanes
// arccos(0.94) = 0.35 rad = 19.95 degrees
I don't have save files compatible with current master to test this, so I won't make the PR until I get some. But I have other things to do first, so if any of you stumble upon a situation good for this, please attach the save file here.
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: The Starlane Nexus
Code: Select all
AddStarlanes endpoint = MinimumNumberOf
number = 1
sortkey = DirectDistanceBetween object = Source.ID object = LocalCandidate.ID
condition = And [
System
WithinDistance distance = 250 condition = Source // <- HERE
CanAddStarlanesTo condition = Source
]
The indenting is bit odd; should be more likeI don't understand the syntax of this AddStarlanes effect, different from the one in the Starlane Nexus, I'm just guessing I put the WithinDistance condition in the right place.
Code: Select all
AddStarlanes endpoint = MinimumNumberOf
number = 1
sortkey = DirectDistanceBetween object = Source.ID object = LocalCandidate.ID
condition = And [
System
WithinDistance distance = 250 condition = Source // <- HERE
CanAddStarlanesTo condition = Source
]
The idea is that the bore adds a single lane to the single nearest suitable system, whereas the nexus adds lanes to all suitable systems.
That location for the WithinDistance filter looks OK.
Re: The Starlane Nexus
Thank you for the explanation, Geoff, really helpful.