How Giftboxes Work in Directive Alpha

November 11, 2016

How to get Gift Boxes

Gift boxes are awarded to every player who is in the top 10 of any daily ranking (fighting, gathering, etc.). If you make it to the top 10 in fighting and gathering in the daily ranking, you will get gift boxes for both categories. Depending on your ranking, you will get a Huge Gift Box (1st place), a Large Gift Box (2nd to 5th) or a Small Gift Box (6th to 10th). The bigger the Gift Box the more rewards you can expect. What’s in the Box?

Gift boxes can be opened from the Dashboard (click on Directive Alpha ingame). They hold all kinds of rewards which are generated at random (more on that later). Currently, you can find resources, Bits, iridium, and energy crystals. How are Rewards Generated?

Each gift box gives a set number of gifts which are picked at random. Every gift is assigned a weight, which determined how often it drops. A high weight means it drops often, a small weight means… well, yes, it’s rare. Okay, now show me…!

First of all: Meet Fluffers. Fluffers is your ordinary house cat and loves to bring you”gifts” (also the internet seems to like cats, so he’s going to serve as an example for us).

Fluffers the Gifting Cat - Image courtesy of Laurinha Lii on Flickr

Fluffers goes hunting at night and occasionally brings home the following “gifts”:

As you can see, Fluffers is twice more likely to bring home a dead mouse than a dead bird (they’re more difficult to catch, duh). Also he seems to kill most of the mice before bringing them home.

If we look at all the animals Fluffers brought home, we see that he caught a total of 50. Of those 50, he brought you 30 dead mice (or 60%). The probability that he will bring you a dead mouse therefore is 60%. The probability that he will bring you a dead bird is half, or 30%. The remaining 10% of “gifts”, he will grace you with a live mouse.

Winter is Coming!

Now, let’s assume that most of the birds have migrated south because they’re sick of freezing their butts off in winter. Fluffers continues to hunt and brings home the following “gifts”:

As you can see, Fluffers brought home a total of 40 animals. But now the probability that he brings home a dead mouse is higher (remember, it’s cold in winter). Out of 40 animals he brings home 30 dead mice, or 75% of his prey. See how we changed the frequency of birds, and suddenly mice became more likely to be caught? That’s because the number of dead mice is bigger in comparison to the other prey. If Fluffers increased the catching of mice to 1000 per week, a bird would be a comparatively rare sight.

That’s basically how the Gift Boxes work too. But instead of animals, you get resources or Bits. The number of animals is equivalent to the weight that a gift is assigned. The higher a gift’s weight relative to the others, the more common the gift.

Implementation

Note: This is going to be a bit technical, so don’t worry if you don’t understand everything. You will still get your rewards :)

Now, how do we implement that? Let’s say we have N gifts. To pick the gift you get, we first sum up all the weights:

sum_weights = \sum{weights_i} for i=0,1,..,N

Now we pick a random number between 0 and the sum of the weights:

slug = random integer(0, sum_weights)

Now we go through the list of gifts and add up their weights one by one:

temp_weights_k = \sum{weights_i} for i=0,1,..,k

We continue to add up weights until

temp_weights_k <= slug < temp_weights_{k+1}.

Now we know that the gift you receive is gift_k. The probability that you get any given gift is therefore:

P(gift_k) = weight_k/sum_weights.

What we’re calculating here is called a Cumulative Distribution Function (I guess that Statistics class at university really paid off). For those of you who are into RPGs, this is the exact same method that Diablo 2 used for determining dropped items.

I hope I could make this somewhat understandable and give you a bit of insight into the mechanics of Directive Alpha.

If you haven’t joined yet, go to https://directivealpha.com and sign up now!