Jump to content


PHP class for WN8 calculation

php wn8 class

  • Please log in to reply
7 replies to this topic

malkowitch #1 Posted 19 August 2015 - 01:15 PM

    Sergeant

  • Player
  • 31413 battles
  • 254
  • Member since:
    02-07-2014

I created a php WN8 calculation class as a learning lesson. It is easy to use and can process account_id as well as a nickname from all of the servers. Sample code is included in README.md

Class it self takes care of API request so basically all you need is application_id for server user is from.

 

Current version: 1.1

License: GNU GPL 3.0

Download: https://github.com/artur-stepien/wot-wn8

 

News

Spoiler

 


Edited by malkowitch, 20 August 2015 - 04:43 PM.


RichardNixon #2 Posted 19 August 2015 - 09:41 PM

    Captain

  • Player
  • 4395 battles
  • 2,351
  • Member since:
    06-26-2013

Note that because of missing tanks and desynchronisation between account/info and account/tanks, you generally want to do a battle count correction like this for WN8-type metrics:

 

In expected values loop, known tanks only:

$atbc += $tank->statistics->battles;

 

After the loop:

$batcorr = $atbc / $average->battles;

$rDAMAGE = $batcorr * $average->damage_dealt / $expDAMAGE;

$rSPOT = $batcorr * $average->spotted / $expSPOT;

$rFRAG = ...

 



malkowitch #3 Posted 19 August 2015 - 09:56 PM

    Sergeant

  • Player
  • 31413 battles
  • 254
  • Member since:
    02-07-2014

If you check WN8 from this class and for example http://wot-life.com you will see that difference is marginal  (+/- 0.5 at most) and most probably caused by rounding techniques. I understand that you say about the average difference caused by missing tanks. I'll investigate it a little more.


Edited by malkowitch, 19 August 2015 - 09:59 PM.


malkowitch #4 Posted 20 August 2015 - 04:50 PM

    Sergeant

  • Player
  • 31413 battles
  • 254
  • Member since:
    02-07-2014
As I see most portals use my method of calculation. So by default I'll leave it as it is. But to be accurate I added new option into WN8 class called $accurate_calculation when this is set to TRUE application will remove stats of missing tanks from account summary so the calculation will be most accurate. As I checked this gives maximum 0.6 point of WN8 change for most users I checked. Also loading of expected tank values has been moved to separate method to allow overriding. From now on you will have the possibility to use own storage method for those values (database, memory cache or what ever you like). This should also open the possibility to auto-update expected tank values table to latest version.

Crimsonic #5 Posted 06 December 2016 - 12:35 AM

    Private

  • Player
  • 21956 battles
  • 4
  • [SLO_A] SLO_A
  • Member since:
    03-26-2011

I have done something to.

https://gist.github....38c628713d7908c


Edited by Crimsonic, 06 December 2016 - 12:38 AM.


malkowitch #6 Posted 06 December 2016 - 12:41 AM

    Sergeant

  • Player
  • 31413 battles
  • 254
  • Member since:
    02-07-2014

View PostCrimsonic, on 06 December 2016 - 12:35 AM, said:

I have done something to.

https://gist.github....38c628713d7908c

 

If you created something please create another thread. Don't spam in others threads.

Lector #7 Posted 06 December 2016 - 11:32 AM

    Second Lieutenant

  • Beta Tester
  • 3728 battles
  • 1,022
  • [22KT] 22KT
  • Member since:
    12-18-2010
And how to calculate WN8 for types of vehicles?

Rastafariman #8 Posted 07 July 2017 - 04:34 AM

    Private

  • Player
  • 7490 battles
  • 6
  • [E-U-F] E-U-F
  • Member since:
    09-25-2012

View PostLector, on 06 December 2016 - 10:32 AM, said:

And how to calculate WN8 for types of vehicles?

 

I would like to know that, too!






Also tagged with php, wn8, class

1 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users