Excavation

Ask Page...

Moderators: JettJackson, Infinity, Page

Edgecrusher
Newbie Spam Artist
Posts: 512
Joined: Tue Apr 05, 2005 10:23 am
Location: Netherlands

Excavation

Post by Edgecrusher »

I have been recording my excavation for the past half year and now that I've gathered enough data I did a statistical analysis. Here's my conclusions:

- The mine level is relevant, but the effect is very small. I could find no evidence for level 12-13 mines giving significantly more special goods.
- Special goods seem to be divided in three groups: the basic three goods, past knowledge goods and alien goods. Basic goods are found roughly 6-7 times as much as aliens, past knowledge goods roughly 3-4 times as much.
- Mining drones do matter, to a high degree even. I found that excavating level 3-4 asteroids with elite mining drones roughly equals mining level 20 mines with the simplest drones.
- There is no significant difference between different asteroid types (e.g. "colony")
- The number of goods per excavation (2-4) is 2 in 70-80 percent of the times, 3 in 10-20 percent and 4 in 5-10 percent
- Refreshing vs excavating an entire load at once: Refreshing is definitely much better.
- Excavate gadget has no significant effect for high level mines, but strangely it does have a significant effect for lower level mines. I suspect that this is due to the size of the mine

Furthermore, I heard from Erke, that Page told him that the 'depletion' of a mine has some influence, that is the size of the mine compared to its starting size gives you a bonus in excavating. But because I can't tell whether my mines were full or not, I can't confirm this. Also, my data came from two different games, so if anything changed in between, this may influence my conclusions.

Page, is it possible that we get the formula's for excavating to confirm my findings?
Last edited by Edgecrusher on Sun Oct 26, 2008 9:42 am, edited 1 time in total.
Infinity
Newbie Spam Artist
Posts: 998
Joined: Thu Feb 09, 2006 10:14 pm

Re: Excavation

Post by Infinity »

Interesting analysis :)

Thanks Edge :)
Use The Force(s)!
Page
SMR Coder
Posts: 1779
Joined: Sat Dec 07, 2002 9:17 pm

Re: Excavation

Post by Page »

$score = 0; //init score
$score += $THIS_SHIP['Current Mining Drones']['Rundown Mining Drones'] * 1; //these count for 1 point
$score += $THIS_SHIP['Current Mining Drones']['Simple Mining Drones'] * 2; //these count for 2 points
$score += $THIS_SHIP['Current Mining Drones']['Basic Mining Drones'] * 3; //these count for 3 points
$score += $THIS_SHIP['Current Mining Drones']['Advanced Mining Drones'] * 5; //these count for 5 points
$score += $THIS_SHIP['Current Mining Drones']['Elite Mining Drones'] * 8; //these count for 8 points
$score /= $THIS_SHIP['Mining Drones']; //divide by the total drones the ship can hold

$cargo_per_second = $score * 10;

//determine bonus for mines that are low
if ($mine_info['Amount'] == 0) $check = 1;
else $check = $mine_info['Amount'];
$bonus = $mine_info['Starting Amount'] / $check;
if ($bonus > 4) $bonus = 4;

if (gadget_equipped($THIS_PLAYER,'Excavate Bonus')) $bonus++;
//echo 'Applying a '.$bonus.'x bonus for amt left.';
//determine the goods they will get
$num_goods = mt_rand(2,4); //this is how many types of goods we will get
$goods_we_get = $common_goods;
if ($mine_score < 20)
{
if (mt_rand(1,1000) <= 75 * $bonus)
$goods_we_get[] = array_shift($rare_goods);
if (mt_rand(1,1000) <= 35 * $bonus)
$goods_we_get[] = array_shift($very_rare_goods);
if (mt_rand(1,1000) <= 8 * $bonus)
$goods_we_get[] = array_shift($exremely_rare_goods);
}
elseif ($mine_score < 50)
{
if (mt_rand(1,1000) <= 95 * $bonus)
$goods_we_get[] = array_shift($rare_goods);
if (mt_rand(1,1000) <= 50 * $bonus)
$goods_we_get[] = array_shift($very_rare_goods);
if (mt_rand(1,1000) <= 12 * $bonus)
$goods_we_get[] = array_shift($exremely_rare_goods);
}
elseif ($mine_score < 100)
{
if (mt_rand(1,1000) <= 130 * $bonus)
$goods_we_get[] = array_shift($rare_goods);
if (mt_rand(1,1000) <= 75 * $bonus)
$goods_we_get[] = array_shift($very_rare_goods);
if (mt_rand(1,1000) <= 20 * $bonus)
$goods_we_get[] = array_shift($exremely_rare_goods);
}
elseif ($mine_score < 120)
{
if (mt_rand(1,1000) <= 180 * $bonus)
$goods_we_get[] = array_shift($rare_goods);
if (mt_rand(1,1000) <= 85 * $bonus)
$goods_we_get[] = array_shift($very_rare_goods);
if (mt_rand(1,1000) <= 25 * $bonus)
$goods_we_get[] = array_shift($exremely_rare_goods);
}
elseif ($mine_score < 160)
{
if (mt_rand(1,1000) <= 200 * $bonus)
$goods_we_get[] = array_shift($rare_goods);
if (mt_rand(1,1000) <= 105 * $bonus)
$goods_we_get[] = array_shift($very_rare_goods);
if (mt_rand(1,1000) <= 35 * $bonus)
$goods_we_get[] = array_shift($exremely_rare_goods);
}
else
{
if (mt_rand(1,1000) <= 220 * $bonus)
$goods_we_get[] = array_shift($rare_goods);
if (mt_rand(1,1000) <= 130 * $bonus)
$goods_we_get[] = array_shift($very_rare_goods);
if (mt_rand(1,1000) <= 55 * $bonus)
$goods_we_get[] = array_shift($exremely_rare_goods);
}

For each good that it's decided we can get (in random order):
$amount = mt_rand(10,round(100/$num_goods) + 10) / 100 * $holds_to_fill;

Last good will use up all unused mining power.
Freon22
Beginner Spam Artist
Posts: 3278
Joined: Wed Apr 17, 2002 10:09 pm
Location: USA
Contact:

Re: Excavation

Post by Freon22 »

Script looks good.

Edit: I realized that on the IFs when I walked from my computer to the phone, came back to change by post and you had already made a reply.

Why Edit one more time. I should not be on the computer right now seem everyone wants to call and talk tonight. :(
But yes nice little example on if statements. I can do one too, :D

Code: Select all

int myNumber = 4;
 if (myNumber < 6)
 Response.Write("First IF");
 else if (myNumber < 8)
 Response.Write("Second IF");
 else if (myNumber < 10)
 Response.Write("Third IF");
PHP syntax is alot like C#
Last edited by Freon22 on Sun Oct 26, 2008 2:35 am, edited 4 times in total.
Page
SMR Coder
Posts: 1779
Joined: Sat Dec 07, 2002 9:17 pm

Re: Excavation

Post by Page »

Freon22 wrote:All in all its an ok script. One question if the mine_score is less then 20 then it will also be less then any of the others. So all of the elseIf will run after the first If. Well I guess it has to, to fill the array through all those randoms. btw where does mine_score get its value? Doesn't matter just wanting to know.
Didn't realise mine score was missing:
$mine_score = $mine_level * $score; //this will range from just above 0 to 160

Also elseifs only execute if the previous ifs are false.

Code: Select all

if(true)
{
}
else //only does the stuff in here if the if before was false
{
	if(true)
	{
	}
	else
	{
		if(true)
		{
		}
		else
		{
		}
	}
}
Edgecrusher
Newbie Spam Artist
Posts: 512
Joined: Tue Apr 05, 2005 10:23 am
Location: Netherlands

Re: Excavation

Post by Edgecrusher »

Okay, well that indeed confirms almost any point of my analysis, as far as I can see. Should have asked for that code before I started gathering 6 Mb of info...

First, let me point out some (major) flaws in the code. People who don't really care about the code (my comments may be a bit technical and difficult to understand) can skip ahead to the suggestions I make later in the post.

- First, the code gathers an array of goods that one can find in an excavation. That can hold 5 goods in total maximum, ore and precious metals and one of each of the categories of special goods (which I will assume correspond to the three groups I found). It is not possible to have more than 1 of each category of special goods. Then I assume it creates some random order out of this, because in practice in some cases you do not get either ore or precmet. But what if there are 5 goods in the array, and the num_goods is only two? In the worst case that would half the chance of getting alien goods. On the other hand, if you get num_goods as 4 but the array of goods only contains ore and precmet, than why does the code not crash? I assume you are leaving a lot out here, but even if it does not crash, it stops at 2 goods, which explains why I found that 2 goods are much more common than 4 goods.

-In determing the amount of goods, you use a random number between 10 and 35 goods (for num_goods = 4). That means that even if you have 4 goods, it is possible that your cargo is already full with three goods and the fourth falls out, further dimininshig the chances of getting 4 goods, or alien goods.

- The code checks for a bonus from the amount of goods you already drained from the mine, but it seems to do so only one. That means that if you have 1001 holds, and excavate an asteroid with a starting amount of 4000 and 1001 left, you get a bonus of 3, while if it would have had 999 left, your bonus would have been 4. I think this is the main explanation for why refreshing is better than excavating in one go: if you refresh, I assume that the check for a bonus is made with each refresh.

- In this code, there is ;P no difference between a level 19 mine and a level 15 mine, whereas I would think four levels should make at least some difference. Why are their categories (i.e. 0-20, 20-50, etc.) instead of level having a linear effect. Not only does that make more sense, it would also reduce the complexity of the code.

Then, some discussion:

- I think that the level of a mine should have the most effect on the success of excavation. In this code, it does have some effect, but it is very small, cause it is blurred by 3 or 4 random functions that are *not* depending on the mine level (Number of goods, amount of goods, the problems I described above). That explains why I found only a very small effect, whereas the effect should imho be large.

- The bonus as a result of the part of the mine already depleted surprised me when Erke told me about it, but even more when I read this: The bonus can be 4, which is 4 times as much as the bonus you get from excavating. This further reduces the effect of mine level, because lower level mines are bigger, and therefore benefit from this bonus for a larger amount of goods than higher level mines do. I think this bonus needs to be cut back, and the bonus from the excavating gadget should be increased. Also, this would imply that the chance of getting special goods for the last quarter of a level 20 mine is more than 100%, and I haven't found that in my data, so I think the effect of randomly ordering goods_we_get is far too large

- In addition, but this falls outside the code: Azool once promised us that excavating would make trade routes more dynamic, but with the current setup that is not true. I propose making asteroids more predictible in what goods you get from them: for example "mineral asteroids" would give ore, whereas "Volcanic asteroids" would give precious metals and "Fertile asteroids" would give wood, "colony" type asteroids would give you a chance of finding aliens, but much more than you currently would. As I suspected, asteroid type currently has no effect, unless that is in a part of the code you left out.

Without wanting to confuse two threads: this is why I would like to have a copy of the code - it is so enormously useful in understanding the game mechanics.
Edgecrusher
Newbie Spam Artist
Posts: 512
Joined: Tue Apr 05, 2005 10:23 am
Location: Netherlands

Re: Excavation

Post by Edgecrusher »

One more thing: I thought excavating was dependent on repair history? I see nothing supporting that in the code we got.

I think in this game, a person should have three ways of making a carreer: by trading, and by hunting, as of old, but also by excavating. A choice must be made here, and for those who make the choice to go excavating, it should become easier.

This would be an argument for making excavating repair history dependent, so one cannot trade first and then excavate when trading is no longer profitable. Instead, people should be able to get alien ships at half of the game (instead of at the end, as is the case now), and alien gadgets at 3/4th of the game (if they are at all implemented. However, as a side effect, alien knowledge would have to interfere with getting certain gadgets, so having alien weapons would balance out against hunters having increased fighting stats due to certain gadgets. The same should be true for traders by they way, but that discussion should be held in another thread to not pollute the discussion on excavating.
Page
SMR Coder
Posts: 1779
Joined: Sat Dec 07, 2002 9:17 pm

Re: Excavation

Post by Page »

It goes through each in a random order until it reaches $number_goods, if $goods_we_get is empty it skips the loop.
Also PHP is generally very forgiving when it comes to bad coding so a lot of places that would crash in a stricter language it lets you get away with.

You're probably right about why refresh is better.

I think there is some difference between level 15 and 19 depending on mining drones, but never really looked into this code much. Also I'm sure it probably would reduce code complexity, however trust me when I say this is one of the much much simpler bits of Azool's code (with almost all parts being more complicated than necessary due to lack of functions etc)

The bonus from depleted mines takes longer to for the lower level mines, and also has less effect than the same bonus on a higher level mine.

Different types of mines have no effect at all, at least none I've seen in-game or in the code. (some things can be pretty deeply buried)


Excavating doesn't care about repairs (I know I've said that a few times to people - which I got from when Azool was still coder and told people)
Infinity
Newbie Spam Artist
Posts: 998
Joined: Thu Feb 09, 2006 10:14 pm

Re: Excavation

Post by Infinity »

I think in this game, a person should have three ways of making a carreer: by trading, and by hunting, as of old, but also by excavating. A choice must be made here, and for those who make the choice to go excavating, it should become easier.

This would be an argument for making excavating repair history dependent, so one cannot trade first and then excavate when trading is no longer profitable.
I absolutely agree, one's not supposed to be both spooky and have alien technology, but rather to choose between these things.
Use The Force(s)!
Edgecrusher
Newbie Spam Artist
Posts: 512
Joined: Tue Apr 05, 2005 10:23 am
Location: Netherlands

Re: Excavation

Post by Edgecrusher »

Well, again, my conclusions may be off, because I'm not seeing the whole code and don't know what isn't there or how much isn't there, but the percentage of aliens and other special goods depends solely on the mine_score, which is the mining drone bonus multiplied by the mine level. So a level 15 mine would have a mine_score of 15*8 = 120, and a level 19 mine would have a mine_score of 19*8 = 152, assuming someone uses elite drones, which everyone will do at a certain point in the game. That puts them into the same category (120-160 mine score), which gives them the same amount of special goods.

But the main point is that the difference between mine levels becomes very small because of the many random functions used that are not dependent on mine level.

And whether it shuffles the area or goes through it in a random order (the former would be much more efficient in php), the fact is that there is a discrepancy between num_goods and the size of goods_to_get. But this is getting very technical and I rather focus on the spirit of the code and how it works out in practice.
Post Reply