Grid Sage Forums

Grid Sage Forums

  • April 27, 2024, 04:25:28 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

LINKS: Website | Steam | Wiki

Author Topic: [Beta 13] (Spoilers) Momentum melee modifier isn't applied accurately  (Read 76 times)

R-26 Lightspeed

  • Cyborg
  • ***
  • Posts: 245
    • View Profile

As visible in the attached screenshot, i have 3 momentum and am moving at a speed of 22 (454,545454...%), which means my melee modifier should be ((3 * 454 / 1200) * 40) = 45.4%, which caps to 40%, which means this can't be some issue where the value would be 39.99 and then be visually rounded up in Cogmind's stats.
Despite having a 40% melee modifier, my 50-100 melee weapon only goes up to 69-139 instead of 70-140.
Logged

Kyzrati

  • Administrator
  • True Cogmind
  • *****
  • Posts: 4315
    • View Profile
    • Cogmind
Re: [Beta 13] (Spoilers) Momentum melee modifier isn't applied accurately
« Reply #1 on: March 29, 2024, 08:48:38 PM »

Yeah this can happen in some Cogmind combat calculations. It is being applied correctly there, but because it involves decimal math and there is no attempt to ensure that the results of said math don't end up truncated due to, well, computer math, it's possible to lose a 1 in some instances. It is consistent though. The result of 50*1.400000000 is actually not quite 70, and the same formulas are used throughout, so what it shows is what you get (your actual damage range is as displayed).

Personally I would prefer to only use integer math for absolutely everything, and tend to in the vast majority of places, but combat in particular ended up using decimal math for some things early on, and continued that trend rather than try to rewrite it all.
Logged
Josh Ge, Developer - Dev Blog | @GridSageGames | Patreon