Dev Blog
Hi, this is the Stranded III development blog (see also Forum Thread, Comment Thread).
Entry 89 - Icons & Random Map Menu - October 6, 2019
Multithreaded Terrain Generation
Random terrain generation can take a few seconds depening on your CPU and the island count and size.
Therefore I decided to move the random map generation to a separate thread. This way I can update a progress bar more or less fluidly while loading. This is great because moving stuff signals the user (and indirectly also the task manager) that the game did not crash.
I was actually suprised how easy it was to do that. I was lucky because the terrain generation is entirely data driven and doesn't use much Unity stuff. Many methods from Unity can only be used from the main thread. The only issue was the random numer generator from Unity that I used. It was possible to fix that issue by replacing it with the instance based random number generator from the .NET framework.
Don't get me wrong though! The terrain generation itself is still single threaded.
All I did is separating the terrain generation and the Unity main thread:
Unity main thread: Renders a progress bar (and does internal Unity stuff)
Terrain generation thread: Generates a terrain
A more advanced step would be to split up the terrain generation into multiple sub tasks which can be executed in parallel in multiple threads.
When done efficiently this could lead to a substantial reduction of the generation time on multi core CPUs (so basically on all modern CPUs).
Generation times are quite OK already though so I will keep it single threaded for now.
I also added a system which shows localized hints to the player while generating a random map
Icons
I have drawn some new icons and updated some old ones! Here's a selection. Note that they are much smaller in-game.
Settings, control and video
Map and dice
Some need some minor improvements (like fixing/adding drop shadows) but I'm quite happy with them.
For the dice and the cogwheel I painted over screenshots of 3D models in order to get the proportions right. The 3D model also helped a lot to get the brightness of the different sides right.
Random Island Creation Menu
Random island creation was very limited in Stranded II. It was very poorly implemented (resulting in ugly and boring islands) and you only had THREE (!) options when creating a map: Size, landscape type and game mode.
I now designed and partially implemented the random game menu for Stranded III. It will offer a lot more options to make the random island feature more fun.
Random Game Menu on YouTube
Some explanations:
Random Seed
You can now enter a random seed. This is used by the random number generator to generate the game world. The same seed will always lead to the same result - if all the settings are equal as well.
This allows you to easily share your experience with others or to play the same experience again later.
You can also click the dice button to let the game generate another random seed.
Game Mode
The plan is to implement Lua scripted game modes in Stranded III.
What's still missing in the video is an additional button which opens an extra dialog for game mode specific settings.
This might be things like win conditions, start resources etc.
Some game modes may also disable/limit other parameters in the random game menu.
Spawn Position
This allows you to define where the player will be spawned.
Fixed Island Layout
When this checkbox is activated, you can manually place the island(s) on the map instead of letting the random generator do that for you.
Island Distances
If you do NOT use a fixed layout you can use this range slider to control the distances between islands.
The range slider is a new UI element which allows you to define two values at once. The random generator will pick a value in the specified range.
Islands
You can manually control how many islands you want to have on your map.
If you want the game to surprise you you can also choose the random mode and the game will decide if a specific island will be spawned or not.
Right now the menu is limited to 10 islands which is already quite a lot of data, especially when choosing big islands.
Therefore I may limit the amount of islands which can actually be spawned to something like 5 in future.
Having a list with more than 5 items here makes sense anyway because when using the random mode not all islands will be spawned. This allows you to define different islands of which some will be spawned randomly and some not.
A size range can be defined for each island.
Also you can specify the landscape type in case you prefer a flat landscape or want to see extra high mountains.
Additional per-island options which are not implemented yet are:
Biomes
This allows to control which biomes can or can't occur on an island. Maybe you will also be able to tweak the probabilities here.
Objects
Same option as for biomes for all objects that can be spawned on the map.
You could for instance blacklist all tigers if you're a coward.
Additional Island Settings
This will allow you to define an extra per island random seed (by default that seed is generated based on the map seed and the island number).
Moreover I will probably hide some additional fancy expert settings there.
Oh and I also plan to provide a preset system.
This will allow you to load, save and share random map configurations.
Random terrain generation can take a few seconds depening on your CPU and the island count and size.
Therefore I decided to move the random map generation to a separate thread. This way I can update a progress bar more or less fluidly while loading. This is great because moving stuff signals the user (and indirectly also the task manager) that the game did not crash.
I was actually suprised how easy it was to do that. I was lucky because the terrain generation is entirely data driven and doesn't use much Unity stuff. Many methods from Unity can only be used from the main thread. The only issue was the random numer generator from Unity that I used. It was possible to fix that issue by replacing it with the instance based random number generator from the .NET framework.
Don't get me wrong though! The terrain generation itself is still single threaded.
All I did is separating the terrain generation and the Unity main thread:
Unity main thread: Renders a progress bar (and does internal Unity stuff)
Terrain generation thread: Generates a terrain
A more advanced step would be to split up the terrain generation into multiple sub tasks which can be executed in parallel in multiple threads.
When done efficiently this could lead to a substantial reduction of the generation time on multi core CPUs (so basically on all modern CPUs).
Generation times are quite OK already though so I will keep it single threaded for now.
I also added a system which shows localized hints to the player while generating a random map
Icons
I have drawn some new icons and updated some old ones! Here's a selection. Note that they are much smaller in-game.
Settings, control and video
Map and dice
Some need some minor improvements (like fixing/adding drop shadows) but I'm quite happy with them.
For the dice and the cogwheel I painted over screenshots of 3D models in order to get the proportions right. The 3D model also helped a lot to get the brightness of the different sides right.
Random Island Creation Menu
Random island creation was very limited in Stranded II. It was very poorly implemented (resulting in ugly and boring islands) and you only had THREE (!) options when creating a map: Size, landscape type and game mode.
I now designed and partially implemented the random game menu for Stranded III. It will offer a lot more options to make the random island feature more fun.
Random Game Menu on YouTube
Some explanations:
Random Seed
You can now enter a random seed. This is used by the random number generator to generate the game world. The same seed will always lead to the same result - if all the settings are equal as well.
This allows you to easily share your experience with others or to play the same experience again later.
You can also click the dice button to let the game generate another random seed.
Game Mode
The plan is to implement Lua scripted game modes in Stranded III.
What's still missing in the video is an additional button which opens an extra dialog for game mode specific settings.
This might be things like win conditions, start resources etc.
Some game modes may also disable/limit other parameters in the random game menu.
Spawn Position
This allows you to define where the player will be spawned.
Fixed Island Layout
When this checkbox is activated, you can manually place the island(s) on the map instead of letting the random generator do that for you.
Island Distances
If you do NOT use a fixed layout you can use this range slider to control the distances between islands.
The range slider is a new UI element which allows you to define two values at once. The random generator will pick a value in the specified range.
Islands
You can manually control how many islands you want to have on your map.
If you want the game to surprise you you can also choose the random mode and the game will decide if a specific island will be spawned or not.
Right now the menu is limited to 10 islands which is already quite a lot of data, especially when choosing big islands.
Therefore I may limit the amount of islands which can actually be spawned to something like 5 in future.
Having a list with more than 5 items here makes sense anyway because when using the random mode not all islands will be spawned. This allows you to define different islands of which some will be spawned randomly and some not.
A size range can be defined for each island.
Also you can specify the landscape type in case you prefer a flat landscape or want to see extra high mountains.
Additional per-island options which are not implemented yet are:
Biomes
This allows to control which biomes can or can't occur on an island. Maybe you will also be able to tweak the probabilities here.
Objects
Same option as for biomes for all objects that can be spawned on the map.
You could for instance blacklist all tigers if you're a coward.
Additional Island Settings
This will allow you to define an extra per island random seed (by default that seed is generated based on the map seed and the island number).
Moreover I will probably hide some additional fancy expert settings there.
Oh and I also plan to provide a preset system.
This will allow you to load, save and share random map configurations.