I’ve replaced the pure randomness in Ladon with pseudorandomness. If you’ve played it at all before now, you probably noticed that each time you played (or even just refreshed the page) the rocks were in a different place, the colors changed, and the resources you found were completely different. That’s because I was using plain old
Math.random() to generate everything, which gives random numbers based on some internal system clock. Now, I’ve replaced that with a pseudorandom algorithm.
Pseudorandomness is fascinating to me. It’s the basis of “procedural generation.” The idea is fairly simple – generate your game world randomly, but get the same result every time. This gives you the huge benefit of not having to manually place every object in the game, but guarantees that everyone who plays the game will get the same results when they do the same action. Pure randomness, on the other hand, would mean that every player would get something different. That can be a cool way to do things, but it’s not what I want in Ladon.
The trick to pseudorandom numbers is to use a “seed.” For a given seed, you must get the exact same sequence of pseudorandom numbers every time. So when I randomly generate the rocks and their contents, everyone sees exactly the same results each time. There’s another bonus – if I change the seed, I get a completely new sequence of numbers, meaning a completely different game world. So playing the world generated by seed #5 would be a completely different experience than seed #364253007821, for example, but playing seed #5 is always the same.
Check it out in version 0.3.3.1 on the releases page.