Quality is rolled at the *start* of crafting, while probabilistic output (like U-238 / U-235 / recycling bioflux) are rolled at the *end* of crafting.
One global RNG instance is shared by at least the following things:
- Quality roll
- Probabilistic output roll
- Asteroid generation, which rolls every tick
- Turret shooting
- Enemy AI
- Some mining activity, maybe the resource consumption reduction of big mining drill
- Some asteroid collection activity?
- Random mode of selection combinator (each has its own private RNG instance)
Code: Select all
uint32_t getInt(uint32_t *state){
uint32_t uVar1;
uint32_t uVar2;
uint32_t uVar3;
uVar3 = *state;
uVar1 = (uVar3 << 13 ^ uVar3) >> 19 ^ (uVar3 & 0xffffe) << 12;
uVar3 = state[1];
*state = uVar1;
uVar2 = (uVar3 * 4 ^ uVar3) >> 25 ^ (uVar3 & 0xffffff8) << 4;
state[1] = uVar2;
uVar3 = state[2];
uVar3 = (uVar3 * 8 ^ uVar3) >> 11 ^ (uVar3 & 0x7ff0) << 17;
state[2] = uVar3;
return uVar1 ^ uVar2 ^ uVar3;
}
Quality roll logic: roll once p=getInt()/4294967296, if p<quality_percent, bump one level, if p<quality_percent*10%, bump another, continue until highest researched quality is reached or test failed. I haven't reverse-engineered the production roll logic yet.
This enables a few building blocks:
- Probe RNG state with quality / probabilistic production.
- Consume RNG rolls with cheap with-quality production or circuited turrets shooting at something.
There are several possible directions:
Expensive semi-auto quality scumming. Say you have ~2k cryogenic plants making expensive stuff like fusion generator from common materials + 96 recyclers leaking RNG state. Start all recyclers on the same tick, then start all cryogenic plants on the exact tick the recyclers will create output. Then you can predict the quality rolls of each plant with combinators from the recylcer results and only enable those producing legendary ones. After you get the legendary products though, you'll have to clean up by manually deconstructing / reconstructing everything and start over.
Math stuff. The RNG quality is not very good and exhibits significant auto-correlation. But I haven't found a way to exploit such correlation reliably in-game yet.
Speedrun-only option: if you have no space platform moving / collecting asteroids, have no random crafting / big-drill mining and somehow kill all enemies within active chunks, you have total control over the RNG for like one minute before biters roll their expansion, during which you can guarantee a bunch of quality stuff from common materials.