On the Shared Randomness of Salt

8:05 PM John Gamble 0 Comments

Hello everyone. I am John Gamble, and I wrote the code that generates the world of Salt. I thought I would take a moment and explain a bit about how the world is generated. This will not be a very technical article. Sometime in the future, I plan to create a different blog that focuses more on that. Here, I would like to give you some basic insight into how the world is generated, and how you can pull a sense of community out of a random world.



There are two types of randomness in Salt, and there is a good mix of both throughout the world. I'll explain the difference.

The first type, what I always refer to in my head as static random, are elements in the game that will be the same every time you quit your game and come back. These include things such as the shape of the island you are on, the location of the pirate camps, and even where the pickaxe is hidden in the grass on the the starting island (oh, you didn't find that yet?). These will always be the same for a single game. That is why when you quit the game, and come back later, you are standing on the same island. The game didn't save the shape of the island you were on when you quit. Instead, it regenerated it exactly the same as before.

The second type, which I refer to in my head as non-static random, are elements which are not set in stone when you create a new game. This type of randomness is used to determine if a log spawns as normal or hardwood. It is also used to determine what loot a particular deer or pirate drops when you kill it. This is the type of randomness that you are likely most familiar with.

When you start a new game, you have the ability to choose a custom seed for the world. I have made this seed to be a sequence of letters you can type in. This seed determines everything that is statically random in the world. This includes where islands are located, their shape, type, and what trees are on it. It also influences deer population, ruins, pirates, how many of each, where they spawn, and tons more. The cool thing about the seed is that the same one always generates the statically random elements exactly the same. So, if you are playing in a world with the same seed as your buddy, you can tell him about where you found that merchant or epic sword just laying on the ground, and he will actually care because he can find it in his game too.

One thing that I did very intentionally was to create a default seed. If you fast-click it through the new game interface, without specifying custom options, your game will use the default seed. Salt is a practically infinite ocean of randomly generated islands, but the comforting effect of the default seed is that most people will be playing in the same world. I say comforting because I feel it brings a sense of community to the vast, lonely sea. When you stand on the top of a high cliff overlooking the expanse of trees and ocean below, you can think, "I wonder how many people have been here before?" This is a question that wouldn't have much meaning if you knew that your world was unique to everyone else's.

I experienced the effects of this first hand while watching someone stream Salt. They had found a large island with a very distinct shape. I took specific note of it because it was one of the coolest looking Islands I had seen (and I see them every day). He searched the island very thoroughly, but based on some clues that I saw, I knew there was something he had missed. Later, while testing a new boat, I happened upon the island with the distinct shape that I recognized from his stream. I hopped off my boat and conducted my own search until I found what it was that he had missed. It was a memorable experience that would not have happened if we had been playing in differently generated worlds.

In short, the intent of the default seed is to produce common ground to provide better foundation for community. We want to create adventure, and a sense of community makes the adventure all the greater.


- John Gamble, Lead Developer






0 comments: