4 ms·
Working on console games, I got out of the habit of using a random number generator directly for anything. I noticed RNGs producing boring events frequently. In
by dahart 10y ago
Working on console games, I got out of the habit of using a random number generator directly for anything. I noticed RNGs producing boring events frequently. Instead, I started using a random shuffle to guarantee events aren't repeated before all other events have happened, but it still feels random. There were also cases where I thought random would be good at first, and later discovered that I preferred a simple hard-coded pre-set order repeating in a loop... It would feel random and go unnoticed by most players, but being able to see the pattern allows some players to take advantage. Usually I'd use random to avoid that, but occasionally realized it was okay and actually made that moment in the game more fun.
- dspillett 10y ago> Instead, I started using a random shuffle to guarantee events aren't repeated before all other events have happened, but it still feels random. Another option for a similar effect is to keep a counter and compare it to sequences of prime numbers: when the count is a multiple of 23 then X happens, if the count is a multiple of 7 and 11 then Y happens, and so forth. Balanced with enough thought this will ensure that enough happens without it seeming too regular to the player.
- mikeash 10y agoA classic example of this is Tetris, where the official version provides a random permutation of the seven pieces, then another random permutation, etc. This gives you variety and unpredictability while simultaneously guaranteeing that you never go without any particular piece for too long. Many clones just provide pieces purely randomly, which tends to give you a feast or famine situation for useful pieces.