ruiaraujo012 / fx-clash-stats-web

https://ruiaraujo012.github.io/fx-clash-stats-web/
11 stars 5 forks source link

Calculated team score not matching with in-game score #39

Closed Arc891 closed 1 year ago

Arc891 commented 1 year ago

Prerequisites

Describe the bug The calculated teamscore on the page does not match with the teamscore in-game, even with all the stats of the parts and drivers listed being equal to the ones showed in-game. My guess is that it might be due to calculations of pittimes impact being slightly off? I'm not 100% sure on how the calculation is done exactly, @ruiaraujo012 will probably know this better than me, but to me it seems like it's all stat points combined plus 1 point of teamscore per 0.02-0.0225 seconds of pit time reduced, but please correct me if I'm wrong, this was just me being curious as to how the game calculates this score and how this calculator does it, love the work you put into this!

To Reproduce Steps to reproduce the behavior:

  1. Go to the calculator
  2. Enter your drivers' and parts' stats
  3. Go to the calculator
  4. Team score does not match with in-game score.

Expected behavior My recommended team set-up (Epic Hamilton (4), Epic Norris (4), Wildcore (4), Spectrum (7), The Patron (6), Trailblazer (5), Radiance (8), Avalanche (6)) has a teamscore of 1279 in the calculator, but has a score of 1293 in-game. I have noticed that once I remove my Wildcore from my list of available parts, it replaces the best brakes with my lvl 5 suspense, which now also calculates a higher teamscore (1293 vs previously 1279), but is still slightly off from the in-game 1297.

ruiaraujo012 commented 1 year ago

Thank you for the report, I appreciate that.

I'll check this issue later today.

Arc891 commented 1 year ago

Sounds good, if you need any more info from my end, or need me to try some other combinations of drivers and parts to get some more insight, do let me know!

ruiaraujo012 commented 1 year ago

I confirm your bug. I think that the bug is related to a "magic" value that I came up with that seems working, but apparently not :D

If you are interested, this is the file at line 28.

In the meanwhile, I've found a bug during the tests where the calculator page crashes after changing some asset level, doing a page refresh resolves the crash. #40

Arc891 commented 1 year ago

Ah, had a feeling yeah, haven’t been able to figure the value out myself either haha, if you want I can try to do some calculations and see if I can find it exactly, but it's hard to figure out where the impact gets rounded up or down.

Thanks for the link, had been looking for where you specified it haha 😄

Funny thing you mention it, had this happen to me too when changing my Wildcore level to 0 from 4 and going back to the calculator, had to refresh to get it to work yeah. I'll mention it there as well for clarity's sake.

ruiaraujo012 commented 1 year ago

Ah, had a feeling yeah, haven’t been able to figure the value out myself either haha, if you want I can try to do some calculations and see if I can find it exactly, but it's hard to figure out where the impact gets rounded up or down.

If you don't mind, I'll appreciate your help.

ruiaraujo012 commented 1 year ago

@Arc891 BTW, I found the formula here, but it doesn't seem to be correct either https://docs.google.com/spreadsheets/d/1w8ojG6r77pyLvLzbyoSWAdVIlYCd6BsTB9WiKc1zg54/edit?pli=1#gid=1776989871

Arc891 commented 1 year ago

Yeah I'll take a look at what I can come up with!

Ah yeah I see what you mean, they also use the formula of a point per 0.02 seconds. I'll let you know if I manage to pin point the exact value!

Arc891 commented 1 year ago

I've at least made one discovery just now, the starting value of the team score is different. When I put all my car parts on the stocks, all 4 stats are at 6 points, and the pittime is 6.0 seconds, but this together is worth 30 Teamscore. 4x6=24, so this doesn't add up to 30, meaning there's already 6 teamscore coming from nowhere? Perhaps this is at least one step to coming closer to a correct calculation. Still working on lots of different calculations of pittimes with higher parts atm, I'll list them in a bit, perhaps if I can't make anything of it, you can.

Arc891 commented 1 year ago

Hmmm I'm kinda torn, the game's not working with me here. I've been trying to find a constant by putting my car on stocks, and then switching in 1 part and calculating its pittime factor. For a second I thought I'd found it, I had two parts that gave me the same constant: 21 points for 0.45 and 28 points for 0.60 pittime, both result in 7 points per 0.15 seconds (1 per ~0.0214), but when testing this, this turned out to be off. Then I tried adding all my highest rated parts, and this resulted in an added 139 points for -2.85 pittime, which gave me 1 point per ~0.0205, and with another setup I got 146 points for -3.01, which gives ~0.0206, but these were also was off on some individual part calculations, so I'm really lost atm hahaha. Maybe it's in between these values and something like 1 point per 0.021? Or perhaps the points for pittime system is scaled and there is no linear constant? I'm not sure at the moment, but maybe you can do something with this information :) I'll take another look at it sometime later again in any case

ruiaraujo012 commented 1 year ago

Thank you for your hard work trying to find it. It really helps me out. I'll continue reporting here my findings so you can be aware of them.

ruiaraujo012 commented 1 year ago

Currently, from my tests, this formula is the closest that I've found but has an error of -2 to +5 from my tests.

teamScore += Math.round((6 - pitStopTimeSum) / 0.0205 - (6 - pitStopTimeSum));

Like you said, maybe it isn't linear or we are not seeing some data relationship.

ruiaraujo012 commented 1 year ago

@Arc891 If you want to test some values faster, you can clone this repo and change the formula in this file.

You need to have: Nodejs v18 PNPM v8

Then, just do a pnpm install, followed by pnpm dev

Arc891 commented 1 year ago

Thanks for the updates, looking good! I won't have time this weekend to take a look with you, but afterwards I might be able to take a look with your program myself :)

ruiaraujo012 commented 1 year ago

No pressure, you don't have to, just if you can/want :)

ruiaraujo012 commented 1 year ago

My last thoughts are that the pitstop time affects the Reliability stat. Because if the reliability is lower, the pit stop time takes longer, só, these two might be correlated.

ruiaraujo012 commented 1 year ago

Ok, after talking with people on the Discord server, I'm using the following:

const a = -46.28510327;
const b = 283.2476075;

// f(x) = a*x + b
const pitStopTimeValue = a * pitStopTimeDiffToWorst + b;

teamScore += pitStopTimeValue;

It is not 100% accurate but it will work for now.

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 1.0.3 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

Arc891 commented 1 year ago

Ok, after talking with people on the Discord server, I'm using the following:

const a = -46.28510327;
const b = 283.2476075;

// f(x) = a*x + b
const pitStopTimeValue = a * pitStopTimeDiffToWorst + b;

teamScore += pitStopTimeValue;

It is not 100% accurate but it will work for now.

Wow, that's amazing! Great to hear you've pretty much figured it out! :D

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 1.0.4 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

ruiaraujo012 commented 1 year ago

@Arc891 BTW, if you find any wrong value with a large gap, let me know, please :)