Difference between revisions of "E-Sim Optimal Equipment Selection"

From Simulace.info
Jump to: navigation, search
(Method)
Line 12: Line 12:
 
=Problem definition=
 
=Problem definition=
 
Let’s look closer at the military module of E-Sim. Battle for any region consists of 2-hour rounds. To win the battle one side should win 8 rounds. During the round both sides deal some damage and side with more damage in the end of 2-hour interval wins the round. Here comes the first rule of battle: damage, dealt in the very last minutes of the round is more valuable that in the beginning of the round. On average player can fire all their damage in 1.5-2 minutes, so the last 2 minutes of the round are the most intense. Important detail, which later resulted in the drastic changes of military module, is that the best fighter (with the most damage dealt) of the round (on each of the sides) is winning ‘Battle Hero’ medal and gets paid 5 gold (this sum will later be compared with costs of weapons and to explain strategy of players).
 
Let’s look closer at the military module of E-Sim. Battle for any region consists of 2-hour rounds. To win the battle one side should win 8 rounds. During the round both sides deal some damage and side with more damage in the end of 2-hour interval wins the round. Here comes the first rule of battle: damage, dealt in the very last minutes of the round is more valuable that in the beginning of the round. On average player can fire all their damage in 1.5-2 minutes, so the last 2 minutes of the round are the most intense. Important detail, which later resulted in the drastic changes of military module, is that the best fighter (with the most damage dealt) of the round (on each of the sides) is winning ‘Battle Hero’ medal and gets paid 5 gold (this sum will later be compared with costs of weapons and to explain strategy of players).
 +
 
Damage dealt by the individual depends on 2 characteristics: strength and rank. Strength is gain every day during the training so it solely depends on how many days player was actively playing this game. It doesn’t depend on how much money player can afford to spend. Rank is being gained through fighting: it depends only on the cumulated damage player have done during his whole ‘life’. So this characteristic depends how actively player fights and how much money he spends on the weapons. Rank is quantified as some coefficient and multiplied by strength – this forms the basic hit value.
 
Damage dealt by the individual depends on 2 characteristics: strength and rank. Strength is gain every day during the training so it solely depends on how many days player was actively playing this game. It doesn’t depend on how much money player can afford to spend. Rank is being gained through fighting: it depends only on the cumulated damage player have done during his whole ‘life’. So this characteristic depends how actively player fights and how much money he spends on the weapons. Rank is quantified as some coefficient and multiplied by strength – this forms the basic hit value.
 
Real battle damage will be modified with different bonuses: weapon bonus, military unit order bonus, location bonus. Experienced fighters always try to use all bonuses: they flight to specific region to gain the location bonus, they set military unit order on that battle. The most significant bonus is weapon bonus where most of the money are spent. Game has weapons of 5 quality levels (q1,q2,…,q5 notation; q5 – the best). If you fight without weapons you get -50% of your basic hit, with q1 weapons it’s +20% and with q5 weapons bonus is +100%.
 
Real battle damage will be modified with different bonuses: weapon bonus, military unit order bonus, location bonus. Experienced fighters always try to use all bonuses: they flight to specific region to gain the location bonus, they set military unit order on that battle. The most significant bonus is weapon bonus where most of the money are spent. Game has weapons of 5 quality levels (q1,q2,…,q5 notation; q5 – the best). If you fight without weapons you get -50% of your basic hit, with q1 weapons it’s +20% and with q5 weapons bonus is +100%.
 
Full hit with q1 weapons costs around 7-8 gold, with q5 – 25 gold, average pay from work is 2 gold, so you can imagine how much you should work to fight with q5 – own stocks, companies, trade.
 
Full hit with q1 weapons costs around 7-8 gold, with q5 – 25 gold, average pay from work is 2 gold, so you can imagine how much you should work to fight with q5 – own stocks, companies, trade.
 +
 
To sum up, players could easily and precisely calculate their damage in the battle. This was comfortable, but some players exploited this in the bad way to get a lot of money so admin was forced to change hit calculation.
 
To sum up, players could easily and precisely calculate their damage in the battle. This was comfortable, but some players exploited this in the bad way to get a lot of money so admin was forced to change hit calculation.
 
I would like to explain you how precise calculation of damage was exploited. As I mentioned earlier, in every round ‘Battle Hero’ medal with 5 gold prize is granted for players with the highest damage on each side. If few players (for example 10) get the same highest amount of damage on one side – 10 medals will be granted and everyone of 10 will get 5 gold each. Generally, anyone can take part in battle so competition is too high to make deal with everyone and take ‘group Battle Hero’. But there is very special kind of battle – Civil War – where only citizens of the country involved can fight. This was exploited by one small country (Malaysia, which had the population of about 60 people) – in the chat they were coordinating their damage and a lot of people (up to 10 in one round) got the ‘Battle Hero’ medal and 5 gold. It became a real gold mine for the small group of people. Civil Wars in Malaysia became very frequent and there was no way to stop it.
 
I would like to explain you how precise calculation of damage was exploited. As I mentioned earlier, in every round ‘Battle Hero’ medal with 5 gold prize is granted for players with the highest damage on each side. If few players (for example 10) get the same highest amount of damage on one side – 10 medals will be granted and everyone of 10 will get 5 gold each. Generally, anyone can take part in battle so competition is too high to make deal with everyone and take ‘group Battle Hero’. But there is very special kind of battle – Civil War – where only citizens of the country involved can fight. This was exploited by one small country (Malaysia, which had the population of about 60 people) – in the chat they were coordinating their damage and a lot of people (up to 10 in one round) got the ‘Battle Hero’ medal and 5 gold. It became a real gold mine for the small group of people. Civil Wars in Malaysia became very frequent and there was no way to stop it.
 +
 
To destroy this opportunity admin introduced a lot of changes to the military module and made it random: players couldn’t precisely calculate their damage. For example, basic hit of 1000 damage became an uniformly distributed value between 800 and 1200 damage – on the average it was the same, but you couldn’t predict you exact damage.
 
To destroy this opportunity admin introduced a lot of changes to the military module and made it random: players couldn’t precisely calculate their damage. For example, basic hit of 1000 damage became an uniformly distributed value between 800 and 1200 damage – on the average it was the same, but you couldn’t predict you exact damage.
 +
 
With randomization of basic hit value, admin also introduced new parameters usually available in MMORPG games: change of miss (zero damage), critical strike (double damage) and chance to avoid damage (deal damage, but does not spend hit). These parameters make hit value even more volatile and unpredictable.
 
With randomization of basic hit value, admin also introduced new parameters usually available in MMORPG games: change of miss (zero damage), critical strike (double damage) and chance to avoid damage (deal damage, but does not spend hit). These parameters make hit value even more volatile and unpredictable.
 
To influence these parameters admin created equipment pieces. 5 different slots were available for equipment: body armor, helmet, googles, weapon upgrade and offhand (later this number was increased to 8, but with another properties – economical – so we don’t consider them in damage simulations). There are 5 levels of quality (later level q6 was created, but it’s too expensive and rare to consider in simulation) of equipment, which determine interval in which values of bonuses are determined. Each piece has 2 bonuses, which can be of different kind. There are 7 kinds of military bonuses from equipment. 2 of them are proved to be not very efficient for developed players, so they were removed from the simulation. The rest 5 bonuses and their intervals for q5 items (q5 is the optimal equipment set for developed players) are:
 
To influence these parameters admin created equipment pieces. 5 different slots were available for equipment: body armor, helmet, googles, weapon upgrade and offhand (later this number was increased to 8, but with another properties – economical – so we don’t consider them in damage simulations). There are 5 levels of quality (later level q6 was created, but it’s too expensive and rare to consider in simulation) of equipment, which determine interval in which values of bonuses are determined. Each piece has 2 bonuses, which can be of different kind. There are 7 kinds of military bonuses from equipment. 2 of them are proved to be not very efficient for developed players, so they were removed from the simulation. The rest 5 bonuses and their intervals for q5 items (q5 is the optimal equipment set for developed players) are:
Line 25: Line 29:
 
*Reduced miss chance (6-7.5%)
 
*Reduced miss chance (6-7.5%)
 
*Chance to avoid damage (4-6%)
 
*Chance to avoid damage (4-6%)
Every player has the same starting probabilities of miss, critical hit and chance to avoid damage. They are 12.5% for miss and you can decrease it to 0; 12.5% for critical hit and can be increased till 40%; 5% chance to avoid damage and can be increased till 40% with equipment. These restrictions and starting values mean that there’s no need of acquiring 3 parameters which decrease miss chance because 2 properties of reduction of miss chance will cover from 12% to 15%, which in most cases will be higher than starting 12.5%. Restriction with critical hit chance suppose that on average there’s no need of getting more than 6 properties for increasing critical hit: parameter will be between 36.5% and 48.5%, which is in most cases higher than 40%, so it will be rounded down to 40%. For change of avoid parameter logical maximum is 7 properties. There is no upper limit for increasing damage and maximum damage.
+
 
 +
Goal of the research is to find the best equipment set that maximizes the expected damage.
  
 
=Method=
 
=Method=
Line 33: Line 38:
  
 
=Model=
 
=Model=
 +
Every player has the same starting probabilities of miss, critical hit and chance to avoid damage. They are 12.5% for miss and you can decrease it to 0; 12.5% for critical hit and can be increased till 40%; 5% chance to avoid damage and can be increased till 40% with equipment. These restrictions and starting values mean that there’s no need of acquiring 3 parameters which decrease miss chance because 2 properties of reduction of miss chance will cover from 12% to 15%, which in most cases will be higher than starting 12.5%. Restriction with critical hit chance suppose that on average there’s no need of getting more than 6 properties for increasing critical hit: parameter will be between 36.5% and 48.5%, which is in most cases higher than 40%, so it will be rounded down to 40%. For change of avoid parameter's logical maximum is 7 properties. There is no upper limit for increasing damage and maximum damage.
 +
 +
We are going to simulate full one-day fight of player, equipped with 5 q5 pieces of equipment. 5 pieces of equipment provide 10 properties and restriction for maximum number of some properties were mentioned before (those restrictions do not forbid using higher number of properties, but makes their bonus inefficient). We will use Monte-Carlo simulation in Microsoft Excel with 200 simulations for every possible equipment set (622 combinations). Each one-day full hit simulation requires generation of 185 uniformly distributed random variables: 5 variable for equipment set and 3 variables for every of 60 hits during the day. This means that all simulations require 622x185x200 ~ 23 mil generation of random variables. Simulation took around 50 seconds in Microsoft Excel on the laptop with Intel core i5 laptop.
 +
 +
Minimum number of hits is 150, but chance to avoid damage can is influencing this number. If we acquire maximum probability of avoiding damage (40%) average expected number for hits will be around 250. Game provides players with choice to either hit with 1 hit or do ‘berserk’ of 5 hit at the time. As higher damage in short period of time in the end of the round is required, experienced players hit berserk and, therefore, 150 hits transform into 30 berserks. We give the upper limit of 60 berserks per day to take into account the influence of chance to avoid damage.
 +
Important note is that events of miss, critical hit and avoiding damage are independent, which means that avoid and miss can happen simultaneously (player will just waste the weapons).
 +
 +
Firstly, we should generate all possible equipment sets. Total number of properties should be 10, restrictions for miss, avoid and critical were mentioned before. In my experience, Microsoft Access can be used for quick and easy generation of such table: Cartesian product of the same table 5 times with some additional condition can be formed in one SQL query. For our conditions, 622 different combinations are available.
 +
Algorithm of simulation is next:
 +
*Select equipment set;
 +
*Generate values of equipment properties;
 +
*Calculate player’s parameters;
 +
*Simulate one-day full fight.
 +
 +
This algorithm is repeated for every possible equipment set 200 times – simulation of 124 400 one-day full fights.
 +
  
 
=Results=
 
=Results=

Revision as of 21:23, 14 January 2015

Introduction

E-Sim is free strategic world simulation. It uses the Earth, real-life countries with their current borders as the strategic map. Player can become a citizen of any country available and take an active part in its development. Currently, 58 countries are available in 2 servers ‘primera’ and ‘secura’. New countries are introduced to the game as soon as the significant number of its real-life citizens start playing the game. Czech Republic is represented in the ‘primera’ server only and, unfortunately, is completely conquered by Poland. Slovakia is more lucky – it’s represented only on ‘secura’ server and is currently successfully occupying Austria and Germany. Also, there’s special server ‘suna’ where only Africa is represented and all players are citizens of African countries. Few days ago new server ‘oriental’ was open – Far East countries only. Each country uses their native currency, but also unified currency ‘gold’ is used in the game.

E-Sim has four main modules every player can enjoy:

  • Economic – players can work as an employees, manage companies, become CEO’s of stock companies, trade, import and export goods, exchange currency. Economic module is thoroughly constructed: demand and supply are all natural, admin do not directly interfere with production. Sometimes to balance economy new items of higher quality (therefore more expensive) are introduced, but direct use of so-called ‘buy-bot’ is not used (‘buy-bot’ was widely used in another game with similar concept – eRepublik – surplus was bought and destroyed by admin). Every country have native region with some bonus to the productivity in specific branch;
  • Political – game has 3 kinds of elections: party leader elections, congress elections and presidential elections, where citizens decide who will rule their country. Congress can create new laws: change taxes, declare war or peace treaty, grant citizenship to foreigners, print national currency from gold. On the higher (international) level country representatives communicate with other countries, form alliances to defend themselves;
  • Military – every player is the fighter, who can defend his country, his friends or conquer enemies. Fighters unite into military unit to increase discipline, concentrate their fire and become more powerful as the nation. War is necessary in this game and during 866 days of ‘secura’ server 16110 battles took place (on average 18.6 battles per day; battle consists of 2-hour rounds and it can last from 16 to 30 hours);
  • Media – journalism, newspapers etc. E-Sim has well-developed module for publishing newspapers, which helps another 3 modules. Journalists can gain money if people get interested with their articles and subscribe to their newspapers.

We will focus on the military module and simulate different sets of equipment to maximize damage player can do in one day.

Problem definition

Let’s look closer at the military module of E-Sim. Battle for any region consists of 2-hour rounds. To win the battle one side should win 8 rounds. During the round both sides deal some damage and side with more damage in the end of 2-hour interval wins the round. Here comes the first rule of battle: damage, dealt in the very last minutes of the round is more valuable that in the beginning of the round. On average player can fire all their damage in 1.5-2 minutes, so the last 2 minutes of the round are the most intense. Important detail, which later resulted in the drastic changes of military module, is that the best fighter (with the most damage dealt) of the round (on each of the sides) is winning ‘Battle Hero’ medal and gets paid 5 gold (this sum will later be compared with costs of weapons and to explain strategy of players).

Damage dealt by the individual depends on 2 characteristics: strength and rank. Strength is gain every day during the training so it solely depends on how many days player was actively playing this game. It doesn’t depend on how much money player can afford to spend. Rank is being gained through fighting: it depends only on the cumulated damage player have done during his whole ‘life’. So this characteristic depends how actively player fights and how much money he spends on the weapons. Rank is quantified as some coefficient and multiplied by strength – this forms the basic hit value. Real battle damage will be modified with different bonuses: weapon bonus, military unit order bonus, location bonus. Experienced fighters always try to use all bonuses: they flight to specific region to gain the location bonus, they set military unit order on that battle. The most significant bonus is weapon bonus where most of the money are spent. Game has weapons of 5 quality levels (q1,q2,…,q5 notation; q5 – the best). If you fight without weapons you get -50% of your basic hit, with q1 weapons it’s +20% and with q5 weapons bonus is +100%. Full hit with q1 weapons costs around 7-8 gold, with q5 – 25 gold, average pay from work is 2 gold, so you can imagine how much you should work to fight with q5 – own stocks, companies, trade.

To sum up, players could easily and precisely calculate their damage in the battle. This was comfortable, but some players exploited this in the bad way to get a lot of money so admin was forced to change hit calculation. I would like to explain you how precise calculation of damage was exploited. As I mentioned earlier, in every round ‘Battle Hero’ medal with 5 gold prize is granted for players with the highest damage on each side. If few players (for example 10) get the same highest amount of damage on one side – 10 medals will be granted and everyone of 10 will get 5 gold each. Generally, anyone can take part in battle so competition is too high to make deal with everyone and take ‘group Battle Hero’. But there is very special kind of battle – Civil War – where only citizens of the country involved can fight. This was exploited by one small country (Malaysia, which had the population of about 60 people) – in the chat they were coordinating their damage and a lot of people (up to 10 in one round) got the ‘Battle Hero’ medal and 5 gold. It became a real gold mine for the small group of people. Civil Wars in Malaysia became very frequent and there was no way to stop it.

To destroy this opportunity admin introduced a lot of changes to the military module and made it random: players couldn’t precisely calculate their damage. For example, basic hit of 1000 damage became an uniformly distributed value between 800 and 1200 damage – on the average it was the same, but you couldn’t predict you exact damage.

With randomization of basic hit value, admin also introduced new parameters usually available in MMORPG games: change of miss (zero damage), critical strike (double damage) and chance to avoid damage (deal damage, but does not spend hit). These parameters make hit value even more volatile and unpredictable. To influence these parameters admin created equipment pieces. 5 different slots were available for equipment: body armor, helmet, googles, weapon upgrade and offhand (later this number was increased to 8, but with another properties – economical – so we don’t consider them in damage simulations). There are 5 levels of quality (later level q6 was created, but it’s too expensive and rare to consider in simulation) of equipment, which determine interval in which values of bonuses are determined. Each piece has 2 bonuses, which can be of different kind. There are 7 kinds of military bonuses from equipment. 2 of them are proved to be not very efficient for developed players, so they were removed from the simulation. The rest 5 bonuses and their intervals for q5 items (q5 is the optimal equipment set for developed players) are:

  • Increased damage (4-6%)
  • Increased maximum damage (8-12%)
  • Increased critical chance (4-6%)
  • Reduced miss chance (6-7.5%)
  • Chance to avoid damage (4-6%)

Goal of the research is to find the best equipment set that maximizes the expected damage.

Method

To test what equipment set should perform better Monte-Carlo simulation will be used in MS Excel. Through numerous repetitions of fights in any equipment set possible average result can give an image how player should select equipment set.

Also, expected damage of every equipment set will be calculated and compared with Monte-Carlo simulation result. The last method of this research will be marginal utility approach: how single equipment property on average influences total outcome.

Model

Every player has the same starting probabilities of miss, critical hit and chance to avoid damage. They are 12.5% for miss and you can decrease it to 0; 12.5% for critical hit and can be increased till 40%; 5% chance to avoid damage and can be increased till 40% with equipment. These restrictions and starting values mean that there’s no need of acquiring 3 parameters which decrease miss chance because 2 properties of reduction of miss chance will cover from 12% to 15%, which in most cases will be higher than starting 12.5%. Restriction with critical hit chance suppose that on average there’s no need of getting more than 6 properties for increasing critical hit: parameter will be between 36.5% and 48.5%, which is in most cases higher than 40%, so it will be rounded down to 40%. For change of avoid parameter's logical maximum is 7 properties. There is no upper limit for increasing damage and maximum damage.

We are going to simulate full one-day fight of player, equipped with 5 q5 pieces of equipment. 5 pieces of equipment provide 10 properties and restriction for maximum number of some properties were mentioned before (those restrictions do not forbid using higher number of properties, but makes their bonus inefficient). We will use Monte-Carlo simulation in Microsoft Excel with 200 simulations for every possible equipment set (622 combinations). Each one-day full hit simulation requires generation of 185 uniformly distributed random variables: 5 variable for equipment set and 3 variables for every of 60 hits during the day. This means that all simulations require 622x185x200 ~ 23 mil generation of random variables. Simulation took around 50 seconds in Microsoft Excel on the laptop with Intel core i5 laptop.

Minimum number of hits is 150, but chance to avoid damage can is influencing this number. If we acquire maximum probability of avoiding damage (40%) average expected number for hits will be around 250. Game provides players with choice to either hit with 1 hit or do ‘berserk’ of 5 hit at the time. As higher damage in short period of time in the end of the round is required, experienced players hit berserk and, therefore, 150 hits transform into 30 berserks. We give the upper limit of 60 berserks per day to take into account the influence of chance to avoid damage. Important note is that events of miss, critical hit and avoiding damage are independent, which means that avoid and miss can happen simultaneously (player will just waste the weapons).

Firstly, we should generate all possible equipment sets. Total number of properties should be 10, restrictions for miss, avoid and critical were mentioned before. In my experience, Microsoft Access can be used for quick and easy generation of such table: Cartesian product of the same table 5 times with some additional condition can be formed in one SQL query. For our conditions, 622 different combinations are available. Algorithm of simulation is next:

  • Select equipment set;
  • Generate values of equipment properties;
  • Calculate player’s parameters;
  • Simulate one-day full fight.

This algorithm is repeated for every possible equipment set 200 times – simulation of 124 400 one-day full fights.


Results

Conclusion

Code

Excel simulation file

Report of simulation in pdf and docx.