Skip to content

Commit

Permalink
Nerf the distance attenuation on sensors
Browse files Browse the repository at this point in the history
  • Loading branch information
behindcurtain3 committed Apr 14, 2024
1 parent 563e148 commit ae3aa7e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Pulsar4X/GameEngine/Engine/Factories/JPSurveyFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private static ProtoEntity CreateSurveyPoint(double x, double y, int nameNumber)
var nameDB = new NameDB($"Survey Point #{nameNumber}");
//for testing purposes
var sensorProfileDB = new SensorProfileDB();
sensorProfileDB.EmittedEMSpectra.Add(new Sensors.EMWaveForm(0, 500, 1000), 1E6);
sensorProfileDB.EmittedEMSpectra.Add(new Sensors.EMWaveForm(0, 500, 1000), 1E9);
sensorProfileDB.Reflectivity = 0;

var protoEntity = new ProtoEntity(new List<BaseDataBlob>() { surveyDB, posDB, nameDB, sensorProfileDB });
Expand Down
8 changes: 6 additions & 2 deletions Pulsar4X/GameEngine/FeatureSets/Sensors/SensorTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,12 @@ public static double AttenuationCalc(double sourceValue, double distance)
if (distance < 1) //if distance is too small, 4 pi r^2 ends up being < 1
distance = 1;

var value = sourceValue / (4 * Math.PI * distance * distance);
return value;
// TODO: need to rebalance this
// dividing by 4pi r^2 makes it incredibly hard to detect things from far away
// even if they have large signatures. For example, using this formula the default
// sensor on Earth doesn't detect Uranus or Neptune.
//return sourceValue / (4 * Math.PI * distance * distance);
return sourceValue;
}

/// <summary>
Expand Down

0 comments on commit ae3aa7e

Please sign in to comment.