Lars
07-13-2012, 09:37 AM
In the past there has been a thorough analysis of the game mechanics for attack and defense. I think most forum old timers know the results well. However, I've seen the same questions posted several times recently. More and more of the older members retire. Thus I decided to post a detailed summary of the old forum wisdom. It became quite lengthy ...
Before I give the proposed formulas I explain the different factors used in them.
Attack and Defense Factors
Equipment Attack and Defense
You bring all your mob members to a fight. However, your mob size is capped by level*5 or 500, whichever is lower (unless you have an event item to modify the effective mob this like the Imperial Katana from the Samurai Chest Event). Each mob member can be equipped with 1 gun, 1 melee weapon, 1 armor, 1 explosive and 1 vehicle. The game chooses the items with the best available attack or defense score (depending on being the attacker or defender). All item scores are added up for the Equipment Attack/Defense. (Again, there are some special event items to increase the Mafia attack introduced recently.)
The Equipment Attack matches "Total Mafia Attack" displayed in the profile page and the attack listed in the attack and robbery result screens. For defense values, things are a bit more complicated, see below.
Displayed Defense Buildings Contribution
The Defense Buildings have a defense value displayed which is also used for the "Total Mafia Defense" displayed on the profile page. Leveling up a defense building increases this value in the same way pay-out for money buildings is increased. (For the gritty details: There are two types of buildings. Type A buildings scales defense by 1, 3, 6, 10, 15, 22, 31, 42, 55, 75 for level 1 to 10 and Type B buildings scale by 1, 2, 3.5, 5.5, 8, 11, 14.5, 18.5, 23. Abandoned Buildings, Bodyguard Agencies and Guard Towers are Type A, the rest are Type B. Increasing a level costs 1.67 times previous build/leveling costs for any building. TrampStamp figured all this out for money buildings, see http://www.funzio.com/forum/showthread.php?13183-Payout-algorithm-explained . I verified it for the defense buildings.) Also, the 10% bonus for tycoon and godfella class is added on top of this.
The total numbers for the buildings by are listed in the Wiki (not fully complete) at
http://crimecityios.wikia.com/wiki/Defense_Buildings
and in the All-in-One spreadsheet by white frog
http://www.funzio.com/forum/showthread.php?32062-quot-All-In-One-quot-4.0-release
You can also use my spreadsheet (which has been later replaced by white frog's for most people)
http://www.funzio.com/forum/showthread.php?23214-Yet-Another-Stats-Spreadsheet-one-for-items-*and*-buildings
However, according to acknowledged forum wisdom these number are *not* used in actual PvP actions.
Effective Defense Building Contribution
The defense you really get is much lower except for level one defense buildings: For each level upgrade, the effective defense only increases by 50% of the base defense (= defense for level one). For example the defense of a bodyguard agency is
Defense Building Level 1 2 3 4 5 6 7 8 9 10
Listed for Non-Tycoon 10 30 60 100 150 220 310 420 550 750
Listed for Tycoon 11 33 66 111 165 243 341 463 605 826
Effective Defense 10 15 20 25 30 35 40 45 50 55
As you can see it the listed defense compared to the effective one is grossly inflated at higher levels. Note that the effective defense for some buildings include .5-fractions. These add up for all defense buildings before rounding is applied to the total. There is no tycoon/goodfella bonus added. For the actual values you can refer to the above mentioned resources (the Wiki and the spreadsheets).
These number were figured out by jlhy and later by peacock. They figured them out shortly after CC introduced the defense goals and PvP result screens. Later CC changed the defense listed in the defense goals to match the profile page. However, the results screens still use this defense.
Early posts on this were:
http://www.funzio.com/forum/showthread.php?15058-Effect-of-Def-buildings-and-skill-points-against-rob-atk-by-Guru-Peacock-again..lol
http://www.funzio.com/forum/showthread.php?16742-Formula-to-cal.-def-values-contributed-by-def-buildings-against-rob-atk-by-peacock
http://www.funzio.com/forum/showthread.php?36507-Defense-Buildings
Attack and Defense Skill Contribution
There is a bigger uncertainty on the working of the skill points than on the previous influence factors. The problem is there is no displayed attack/defense total that includes them. However, the game data (which some of us know how to extract) lists entries named pvp_attack_scale and pvp_defense_scale tabled by player level. We think it is a multiplier to the skill, applied before adding the value to the attack/defense total. TrampStamp came up with a formula to summarize the tabled data. According to this the skill contribution would be
Attack Skill Contribution = MIN(1.09 + 0.09*(Level - 1); 10) * Attack Skill)
Defense Skill Contribution = MIN(1.09 + 0.09*(Level - 1); 10) * Defense Skill)
Again, the spreadsheets can be used to compute them.
Note that CCM has always refused to shed light on the skill effects. He explained Funzio prefers to retain some mystery on certain game mechanics. This did upset some people when main event prizes were adding attack skill points.
Money Building Defense
Higher value money buildings seem to be harder to rob than lower value buildings. This matches a remark from CCM who hinted a long time ago that money buildings feature an inner defense.
Again the game data helps. According to the data money building have a defense ranging from 1 to 108. For a detailed list see
http://www.funzio.com/forum/showthread.php?36507-Defense-Buildings&p=303814#post303814
It is thought this is scaled by the buildings level as the maximum numbers are quite low. Nicholost speculated the defense skill may also be a factor, see
http://www.funzio.com/forum/showthread.php?24065-Defense-buildings-revisited&p=164246#post164246
However, we lack reliable data for checking our suggestions.
Random Factor
Obviously, there is a random factor used in the PvP actions. The effect seems to be relative to the involved attack and defense stats. If I remember right, most people think that a 25% attack value over defense value is just big enough to make your attacks always (or almost always) succeed.
Putting Things Together
First, the attack listed in the profile is only based on the equipment your mob will use when you are an attacker:
Profile Attack = Equipment Attack
For the actual attack your attack skill will have an influence, likely to be added. However, the exact effect is speculative, see above:
Attack for PvP (Attacks & Robberies) = Equipment Attack + Attack Skill Contribution
The defense listed in the profile adds the inflated defense building values:
Profile Defense = Equipment Defense + Displayed Defense Building Contribution
I think the current result screen for attacks and robberies displays Defense vs. Attacks (without skill contribution), see below:
(Current) Result Screen Defense = Defense vs. Attacks without Defense Skill Contribution [not sure here]
CCM wrote that defense from equipment only counts half against robberies while defense building count fully. The forum consensus agrees with this, we just believe that the above mentioned effective defense is used instead of the listed defense. Anyway, this usually makes robberies much easier than attacks. As mentioned above, the money buildings to be robbed seems to have a contributing effect:
Defense vs. Robberies = 1/2 * Equipment Defense + Effective Defense Building Contribution + Money Building Defense + Defense Skill Contribution
CCM insists that both equipment and defense buildings count fully against attacks. Relying on the former robbery result screen (later replaced by a result screen with the same numbers as the attack result screen) peacock and white frog came to the conclusion that the effective defense buildings contribution counts only half, see for example http://www.funzio.com/forum/showthread.php?15038-Building-Defense-vs.-Attack-Defense-by-jlhy-doesn-t-tally-with-fight-screen-results :
Defense vs. Attacks = Equipment Defense + 1/2 * Effective Defense Building Defense + Defense Skill Contribution
Again, the spreadsheets can be used to calculate the numbers. (In the older spreadsheet by me the 0.5 for the defense buildings is not included yet. If I ever update mine, this will be included. The one of white frog uses it already).
Remember, a random factor is also applied for determining the result.
Concluding Remarks
Conflicting statements from CCM
CCM reaction the more elaborate calculations were only short posts saying "the math is wrong". From experience of many forum members here I firmly believe the models are fairly accurate, maybe just slightly off in a few details. As mentioned above he also disagreed on the defense building contribution being cut in half against attacks. Perhaps CCM's own knowlegde on the mechanics is not always fully accurate itself. After following the forums for while that would not surprise me. (E.g. old timers will remember when it took Funzio many months to realize which version of M4A2 was looted all the time by the players.)
Note however, CC never directly stated that the reduced Effective Defense for defense buildings is completely wrong.
Some Speculations
I believe the listed defense of defense building was originally intended to be used. Maybe it was even in effect in the early times of the game. Some people, like Nicholost, supposed that the high defense quickly made some people untouchable. As a result CC could have fixed this by reducing the defense. However, they did not change the displayed values as this would make all the owner of gold defense buildings angry. I recently read a post from dudeman on this. He heard the original maximum number of defense buildings per type was intended to be 5. It ended up as 50, maybe a typo. Anyway, this may be the reason for the unmodified defense from the buildings becoming an game unbalancing factor. See http://www.funzio.com/forum/showthread.php?p=326931#post326931
Side note: cool-down for being "too beat up"
As a side note there was some speculation of the cool-down time for the being too-beat-up. Experiences hinted something like 1h or 2h. I guess the answer is in the game data again: There is a fight_cap_hours entry tabled by level. It is set to 2 for level > 8 (and to 3 for lower levels).
There is also an entry fight_cap_game which looks like the number of lost fights to get 'to beaten up' (10 for level > 45, lower before that) and a fight_cap_battle_list (5 for level > 40, lower before that, maybe a maximum number of successful attackers).
Implications
The main issue is that leveled defense buildings are much less effective than the average player thinks. Basically, their main effect is to scare off unenlightened rivals looking at the profile.
On the other side, defense buildings at level 1 are fully effective (except for the tycoon bonus). As a result most of the enlighted players prefer unleveled defense buildings. Some of them argue for level 2 and 3 buildings where the money/effective gain ratio can still be seen as reasonable. Also, buildings with small space footprint are strongly preferred (MG turrets, Gatling turrets, missile turrets -- depending on your level) since the max defense gain per space unit is rather limited.
On the other hand if you see a rival with many high-level body guard agencies you know his profile defense is strongly inflated.
Before I give the proposed formulas I explain the different factors used in them.
Attack and Defense Factors
Equipment Attack and Defense
You bring all your mob members to a fight. However, your mob size is capped by level*5 or 500, whichever is lower (unless you have an event item to modify the effective mob this like the Imperial Katana from the Samurai Chest Event). Each mob member can be equipped with 1 gun, 1 melee weapon, 1 armor, 1 explosive and 1 vehicle. The game chooses the items with the best available attack or defense score (depending on being the attacker or defender). All item scores are added up for the Equipment Attack/Defense. (Again, there are some special event items to increase the Mafia attack introduced recently.)
The Equipment Attack matches "Total Mafia Attack" displayed in the profile page and the attack listed in the attack and robbery result screens. For defense values, things are a bit more complicated, see below.
Displayed Defense Buildings Contribution
The Defense Buildings have a defense value displayed which is also used for the "Total Mafia Defense" displayed on the profile page. Leveling up a defense building increases this value in the same way pay-out for money buildings is increased. (For the gritty details: There are two types of buildings. Type A buildings scales defense by 1, 3, 6, 10, 15, 22, 31, 42, 55, 75 for level 1 to 10 and Type B buildings scale by 1, 2, 3.5, 5.5, 8, 11, 14.5, 18.5, 23. Abandoned Buildings, Bodyguard Agencies and Guard Towers are Type A, the rest are Type B. Increasing a level costs 1.67 times previous build/leveling costs for any building. TrampStamp figured all this out for money buildings, see http://www.funzio.com/forum/showthread.php?13183-Payout-algorithm-explained . I verified it for the defense buildings.) Also, the 10% bonus for tycoon and godfella class is added on top of this.
The total numbers for the buildings by are listed in the Wiki (not fully complete) at
http://crimecityios.wikia.com/wiki/Defense_Buildings
and in the All-in-One spreadsheet by white frog
http://www.funzio.com/forum/showthread.php?32062-quot-All-In-One-quot-4.0-release
You can also use my spreadsheet (which has been later replaced by white frog's for most people)
http://www.funzio.com/forum/showthread.php?23214-Yet-Another-Stats-Spreadsheet-one-for-items-*and*-buildings
However, according to acknowledged forum wisdom these number are *not* used in actual PvP actions.
Effective Defense Building Contribution
The defense you really get is much lower except for level one defense buildings: For each level upgrade, the effective defense only increases by 50% of the base defense (= defense for level one). For example the defense of a bodyguard agency is
Defense Building Level 1 2 3 4 5 6 7 8 9 10
Listed for Non-Tycoon 10 30 60 100 150 220 310 420 550 750
Listed for Tycoon 11 33 66 111 165 243 341 463 605 826
Effective Defense 10 15 20 25 30 35 40 45 50 55
As you can see it the listed defense compared to the effective one is grossly inflated at higher levels. Note that the effective defense for some buildings include .5-fractions. These add up for all defense buildings before rounding is applied to the total. There is no tycoon/goodfella bonus added. For the actual values you can refer to the above mentioned resources (the Wiki and the spreadsheets).
These number were figured out by jlhy and later by peacock. They figured them out shortly after CC introduced the defense goals and PvP result screens. Later CC changed the defense listed in the defense goals to match the profile page. However, the results screens still use this defense.
Early posts on this were:
http://www.funzio.com/forum/showthread.php?15058-Effect-of-Def-buildings-and-skill-points-against-rob-atk-by-Guru-Peacock-again..lol
http://www.funzio.com/forum/showthread.php?16742-Formula-to-cal.-def-values-contributed-by-def-buildings-against-rob-atk-by-peacock
http://www.funzio.com/forum/showthread.php?36507-Defense-Buildings
Attack and Defense Skill Contribution
There is a bigger uncertainty on the working of the skill points than on the previous influence factors. The problem is there is no displayed attack/defense total that includes them. However, the game data (which some of us know how to extract) lists entries named pvp_attack_scale and pvp_defense_scale tabled by player level. We think it is a multiplier to the skill, applied before adding the value to the attack/defense total. TrampStamp came up with a formula to summarize the tabled data. According to this the skill contribution would be
Attack Skill Contribution = MIN(1.09 + 0.09*(Level - 1); 10) * Attack Skill)
Defense Skill Contribution = MIN(1.09 + 0.09*(Level - 1); 10) * Defense Skill)
Again, the spreadsheets can be used to compute them.
Note that CCM has always refused to shed light on the skill effects. He explained Funzio prefers to retain some mystery on certain game mechanics. This did upset some people when main event prizes were adding attack skill points.
Money Building Defense
Higher value money buildings seem to be harder to rob than lower value buildings. This matches a remark from CCM who hinted a long time ago that money buildings feature an inner defense.
Again the game data helps. According to the data money building have a defense ranging from 1 to 108. For a detailed list see
http://www.funzio.com/forum/showthread.php?36507-Defense-Buildings&p=303814#post303814
It is thought this is scaled by the buildings level as the maximum numbers are quite low. Nicholost speculated the defense skill may also be a factor, see
http://www.funzio.com/forum/showthread.php?24065-Defense-buildings-revisited&p=164246#post164246
However, we lack reliable data for checking our suggestions.
Random Factor
Obviously, there is a random factor used in the PvP actions. The effect seems to be relative to the involved attack and defense stats. If I remember right, most people think that a 25% attack value over defense value is just big enough to make your attacks always (or almost always) succeed.
Putting Things Together
First, the attack listed in the profile is only based on the equipment your mob will use when you are an attacker:
Profile Attack = Equipment Attack
For the actual attack your attack skill will have an influence, likely to be added. However, the exact effect is speculative, see above:
Attack for PvP (Attacks & Robberies) = Equipment Attack + Attack Skill Contribution
The defense listed in the profile adds the inflated defense building values:
Profile Defense = Equipment Defense + Displayed Defense Building Contribution
I think the current result screen for attacks and robberies displays Defense vs. Attacks (without skill contribution), see below:
(Current) Result Screen Defense = Defense vs. Attacks without Defense Skill Contribution [not sure here]
CCM wrote that defense from equipment only counts half against robberies while defense building count fully. The forum consensus agrees with this, we just believe that the above mentioned effective defense is used instead of the listed defense. Anyway, this usually makes robberies much easier than attacks. As mentioned above, the money buildings to be robbed seems to have a contributing effect:
Defense vs. Robberies = 1/2 * Equipment Defense + Effective Defense Building Contribution + Money Building Defense + Defense Skill Contribution
CCM insists that both equipment and defense buildings count fully against attacks. Relying on the former robbery result screen (later replaced by a result screen with the same numbers as the attack result screen) peacock and white frog came to the conclusion that the effective defense buildings contribution counts only half, see for example http://www.funzio.com/forum/showthread.php?15038-Building-Defense-vs.-Attack-Defense-by-jlhy-doesn-t-tally-with-fight-screen-results :
Defense vs. Attacks = Equipment Defense + 1/2 * Effective Defense Building Defense + Defense Skill Contribution
Again, the spreadsheets can be used to calculate the numbers. (In the older spreadsheet by me the 0.5 for the defense buildings is not included yet. If I ever update mine, this will be included. The one of white frog uses it already).
Remember, a random factor is also applied for determining the result.
Concluding Remarks
Conflicting statements from CCM
CCM reaction the more elaborate calculations were only short posts saying "the math is wrong". From experience of many forum members here I firmly believe the models are fairly accurate, maybe just slightly off in a few details. As mentioned above he also disagreed on the defense building contribution being cut in half against attacks. Perhaps CCM's own knowlegde on the mechanics is not always fully accurate itself. After following the forums for while that would not surprise me. (E.g. old timers will remember when it took Funzio many months to realize which version of M4A2 was looted all the time by the players.)
Note however, CC never directly stated that the reduced Effective Defense for defense buildings is completely wrong.
Some Speculations
I believe the listed defense of defense building was originally intended to be used. Maybe it was even in effect in the early times of the game. Some people, like Nicholost, supposed that the high defense quickly made some people untouchable. As a result CC could have fixed this by reducing the defense. However, they did not change the displayed values as this would make all the owner of gold defense buildings angry. I recently read a post from dudeman on this. He heard the original maximum number of defense buildings per type was intended to be 5. It ended up as 50, maybe a typo. Anyway, this may be the reason for the unmodified defense from the buildings becoming an game unbalancing factor. See http://www.funzio.com/forum/showthread.php?p=326931#post326931
Side note: cool-down for being "too beat up"
As a side note there was some speculation of the cool-down time for the being too-beat-up. Experiences hinted something like 1h or 2h. I guess the answer is in the game data again: There is a fight_cap_hours entry tabled by level. It is set to 2 for level > 8 (and to 3 for lower levels).
There is also an entry fight_cap_game which looks like the number of lost fights to get 'to beaten up' (10 for level > 45, lower before that) and a fight_cap_battle_list (5 for level > 40, lower before that, maybe a maximum number of successful attackers).
Implications
The main issue is that leveled defense buildings are much less effective than the average player thinks. Basically, their main effect is to scare off unenlightened rivals looking at the profile.
On the other side, defense buildings at level 1 are fully effective (except for the tycoon bonus). As a result most of the enlighted players prefer unleveled defense buildings. Some of them argue for level 2 and 3 buildings where the money/effective gain ratio can still be seen as reasonable. Also, buildings with small space footprint are strongly preferred (MG turrets, Gatling turrets, missile turrets -- depending on your level) since the max defense gain per space unit is rather limited.
On the other hand if you see a rival with many high-level body guard agencies you know his profile defense is strongly inflated.