Dismiss Notice
Wynncraft, the Minecraft MMORPG. Play it now on your Minecraft client at (IP): play.wynncraft.com. No mods required! Click here for more info...

Wynncraft Science: Damage Calculation Uses Floating Point

Discussion in 'Wynncraft' started by hppeng, Jan 9, 2021.

Thread Status:
Not open for further replies.
  1. hppeng

    hppeng 0 intel is the correct amount of intel HERO

    Messages:
    1,244
    Likes Received:
    2,013
    Trophy Points:
    151
    Guild:
    Minecraft:
    Basically, all the integers for enemy HP and player HP are actually floating point numbers behind the scenes.

    Why? idrk

    Damage values and health values are floored (rounded down) before they get displayed to the player.

    Example: Here
    upload_2021-1-9_4-32-45.png
    Combat dummies started at full hp. Front dummy was hit by two war scream hits (2 and 1 damage), but lost 6 hp. Back combat dummy was hit by one war scream hit (2 damage), and lost 4 hp.

    Wait a second.

    Even if we assume the damages were 2.999 and 1.9999, that won't add up to more than 5 damage. The front dummy looks like it took at least 5 damage though (remember, health rounds down so it could be at 499994.9999 health.)

    Fun fact: War scream has 25% air conversion! This means that my war scream is also doing 0-0.75 damage... which is rounded down to zero and never displayed.

    I've done a bunch more experiments and observations (looking at natural hpr, and using a constant damage weapon to hit enemies but dealing different amounts of damage) and the TL;DR is:

    - Health values are floating point (fractional numbers).
    - Weapon base damage values are integers. (This interacts with spell conversion and powder effects in very strange ways, post coming soonTM)
    - After weapon damage (and elemental spell conversion) is calculated, all numbers are floating, but when displayed get rounded down. This leads to weird artifacts such as above, where "invisible damage" happens.

    cheers

    P.S. if anyone wants to help test a wynndata alternative, pm me on forums or reply here, thx
     
  2. Kresan

    Kresan Well-Known Adventurer CHAMPION

    Messages:
    59
    Likes Received:
    49
    Trophy Points:
    49
    Minecraft:
    Some Scooby-doo investigation going on here
     
    Ellphant and MlecznyHuxel99 like this.
  3. ferricles

    ferricles Rhyming is fun HERO

    Messages:
    377
    Likes Received:
    460
    Trophy Points:
    83
    Guild:
    Minecraft:
    Woog big spook
     
    hppeng likes this.
  4. Druser

    Druser ele defs don't matter HERO Featured Wynncraftian

    Messages:
    5,890
    Likes Received:
    11,491
    Trophy Points:
    215
    Guild:
    Minecraft:
    Yeah, since Minecraft stores health as floating point, and Wynncraft basically just repurposes entity health, it makes sense that this works the same way for Wynncraft mob health. Nice post.
     
    fishcute and hppeng like this.
  5. Hallowynn

    Hallowynn Well-Known Adventurer VIP+

    Messages:
    578
    Likes Received:
    463
    Trophy Points:
    83
    Minecraft:
    can't wait. I'm God awful at maths but it's damn interesting and even more interesting when it has to do with video games
     
    hppeng likes this.
Thread Status:
Not open for further replies.