I was asked to make this remark from the WithinStarlaneJumps implementation thread a separate post, so here it goes.
Many effects apply to targets within a certain starlane range from their source. Instead of having each possible target search its neighborhood for sources that can affect it, the source objects could create a new kind of (invisible) "effect" object in all systems within range. Thus, only the source object needs to scan its neighborhood, not every potential target. The source object should keep references to the effect objects, with farthest sorted first, so it can easily extend or shrink the effect range without re-scanning its neighborhood. At the very least, the effect objects must keep a reference to the source, so that they can be removed by another neighborhood scan when the source loses the effect (and it also avoids having to store all the other information about the effect in the object).
The only advantage of this strategy over the proposed improvement of WithinStarlaneJumps is that it avoids re-scanning the neighborhood of the "sources" every turn.
Avoiding WithinStarlaneJumps via Effect Universe Objects
Moderator: Committer
Avoiding WithinStarlaneJumps via Effect Universe Objects
Yesterday, we were still on the brink. Fortunately, today we have come one step further.