Generating a 'Mystery Laser'
Once you reach a score of at least 50 points in “Space Lasers” you will also earn a Mystery Laser –– a randomly generated NFT laser that is different for everyone. See below for a table of attributes and example metadata for this laser illustrating how each Mystery Laser is made:
In “Space Lasers,” random computation is activated if the “random” key exists in the metadata JSON at top level.
Each attribute under the “random” key defines a parameter that should be randomized, and how to compute the random value. There are two types of calculation: number and list.
For numbers, the metadata defines “min” and “max” values (both inclusive) and a number of digits of “precision.” For a list, a random number is also computed, using “min” and “max”, to decide how many values to take from the list, which is given by the “values” key. Then, the list is mixed up via a deterministic fisher-yates shuffle, and the top values are taken. The list can have values of any kind: strings, integers, etc, etc. If only one number is required from the list, then set min=max=1.
The calculation of a random value is always performed by taking the token ID and doing the modulus of the required range of numbers, and then adding the minimum value. This might lead to not fully uniform values, but it’s an acceptable tradeoff for this application. After each random generation, the token ID (in bytes) is hashed, and the new value is used. To ensure that the random generation is deterministic, the random attributes are alphabetically ordered by their key.
After all the random values are calculated, the “random” key is removed from the JSON metadata, and each computed parameter is added, keyed on the same value that is given as an attribute under the “random” key.
Minting a Mystery laser will result in players generating some incredibly super-powered lasers, and some, not so much.
In the future (once Profiles and NFT Creation are live on the LAMINA1 Hub) we may adjust the game so that every time you beat your high score by some margin, you can unlock a new Mystery Laser that you can then sell, transfer, and/or trade with other players. However, right now, you can only mint one Mystery Laser total.