elitebgs
elitebgs copied to clipboard
Compute expansion targets
Create an API endpoint and UI and BGSBot handling for expansion target systems.
I have a python function which uses your api and a bit of edsm’s if that’s of any use to you ?
Unfortunately, I am not very good in Python. Also, the computation of the expansion targets would make db calls instead of API calls for faster output. If you are able to help me in Javascript, it would be much appreciated.
Unfortunately i'm not too good at java script. but how my function works it gets a cube of systems in a certain ly distance from the expansion system from edsm. then checks all the systems faction counts it also disregards prison systems and the pilots fed faction.
Yeah, that is how the implementation idea is. I might be getting some time towards the end of this month. I will get on with implementing the pending feature sets during that time. I hope we can get in touch to share ideas during that time?
I've got this done in MongoDB as an aggregation.
// System search playground
use('expando');
var p0 = {
// controlling_minor_faction: "Sirius Inc",
// controlling_minor_faction_id: 7329,
// controlling_minor_faction: "SI Terraforming",
// controlling_minor_faction_id: 10185,
controlling_minor_faction: "Radiant Ruby Control Cooperative",
controlling_minor_faction_id: 77390,
// mf1: "Sirius Inc",
// mf1_id: 7329,
// mf1: "Home Of Light",
// mf2_id: 75396,
// mf1: "Race Marshalls",
// mf3_id: 75328,
// mf1: "Furry Cats",
// mf4_id: 75344,
// mf1: "Explorers of Nabudis",
// mf5_id: 76737,
"name": "Piriti",
"x": -47.9375,
"y": -1.1875,
"z": -106.6875,
};
var d = 60;
DBQuery.shellBatchSize = 200
db.systems_populated.aggregate([
{
$match: {
"controlling_minor_faction_id": { $ne : p0.controlling_minor_faction_id },
"x": {$gt: p0.x - d, $lt: p0.x + d},
"y": {$gt: p0.y - d, $lt: p0.y + d},
"z": {$gt: p0.z - d, $lt: p0.z + d},
"population": {$gt:0},
"minor_faction_presences.minor_faction_id": { $ne : p0.controlling_minor_faction_id },
// "minor_faction_presences.minor_faction_id": { $in: [p0.mf1_id, p0.mf2_id, p0.mf3_id, p0.mf4_id, p0.mf5_id ] },
}
},
{
$count
}
{
$project: {
id: 1,
name: 1,
controlling_minor_faction: 1,
controlling_minor_faction_id: 1,
population: 1,
factions: { $size: "$minor_faction_presences" },
distance: {
$sqrt: {
$add: [
{ $pow: [ { $subtract: [ "$x", p0.x ] }, 2 ] },
{ $pow: [ { $subtract: [ "$y", p0.y ] }, 2 ] },
{ $pow: [ { $subtract: [ "$z", p0.z ] }, 2 ] }
]
}
}
}
},
{
$sort: {
"distance": 1
}
}
]);
@SayakMukhopadhyay This shows only those systems that are within 60 ly (that can be varied), and it takes the input of the minor faction id, and the system name, which then must look up the x,y,z coordinates. They are placed in p0. The aggregate match uses a cube and not a sphere, so it will be accurate. The first expansion range is 20 ly, which when computed = sqrt(3)/2*(20+20) = 34.64 ly corner to corner maximum distance. Most expansions never hit that distance.
The aggregation outputs systems ordered by distance, so nearer systems are presented first. The projection contains name, controlling minor faction, number of factions in the system, and the distance from the source.
If you want to highlight the most likely system, its:
- The nearest system with less than 7 factions that they have never been retreated from if it exists
- else the nearest 7 faction system, leads to invasion (if it exists)
- else the nearest 6 faction system that you have been retreated from (if it exists)
- else the nearest 7 faction system that you have been retreated from (if it exists)
- else misfire
If misfire, the extended cube comes into play. It's unclear if it's 30 ly or 40 ly. There are references to doubling in size in the days of the sphere, but I have not found concrete evidence for 30 or 40 ly in any authoritative documentation or experiments conducted on the data sets.
If it misfires a second time, the system controller can no longer expand from this system, even if the INF is above 75%