Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selecting minables by value may prefer less valuable targets over very valuable ones needing high prospecting #9981

Open
SomeTroglodyte opened this issue Apr 9, 2024 · 0 comments
Labels
mechanics Things dealing with the mechanics & code of how the game works

Comments

@SomeTroglodyte
Copy link

Problem Description

With extremely good asteroid scan power, and some modded minables that have very low chance to drop very valuable loot 1, it becomes evident that the prospecting mechanism is not taken into account at all for the value calculation that determines what the "V" key will select with the "target asteroid based on" = value setting.

Related Issue Links

none found

Desired Solution

Since value is currently calculated only once, taking the actual prospecting potential of your fleet into account would be a lot of code change and potentially performance heavy. Thus I propose simply assuming some likely average - maybe between human and korath dedicated mining weapons. That would mean when the minable has taken maxHull damage, it would have accumulated 75% of that in prospecting.

as tested patch
Subject: [PATCH] Change Minable value calculation to assume some prospecting
---
Index: source/Minable.cpp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/source/Minable.cpp b/source/Minable.cpp
--- a/source/Minable.cpp	(revision ef72fe3b38daffe1e31c946e3d19e7dab1d2e561)
+++ b/source/Minable.cpp	(revision 3be576bf161842c097aa0aa63edc624ca93d0c67)
@@ -103,14 +103,24 @@
 }
 
 
+double Minable::calculateDropRate(double prospecting, const Payload& payload) {
+	double dropRate = payload.dropRate;
+	if(prospecting > 0. && dropRate < 1.)
+		dropRate += (1. - dropRate) / (1. + payload.toughness / prospecting);
+	return dropRate;
+}
 
 // Calculate the expected payload value of this Minable after all outfits have been fully loaded.
 void Minable::FinishLoading()
 {
-	for(const auto &it : payload)
-		value += it.outfit->Cost() * it.maxDrops * it.dropRate;
+	for(const auto &it : payload) {
+		// Calculate value based on an assumed prospecting somewhere between human and korath mining weapons
+		double dropRate = calculateDropRate(maxHull * 0.75, it);
+		if(dropRate <= 0.)
+			continue;
+		value += it.outfit->Cost() * it.maxDrops * dropRate;
+	}
 }
-
 
 
 const string &Minable::TrueName() const
@@ -218,11 +228,9 @@
 		{
 			// Each payload has a default 25% chance of surviving. This
 			// creates a distribution with occasional very good payoffs.
-			double dropRate = it.dropRate;
 			// Special weapons are capable of increasing this drop rate through
 			// prospecting.
-			if(prospecting > 0. && dropRate < 1.)
-				dropRate += (1. - dropRate) / (1. + it.toughness / prospecting);
+			double dropRate = calculateDropRate(prospecting, it);
 			if(dropRate <= 0.)
 				continue;
 			for(int amount = Random::Binomial(it.maxDrops, dropRate); amount > 0; amount -= Flotsam::TONS_PER_BOX)
Index: source/Minable.h
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/source/Minable.h b/source/Minable.h
--- a/source/Minable.h	(revision ef72fe3b38daffe1e31c946e3d19e7dab1d2e561)
+++ b/source/Minable.h	(revision 3be576bf161842c097aa0aa63edc624ca93d0c67)
@@ -131,6 +131,8 @@
 	std::map<const Effect *, int> explosions;
 	// The expected value of the payload of this minable.
 	int64_t value = 0.;
+	// Calculates actual drop rate with a given prospecting value.
+	double calculateDropRate(double prospecting, const Payload& payload);
 };
 
 

Alternative Approaches

Just bite the bullet and ignore unintuitive "v" behaviour - especially as the base game has no "surprise" minables, all hull-to-toughness ratios are close.

Additional Context

No response

Footnotes

  1. say, a hull 20k 'roid dropping a blue sun reactor with drop rate .0000001 and toughness 40k

@TomGoodIdea TomGoodIdea added the mechanics Things dealing with the mechanics & code of how the game works label Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mechanics Things dealing with the mechanics & code of how the game works
Projects
None yet
Development

No branches or pull requests

2 participants