This is the first of a few posts that go back to where things started, and put the very first version of something next to what it is today. And the very first stepping stone was the island.
I had built a few games before, and they all drifted off what I imagined until they felt soulless. So this time I wanted to start super simple. No goals, no interaction, just a low-poly landscape made from a seed: coast, rocks, beaches, plains, forests, maybe little mountains. Extremely cozy and cute, with a miniature lens that blurs the background.
The first island
The first version was exactly that: an island to look at and fly around, nothing else. A highland side with cliffs and sea stacks, a lowland side with beaches, a little mountain range, meadows and woods. The cliffs on one side and none on the other were there to give it some variety right from the start. Keep that one in mind, it comes back.


Same name, completely different island. Every time the generator changed how it makes an island, the name came out as a new one.
They all looked the same
A few days in, the problem was obvious: almost all islands looked more or less the same, with minimal differences. Here are the first version's five test islands, and the same five names today, all drawn to one scale:
So islands got shapes: round, long, a crescent around a bay, two lobes joined by a neck, or a group of islands joined by sand causeways. Each one flat, mixed or mountainous, any shape with any relief, so fifteen kinds.
And they got bigger. As big as possible, honestly, so why not 512 tiles a side? Today every island is somewhere between 400 and 512 tiles a side, a round one on the smaller end, a long one or a group on the bigger. That 512 came at a price though, more on that below.
The coast follows its shape
Remember the cliff side? With all the new shapes it looked off: still strictly one side cliff, the other beach. Which is not really how coasts work.
So now the coast follows its own shape. For every stretch of coast the game looks at how much of the ground around it is sea. A headland sticking out into the sea is exposed, so it gets cliffs with sea stacks off them, and the bays and coves in between fill up with sand.


Cold, temperate, warm
Different shapes, but still the same green everywhere. So islands got climates: cold ones have way more needle trees, warm ones have palms, and temperate ones a little of both. Cold ones get long, snowy winters and icebergs in the sea, and the grass turns darker on cold islands and warmer on warm ones.
And no island has everything. Heath for honey, conifers for tar, salt marsh for salt and pasture hills for wool: every island lacks one or two of these four grounds, and what grows there has to come in by ship.
And a desert
The newest one isn't a home island at all. Later in the game you'll sail to far islands, and I wanted some of them to be Egypt-like: sand, rock and pyramids. So the generator has to make those too, and the desert went first.
It had its dead ends. The rock pinnacles were first stacked from the same lumps as the sea stacks, and on the thinner ones you could see daylight between them. The salt pans came out in blocks along the grid, nothing like the loose, imperfect shapes real ones have. And the pyramids looked way too clean, perfect and undamaged for something thousands of years old.
The price of 512
Remember the 512? At 512 tiles a side, making one island took 20 to 46 seconds. Ouch.
One of the slow parts was spreading the lost places, the ruins, old huts and so on, over the island. They go down one at a time, each where it's worth the most, and in every round the game valued every candidate spot again. But a spot's value only ever falls as places are added around it. So now the spots wait in a heap under the value they had last time, and only the one on top gets valued again. If it's still on top, it's taken. Same places, same order, a fraction of the work. (That trick is called lazy greedy.) With that and a few more fixes, an island of 512 came down to about two and a half seconds, and every island still came out the same to the bit.
That "same to the bit" matters more than it sounds. A save in Little Shores isn't a snapshot of the island, it's the seed plus everything the player did, played again. So the island has to come out exactly the same in every browser. But Math.sin and friends don't: Chrome, Firefox and Safari differ in the last bit for eight of the nine maths functions the game uses. So the game brings its own, line for line from fdlibm, the library Chrome's and Firefox's are built from.
And then the funny part. Writing the game's own maths showed how often it's called: an island of 512 makes 56 million hypots and 10 million each of sines and cosines, mostly of the same angle over and over. So sin and cos now remember their last angle, and islands grow 3 to 4% faster. Speed wasn't even the goal.
Then and now, the five test islands measured on my Mac today:
| First version | Today | |
|---|---|---|
| Tiles a side | 192 | 400 to 512 |
| Kinds | 1 | 15, plus arid |
| Lines of code | 782 | 13,955 |
| Making one | 0.18 s | 1.5 to 2.2 s |
Four to seven times the land, doing a LOT more, in about ten times the time.
What's next
Next in this series: the first village. A town hall, homes with gardens and paths that grow with use, all from that very first day, next to a town today.



Comments 0
Join to comment: with your address and a code, kept to the house rules.
No comments yet.