What Is

Mafioso League

Events are based on the main gameplay and count every main game in their runtime. This event type applies to all the regular battles that are played during the runtime of the event. The gameplay and the added rules let the players gain Points and Currency.

Continue Reading

Economy System Simulation and Design Process of a live event in The Mafioso

I was in charge of designing the economy of a feature called Event League in the Mafioso game. For the summary, I calculated every new item’s price and value to our hard currency (gem) in the game and then designed a shop and its system. Finally, I tried to balance to whole economy and systems that participated in the Event League. In this article, I will describe the methods I used to design and balance this economy and system.

 

What is Mafioso?

 

Event Rule

Under this rule, there will be a certain order for killing the heroes that if followed gives the players’ bonus Points or Currency.

 

Event Points

Every battle counts points for the winner by calculating the difference between their living heroes and the other player living ones at the end of the game. The result varies between 1 to 3 Points. Only a won match can earn Points for the player, but there are no penalties if they lose

 

Event Currency

This is the main prize of the event and what the players need in order to get their desired reward. Players can earn different amounts of currency based on their arena.

 

Daily Limit

Every day in the event runtime has a particular limit to earn currency. The logic behind these limits is to limit players from getting excessive rewards and to drive the group of players who want more rewards to buy the boosters.

 

Daily Limit Assumptions

There are some factors for making predictions about the amount of the daily limits. For example the shop value or their rewards from the battles in different arenas.

Event Shop

In the Event Shop, players can spend their Event Currency to buy some items.

 

Freemium and Premium Shop

There are two types of shops in this event; one is totally free and the other one is the premium shop, and users should pay some amount of gem for opening this shop. The premium shop has more valuable rewards and items.

 

Leaderboard

In the event leaderboard, we have some sections in which every section includes different numbers of players. players in every section will get some rewards. The total rewards value calculation is similar to the shop value calculation.

 

The Economy Design Process

First of all, this is obvious that the whole Economy system should have two sides:

  • The one is to provide players with opportunities for economic advancements within the game settings.
  • The second is to generate revenue for the game studio and create opportunities for increasing this revenue.

 

Then, I followed these steps to design the concept of the economy:

  • I need to figure out what data we’ll show the players so they know how their in-game actions have affected things.
  • Then I should determine what economic activities will drive my game forward and give players opportunities for advancement.
  • Finally, I’ll need to decide when the game will reward players for participating in these activities.

 

According to the above, I designed the concepts:

 

The currencies correlation

The whole gameplay core loop, taps and sinks, and position of Event Currency in it

(EC stands for Event Currency)

 

The Player Actions

In this table, every -1 means sink, and 1 means source.

 

Analytical methods

Summary

For predicting the users’ behavior during the event and simulating the economy system workflow, I used some statistical and stochastic methods. Since the space of the economy has some variables that can have different values, I preferred to use a stochastic analysis something like Monte Carlo Analysis. For a brief explanation, I simulated the player behavior, progression (based on Elo System) in the game, and the whole economic system mentioned above in python. Then, I stored this data and did some statistical analysis (e.g. descriptive statistics) for extracting insight into how my hypothetical player acted.

Before jumping to the results, you can see my python code algorithm:

 

for i in range(soManyAttempts):

    #define users

    #define user arena

    #define user daily average play

    for j in range(eventTime):

        for k in range(playerAverageDailyPlays):

        #calculate opponent trophy

        #calculate some random variables for defining the player’s win state

        #calculate the final point and currency gained by the winner

        #define the winner

        #allocating winner score

        #calculate the trophy of the players based on the Elo system

The Player Object

player = {'name':'sina','trophy':0.0,'eventPoint':0,'eventCurrency':0,'kw':0,'kl':0,'arena':0}

 

Player Arena Calculation

I used two types of calculation for this variable:

  • On each attempt, the player belongs to one of the arenas 1 to 12, equally
  • On each attempt, the player belongs to an arena based on normal distribution

 

Player Average Daily Plays Calculation

Players in arenas five and higher, usually play more than players in lower arenas. So, I used random numbers based on the random distribution for defining how many matches they will play in a day.

if(player0['arena'] >= 4):

while True:

avgPlay = int(math.ceil(np.random.normal(20,10,1)))

if(0 < avgPlay <= 200):

break

    elif(player0['arena'] < 4):

        while True:

            avgPlay = int(math.ceil(np.random.normal(15,5,1)))

            if(0 < avgPlay <= 200):

                break

 

Random Scores

As the design shows if the winner passes the event quest or rule (e.g. killing a hero in the first place), they will get extra points and currencies. Obviously, in the Mafioso, the winner can have a maximum of 3 points. So, I assumed a random number between two and three for the winner’s gained point. 

Also, players will get different amounts of event currency based on their arena. Calculation of the reward amounts has its own challenges and there is no need to explain the methods here but in general, they are related to some factors like daily limits and total shop value.

 

Winner State

After calculating the player’s arena and trophy, in every battle, the player with a higher trophy compared to their opponent, has a sixty percent win rate.

 

Elo System

In The Mafioso, we use the Elo System to calculate the winner and loser’s trophy and have our own KLs and KWs. For simulating the player trophy during their progress in event runtime, I prototyped this system. (note: absolutely I’m not a python developer and I know this code can be written in a very better way. But it works properly! :))

attacker = rnd.randint(0, 1)

finalAttackerTrophy = 0

finalDefenderTrophy = 0

for x in range(0, len(kws)):

    if(player0['trophy'] <= maxTrophies[x] and player0['trophy'] >= minTrophies[x]):

        player0['kw'] = kws[x]
        player0['kl'] = kls[x]
    if(player1['trophy'] <= maxTrophies[x] and player1['trophy'] >= minTrophies[x]):

        player1['kw'] = kws[x]
        player1['kl'] = kls[x]
if (attacker == 0):

    qA = (10.0 ** (player0['trophy'] / 400))

    qD = (10.0 ** (player1['trophy'] / 400))

    eA = (qA / (qA + qD))

    eD = (qD / (qA + qD))

    if (winner == 0):

        finalAttackerTrophy = player0['trophy'] + (player0['kw'] * (1 - eA))

        if (player1['trophy'] - (player1['kl'] * eD) < 0):

            finalDefenderTrophy = 0

        else:

            finalDefenderTrophy = player1['trophy'] - (player1['kl'] * eD)

        player0['trophy'] = finalAttackerTrophy

        player1['trophy'] = finalDefenderTrophy

    elif (winner == 1):

        if (player0['trophy'] - (player0['kl'] * eA) < 0):

            finalAttackerTrophy = 0

        else:

            finalAttackerTrophy = player0['trophy'] - (player0['kl'] * eA)

        finalDefenderTrophy = player1['trophy'] + (player1['kw'] * (1 - eD))

        player0['trophy'] = finalAttackerTrophy

        player1['trophy'] = finalDefenderTrophy

elif (attacker == 1):

    qA = (10.0 ** (player1['trophy'] / 400))

    qD = (10.0 ** (player0['trophy'] / 400))

    eA = (qA / (qA + qD))

    eD = (qD / (qA + qD))

    if (winner == 0):

        if (player1['trophy'] - (player1['kl'] * eA) < 0):

            finalAttackerTrophy = 0

        else:

            finalAttackerTrophy = player1['trophy'] - (player1['kl'] * eA)

        finalDefenderTrophy = player0['trophy'] + (player0['kw'] * (1 - eD))

        player0['trophy'] = finalDefenderTrophy

        player1['trophy'] = finalAttackerTrophy

    elif (winner == 1):

        finalAttackerTrophy = player1['trophy'] + (player1['kw'] * (1 - eA))

        if (player0['trophy'] - (player0['kl'] * eD) < 0):

            finalDefenderTrophy = 0

        else:

            finalDefenderTrophy = player0['trophy'] - (player0['kl'] * eD)

        player0['trophy'] = finalDefenderTrophy

        player1['trophy'] = finalAttackerTrophy

 

Results

So, I assumed the attempts count as one thousand times and ran my code. Here are the results:

Currency Distribution in Arenas

We should pay attention to the fact that the distribution of resources in each arena follows the normal distribution.

 

Total Currency Distribution

Whole Data Description

Data Description Based on Arena

Shop Creation and Calculations (God bless spreadsheets!)