Skip to content

Commit

Permalink
Merge pull request #41 from chescos/cs2-readme-update
Browse files Browse the repository at this point in the history
Update readme for CS2
  • Loading branch information
chescos authored Oct 19, 2023
2 parents 764b026 + 56f0d7f commit 21fa5a4
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CS:GO Fade Percentage Calculator
# CS2 Fade Percentage Calculator

![NPM Version](https://img.shields.io/npm/v/csgo-fade-percentage-calculator)
![NPM Bundle Size](https://img.shields.io/bundlephobia/min/csgo-fade-percentage-calculator?label=size)
Expand All @@ -7,7 +7,7 @@
![GitHub Test Workflow Status](https://img.shields.io/github/actions/workflow/status/chescos/csgo-fade-percentage-calculator/test.yml?branch=master&label=tests)
![GitHub Build Workflow Status](https://img.shields.io/github/actions/workflow/status/chescos/csgo-fade-percentage-calculator/build.yml?branch=master&label=build)

Calculate the Fade percentage value of a CS:GO skin based on a given seed value. Supporting all
Calculate the Fade percentage value of a CS2 skin based on a given seed value. Supporting all
[Fade skins](https://csgoskins.gg/families/fade) (except for gloves),
[Amber Fade skins](https://csgoskins.gg/families/amber-fade), and
[Acid Fade skins](https://csgoskins.gg/families/acid-fade). Easily convert every paint seed (also called pattern index)
Expand Down Expand Up @@ -48,13 +48,13 @@ const supportedWeapons = FadeCalculator.getSupportedWeapons();

## 📜 How It Works

Each CS:GO weapon skin has a random paint seed value between 0 and 1000. This paint seed value, sometimes also
Each CS2 weapon skin has a random paint seed value between 0 and 1000. This paint seed value, sometimes also
called pattern index, determines the positioning of the pattern on the gun. Specifically, the paint seed determines
the X offset, Y offset, and rotation value for the pattern position. Those three values can be calculated using
an algorithm which has been open-sourced by Valve.
an algorithm that has been open-sourced by Valve.

Luckily, most Fade skins have the same X and Y offsets, and only the rotation value changes with each paint seed.
This package simply converts paint seeds to rotation values, and then assigns each rotation value a fade percentage
This package simply converts paint seeds to rotation values and then assigns each rotation value a fade percentage
between 80 and 100, where the best rotation value is a 100% Fade, and the worst rotation value is an 80% Fade.

The whole process just involves simple math, and it is superior to alternative methods such as image pixel color
Expand All @@ -75,11 +75,12 @@ this package:
- [SkinsMonkey](https://skinsmonkey.com/)
- [SkinBid](https://skinbid.com/)
- [BitSkins](https://bitskins.com/)
- [CSGOFloat](https://csgofloat.com/)
- [CSFloat](https://csfloat.com/)
- [GamerPay](https://gamerpay.gg/)

Other sites are currently known to use their own algorithms, probably based on image analysis. These sites come
to different conclusions which paint seed corresponds to which fade value, as pixel color analysis is not
very accurate to determine a fade value:
to different conclusions about which paint seed corresponds to which fade value, as pixel color analysis is not
very accurate for determining a fade value:

- [CS.MONEY](https://cs.money/)
- [BUFF163](https://buff.163.com/)
Expand All @@ -89,7 +90,7 @@ very accurate to determine a fade value:

## 💻 Other Programming Languages

You're not using Node, JavaScript, or TypeScript for your project? We have a
Are you not using Node, JavaScript, or TypeScript for your project? We have a
[pre-generated JSON file](https://raw.githubusercontent.com/chescos/csgo-fade-percentage-calculator/master/generated/fade-percentages.json)
for you that contains the fade percentages of all supported weapons. You can download it with any programming language
into your project to store and process the values there.
Expand All @@ -101,9 +102,9 @@ Alternatively, feel free to check out the source code of this library and port i
### How accurate are the generated fade percentages?

The generated fade percentage values are basically as accurate as they can get. Fade percentages don't really exist
in CS:GO itself, it's a community driven value which has been historically computed through image analysis of
in CS2 itself, it's a community-driven value that has been historically computed through image analysis of
screenshots. However, this method is not very accurate as it depends on many presumptions of the used algorithm.
This library just reverses the algorithm which Valve uses internally to apply the pattern on the weapon, and our only
This library just reverses the algorithm that Valve uses internally to apply the pattern on the weapon, and our only
presumption is a fade percentage range between 80% and 100%, with 80% being the worst and 100% being the best value.

### Why do some websites display different fade percentages?
Expand All @@ -115,12 +116,12 @@ library, creating a stronger consensus.

### Why are gloves not supported?

Glove skins are handled differently in CS:GO. The method used by this library to compute fade values does not work
Glove skins are handled differently in CS2. The method used by this library to compute fade values does not work
for glove skins, because their patterns shift more unpredictably, similar to Case Hardened skins.

## ⭐ Credits

A big thanks goes to [Step7750](https://github.com/Step7750), the work on this library was inspired by
[his research](https://www.reddit.com/r/GlobalOffensiveTrade/comments/b7g538/psa_how_paint_seed_actually_works_technical/)
about CS:GO paint seeds. He also implemented Valve's uniform random number generator
about CS2 paint seeds. He also implemented Valve's uniform random number generator
[in Go](https://github.com/Step7750/UniformRandom), which was ported to TypeScript for this project.

0 comments on commit 21fa5a4

Please sign in to comment.