PDA

View Full Version : CC Stat Calculator



Nicholost
03-09-2012, 12:31 AM
I wrote something kinda fun tonight in a language I haven't written in in years; VBA. Let me tell you, I don't miss it at all. Crappy language, even worse IDE (Visual Basic), and it's poo poo using Excel as a database, but whatever. Anyway, you enter all your quantities for each weapon into a new column on the Items tab of Tramp Stamp's Money Buildings spreadsheet. Then enter in your level and mafia numbers, and click Calculate. It then runs a bunch of calculations and shows a breakdown of the attack and defense stats that each group of items provides. Kinda cool, kinda useful... kinda buggy, ATM. The stats from my calculations are quite different than what the game displays, but this was literally the first run of this code, so there's a good chance I still have bugs. In fact, it's likely. But it's really late and I have a day of meaningful code to write tomorrow, so I'll play with it this weekend if I get a chance. Check it out:

http://i66.photobucket.com/albums/h257/nicklepics/nothing%20of%20use/CrimeCity/FirstRunStats.jpg
BTW, the calc fills in values in columns D & E. Columns B & C are just standard, OOTB Excel functions.

The next phase is for it to tell me where my cutoff weapon is for each group and how many I'm using (e.g. 3 out of 12 Pocket Knives for melee attack)

Also, does anyone know if the game chooses weapons for attack and defense stats based on their accumulative att and def or individual att and def? What I mean by that is when the game calculates attack, and it transverses the sorted list adding each item's stats, does it sort by just attack or the sum of the item's att and defense? In other words, does it place the Sawn-Off Shotgun (22/14) over the M4 A1 (20/22) because 22 > 20, or the other way around because 36 < 42?

Oh, and to show how far the stats are off right now, here's a comparison of my current game stats (3 M4A1s richer than the above screen shot) compared to the calculator's stats:
Attack
Game: 12354
Calc: 13226

Defense
Game: 14308
Calc: 15027

I've counted my entered inventory twice and the quantities for each item I own look good, so it's a math bug on someone's end; theirs or mine.

Swifty
03-09-2012, 01:16 AM
Nicholost, thanks for your analysis.

I have a math question. Since the last fiasco, I have been tracking the change in attack/defense scores after each weapon add. I am getting some strange (to me) results.

For example, the last four M4A1 adds are:

+10 attack +15 defense
+13 attack +15 defense
+10 attack +15 defense
+11 attack +15 defense

Shouldn't the attack add either stay the same (if it replaces the same weapon as last add) or decrease (if it replaces a better weapon)?

Whip88
03-09-2012, 01:33 AM
I know it's early days but I think nicohlost is the new crime boss

All in favour?

Bruiser
03-09-2012, 01:37 AM
Nicholost, thanks for your analysis.

I have a math question. Since the last fiasco, I have been tracking the change in attack/defense scores after each weapon add. I am getting some strange (to me) results.

For example, the last four M4A1 adds are:

+10 attack +15 defense
+13 attack +15 defense
+10 attack +15 defense
+11 attack +15 defense

Shouldn't the attack add either stay the same (if it replaces the same weapon as last add) or decrease (if it replaces a better weapon)?

It may be possible you acquired through PvP or other means new weapons that replaced what you thought were losing whilst farming each M4A1...

omnus
03-09-2012, 04:26 AM
For what I have noticed, it picks the higher attack value item when attacking and higher defense value item for defending. It is by the individual item value, not cumulative value. ie. rpg>sawnoff>M4A1 at least in the order chosen no matter how many is held.

Max Power
03-09-2012, 04:39 AM
It may be possible you acquired through PvP or other means new weapons that replaced what you thought were losing whilst farming each M4A1...

That's a plausible explanation, I think. Other than that, I got nothing. I have never seen that.

Swifty
03-09-2012, 05:24 AM
I paid close attention, there were no other weapon adds from pvp or purchase during the time frame of the 4 M4A1 adds.

qwikster
03-09-2012, 05:29 AM
It may be possible you acquired through PvP or other means new weapons that replaced what you thought were losing whilst farming each M4A1...

... or loss of attack explosives in between M4A1 farming.

Swifty
03-09-2012, 06:27 AM
I wrote down the number of M4A1s and the attack/defense numbers immediately before and after each M4A1 add, but I did not verify that the explosive numbers had not changed. I will start doing that.

Maybe the Absinthe blurred my vision just enough so that I misread the numbers.

But right now I am leaning toward it being a small perturbation in the space-time continuum.

Ramshutu
03-09-2012, 06:33 AM
I have a spreadsheet that lets you work out the current cut off for all item types...

Also, I have a spreadsheet that shows you the benefits of long term usage of RP (effective RP per atk/def)

Holicaholic
03-09-2012, 07:41 AM
The attack and defense stats are calculated independently of each other.

Let's say you have 500 M4A1s (20/22) and 500 RPGs (36/14) and can use 500 mafia members. When YOU attack someone your attack score will be 18,000 in the guns category from the RPGs, but if someone else attacks you then your defense score will be 11,000 in the gun category from the M4A1s.

Nicholost
03-09-2012, 08:14 AM
... or loss of attack explosives in between M4A1 farming.
Swifty, I have no idea what's going on there, but this is the best answer, IMO. Those are weird results.


I know it's early days but I think nicohlost is the new crime boss

All in favour?
Natas, thanks for your flattery, but if you are suggesting that I can in some way fill the TS shoes, I'm just going to disappoint. TS has an amazing ability for analysis and developing new ideas. I fall flat on my face there, but tend to be pretty good at problem solving and coming up with solutions based on someone else's analysis. There's no way I can even come close to providing this forum with what TS has, even on one of my rare smart days. Cheers though.

Omnus and Holicaholic, I thought that was how stats are computed, but it's nice to have it confirmed. That helps a lot when I dive into debugging. Thank you both.

Ramshutu, that's sounds rad. My next phase is what you've already done. Did you have to write any custom macros/functions to calculate the last item used or were you able to make it work with functions?

Nicholost
03-18-2012, 04:24 PM
So I've been messing with this more today and I cannot for the life of me get my numbers to match Crime City's. My calculator provides results that are significantly lower than what is displayed by the CC app. To do all these calculations by hand is a substantial task - hence the reason I wrote software to do it for me - but what I have unit-tested (calculated by hand) and my manual calculations match the results from my calculator, but not the game's. What the heck???

Here's a screenshot showing my calculator's results compared against my game's display stats.
http://i66.photobucket.com/albums/h257/nicklepics/nothing%20of%20use/CrimeCity/AuditStats.jpg

I can see how a difference in defense numbers could exist because of the actual vs. displayed building defense thing, but not attack. So I audited gun attack and did the calculations by hand. Using 280 mafia, I got 5731. I then ran my calculator and got 5731. So we'll assume my calculator can perform attack calculations correctly. However, the sum of my attack calculations is 12603 whereas the game displays 13366, even on the fight results screen. I know my inventory count for guns, melee, and armor is correct because those match my game totals (GameArmorNum = SpreadsheetArmorNum and GameWeaponNum = SpreadsheetGunNum + SpreadsheetMeleeNum). So I'm at a loss here and open to suggestions. Is there anything else in my inventory that would increase my attack stats (skill points maybe)? Are henchmen factored into the 280 mafia count or are they added to my mafia count (i.e. 280 mafia and 60 henchmen would create a mob of 340)?

If someone who's keen on VB classic or VBA wants to take a peek, I'd be happy to send this their way for peer review.

Lars
03-18-2012, 04:44 PM
Hi Nicholost,
I have the same problem: A/D displayed in game is a bit higher than my spreadsheet results (no VBA, just Excel with heavy use of referencing functions). Failed find an error in the sheets so far.

white frog
03-18-2012, 05:08 PM
Henchmen are included in your total mob number. Also, your stat points are calculated separately on the attack screen.
Send it to me if you want and I'll take a look. My guess is that's it's not your error, it's Funzio's!

Nicholost
03-18-2012, 06:21 PM
Hi Nicholost,
I have the same problem: A/D displayed in game is a bit higher than my spreadsheet results (no VBA, just Excel with heavy use of referencing functions). Failed find an error in the sheets so far.
I'm glad I'm not alone. What kind of differences are you seeing between game stats and calculated stats? Is the difference constant between levels and/or inventory changes (i.e. always the same difference or percentage difference)? Would you mind posting your numbers; game and calculated?

BTW, props to you for calculating that with OOTB Excel functions, if that's what you did. I honestly felt that writing some subroutines was the easy way out by comparison. :p


Henchmen are included in your total mob number.
Thought so, but gotta ask since my calculated values are less than game values.


Send it to me if you want and I'll take a look. My guess is that's it's not your error, it's Funzio's!
I actually hope it isn't their error. The whole point in going through this exercise is to provide a way to identify weaknesses in inventory without a lot of manual work. If there's still some magic buried in their calculation logic, it makes it difficult to trust the accuracy of what I wrote.

PM headed your way, white frog.

Aid
03-18-2012, 06:27 PM
Wouldn't skill points perhaps cause this as you mentioned earlier? There is a post somewhere in which someone figured out what they believe is the calculation fo rx kill points, and I think it was based on level, looking for post

Nicholost
03-18-2012, 06:32 PM
Wouldn't skill points perhaps cause this as you mentioned earlier? There is a post somewhere in which someone figured out what they believe is the calculation fo rx kill points, and I think it was based on level, looking for post

Yeah, it's 1.09 + 0.09 * (lvl - 1) or something like that. I may be off by a factor on the multiplier. Anyway, my understanding is that value is added to the att/def at the time of attacking/robbing/defending. Am I right???

Also, why not just write it as "1.0 + 0.09 * lvl"? It's the same thing, but much simpler.

Aid
03-18-2012, 06:46 PM
From what I can find you are correct, at level 100 it is 10 attack or defense per skill point (again from the posts I found), and what you have done is pretty slick

Nicholost
03-18-2012, 08:05 PM
...what you have done is pretty slick
Thanks. It'd be cooler if it worked. http://i66.photobucket.com/albums/h257/nicklepics/nothing%20of%20use/Emoticons/nonod.gif

Dreno33
03-18-2012, 09:17 PM
defense buildings have not been added to the calculator yet have they?

Nicholost
03-18-2012, 09:40 PM
defense buildings have not been added to the calculator yet have they?

No, and they won't be. One of the goals of this project is to find the item-only defense score, since that value is so muddy because of all the defense building BS.

Dreno33
03-18-2012, 09:49 PM
No, and they won't be. One of the goals of this project is to find the item-only defense score, since that value is so muddy because of all the defense building BS.

exactly, that is what I'm saying. wouldn't that be the reason in why the funzio's # is higher??

I do NOT know how to work the magic you do on this calculating stuff, but if you were to add the effects of defense building in a separate column, one could simply just subtract that number off it to get the result needed, no? Therefore, you get the same # as Funzio so it is known to be accurate without flaws

Kataya
03-18-2012, 10:18 PM
I know it's early days but I think nicohlost is the new crime boss

All in favour? I 2nd that! Thanks for your help!

white frog
03-19-2012, 06:37 AM
There is a simple miscalculation in your workbook. The total calculated for attack doesn't include your explosives, which brings the difference in your #'s and the games #'s to 3, which is very consistent with my own workbook in which I input everything manually on 3 different pages to compare (triple checking myself). In my own workbook, there is a difference of 2. I think this is about the closest you'll get!

Swifty
03-19-2012, 11:47 AM
I am still getting some funky numbers.

The latest oddity is that when I pvp looted an Armored Police Truck, it incremented -2 attack.

I keep track of everything now and there were no other changes in gear (including explosives). Re-launching the app made no difference.

The only thing I can think of is that Funzio's faulty algorithm swapped it in for a vehicle with a higher attack (e.g., Mustang).

Santa
03-19-2012, 12:25 PM
Is there any way you could make this calculator public? Or could you send me a version?

I'm horrible at programming and all that jazz, and it really helps to have someone else do the work to avoid any careless mistakes.

Nicholost
03-19-2012, 12:43 PM
Is there any way you could make this calculator public? Or could you send me a version?

If you guys find a place to host it, I'll get it ready for public use. I have a lot of hard-coded cell references, ugly commented code and debug lines, and no error handling, and that will all need to be cleaned up before it can be used publicly.

There is one condition though: I do not want to continuously update the item list, nor do I want to be burdened with maintenance or sustainment after go-live. As a developer, I know firsthand that you can spend more time maintaining software than writing it. If this ever makes it public, it will be a "use at your own risk" kind of deal. If bugs are found or if relatively lightweight enhancement suggestions are put forth, I'll include them, but I do not want to be put in a position where I leave work to come home and tweak this daily... or even weekly. If everyone is cool with that, I will try to get it prepped for public use in the next few days.

Also, give a big hand to white frog for integration-testing this and catching the stat discrepancy bug. The dude nailed it. http://i66.photobucket.com/albums/h257/nicklepics/nothing%20of%20use/Emoticons/thumbsup.gif

Santa
03-19-2012, 12:50 PM
If you guys find a place to host it, I'll get it ready for public use. I have a lot of hard-coded cell references, ugly commented code and debug lines, and no error handling, and that will all need to be cleaned up before it can be used publicly.

There is one condition though: I do not want to continuously update the item list, nor do I want to be burdened with maintenance or sustainment after go-live. As a developer, I know firsthand that you can spend more time maintaining software than writing it. If this ever makes it public, it will be a "use at your own risk" kind of deal. If bugs are found or if relatively lightweight enhancement suggestions are put forth, I'll include them, but I do not want to be put in a position where I leave work to come home and tweak this daily... or even weekly. If everyone is cool with that, I will try to get it prepped for public use in the next few days.

Also, give a big hand to white frog for integration-testing this and catching the stat discrepancy bug. The dude nailed it. http://i66.photobucket.com/albums/h257/nicklepics/nothing%20of%20use/Emoticons/thumbsup.gif

Thank you heaps! You and white frog are definitely the CC gurus of his forum generation.

Dreno33
03-19-2012, 01:00 PM
someone else mentioned the explosives to u as well. i thought u had lardy added that into your calc? no? i thought of that too when reading this but could've sworn someone brought that up. will have to look back to page 2. somewhere in here I'm sure

Lars
03-20-2012, 01:44 AM
If you guys find a place to host it, I'll get it ready for public use.

I also worked for quite some time on an Excel sheet for calculating stats from equipment now. (It also consideres defense buildings and computes D vals for the result screens). I am just finished cleaning it up and adding some comments. Any ideas on how to publish it? Google docs doesn't work since it relies too much on Excel-specific features (no VBA, though).

PS: Nicholost, would be great to see your approach. Could learn a bit of VBA, I guess.