But is my math statement on the Plants vs. Zombies wiki mathematically correct?

140 Views Asked by At


$$2/28/23$$



Back when I was more into researching mathematical analysis of video games, I came across this guide for modding PvZ$2$ which gave a link to this spreadsheet. So I made a copy (mainly because I wanted to see how plant leveling worked), and I'm unable to find how plant levels work, but I do see this statement when I hover over "Zombie Level" in the Settings sheet:

Stat Scaling is edited under ScaledProps in Zombie Properties.

$\color{white}{\text{.}}$

This can affect the HP, eatDPS and speed of a zombie.

$\color{white}{\text{.}}$

Stat multiplier formula:

$\operatorname{arg1}^{(\text{level}-1)}+\operatorname{arg2}\cdot(\text{level}-1)$

$\color{white}{\text{.}}$

Vanilla uses:

$\operatorname{arg1}=1.3$

$\operatorname{arg2}=0.05$

for all zombie's HP and eatDPS.



Screenshot for reference



Now here's the thing: I managed to find this statement as being correct and posted it on the PvZ$2$ wiki:

Fun fact: If you hack PvZ$2$ and set the level to $-4.16218$, the smallest amount of time that it would take something to recharge (calculated by min. base recharge time) would be approx. $4.2$ months (from $5$ seconds base recharge time) and the largest amount of time would be almost $6$ years (~$5.9$ years from $85$ seconds base recharge time)

enter image description here



How my thought process probably went



  1. Take the formula.
  2. Plug in $-4.16218$ for the level.
  3. Take the reciprocal.
  4. Multiply by the recharge time.
  5. Take the reciprocal.
  6. Convert what you got from seconds to whatever


Now here's the thing. While this should help with calculating recharge time, it doesn't help with plant damage/plant health.

(I think I was ironically wanting just the recharge, and I say ironically because it's kind of ironic because I originally wanted to get the formula for calculating plant damage and plant health, not recharge time)



$$5/23/23$$



I went onto the PvZ$2$ Fandom and tried replicating what I had done, but I was unable to replicate the formula any way I could. I eventually decided to do$$a(1.3^{b-1}+0.05^{b-1})^{-1}$$where $a$ is the recharge time and $b$ is the level number, which I'm pretty sure it represents actual recharge times accurately, although not $100$%.



This is the table of level to length of recharge time compared to what I said on how much I was off by:

Level Length of recharge time (actual) Length of recharge time (what I said) How much I was off
$-4.16218$ ($5$ sec recharge time) $18.06230212933333$ hours $4.2$ months $4.17525714749$ months
$-4.16218$ ($85$ sec recharge time) $14.02049553196347$ years $6$ years $8.02049553196347$ years


Therefore, my statement on the Plants vs. Zombies $2$ wiki is mathematically incorrect, and it is not only a lie, but a huge lie in that matter.



My question



Is my new statement correct, or what would be the correct statement in this case?



Mistakes I might have made



  1. pretty much everything honestly, there's no actual way to calculate this type of stuff so I honestly don't know if I have done anything wrong or not.
1

There are 1 best solutions below

0
On BEST ANSWER

Okay, so it turns out I am, in fact, wrong.

As @Jaap Scherphuis pointed out, I used $0.05^{b-1}$ instead of $0.05\times(b-1)$

In the first part you use $0.05\times(b-1)$, in the second part $0.05^{b-1}$. Which one is correct?

It gets worse from here. Using this formula to recalculate my data, it turns out that I was incorrect for both calculations, meaning that originally I was correct.

New table:

Level Length of recharge time (actual) Length of recharge time (what I said) How much I was off
$-4.16218$ ($5$ sec recharge time) $\require{cancel}\cancel{18.06230212933333\text{ hours}}$ $4.2$ months $4.2$ months $\cancel{4.17525714749\text{ months}}$
$-4.16218$ ($85$ sec recharge time) $\cancel{14.02049553196347\text{ years}}$ $6$ years $6$ years $\cancel{8.02049553196347\text{ years}}$

$\small\small\small\small\small\text{I'm horrible when it comes to solving for unknown variables am I}$ :\