Randomly decorating an island?

I’ve got this island, and I’d like to decorate it with stuff like rocks, trees, jump pads, all kinds of stuff. I know how to spawn them in, but I don’t know how to select what to spawn. I don’t just want one of each type, but I don’t want to manually set how much of each prop will spawn. How can I go about this?

So how many is it supposed to be then? Computers cant just guess this for you. You must base it on something. Like the island size. But you will still have to, directly or indirectly, tell the computer how many you want there. Either as a density, or a range, or a total number. Anything, but something.
To place the items in a random’ish fashion while respecting their diameters, you can use algorithms like poisson disc sampling. Since it’s designed to work for squares (or alternatively other shapes, but likely not your islands shape), you can simply add another rule to make the item not be spawned if it’s within some “bad areas” - like the beach or ocean for example, simply based on the height the item would be spawned at.
You likely do not want to have your x kinds of items all be randomly splattered over the island tho. So anything else you might be thinking of, but did not include in your post, you will have to specify for the computer to consider. Like, maybe there should be a path through the island. Maybe not, and you just use the island as background. The post really is way to unspecific to make any more specific guesses about what you might or might not need.

You are a programmer. Try to be a bit more specific while describing what you need or want to do. If humans, with all their capabilities for interpreting text, cant understand what you mean; then how is a computer supposed to figure that out? :wink:

2 Likes

Yoreki is correct,

What you’re asking for can be achieved on a gridded terrain. With low user specifications, just for each grid tile you generate you can put a random listed object on that tile with absolute minimal code to linearise its placement.

so one of the first methods I ever tried and it is inefficient was to use a huge unity terrain, and raycast from the sky downwards and place objects at raycast hit point, based on terrain bounds, but it’s massively inefficient and has slow startup time, and requires all of the things Yoreki mentioned. And also poses further issues, such as min distance between objects etc and objects placing on top of each other. Raycast misses etc etc the list go on

now a gridded terrain system working with absolutely tiny chunks of terrain that support one item in their centre can be handled much quicker and give you the randomness on the basis of a random range generated when the grid tiles themselves are generated. It would work better in a 2D situation. Like an rpg Pokémon style layout, or a Civilisation layout, or for that matter any grid based system using sprites and stuff but I it’s also feasible on a true gridded mesh or terrain.

i had made a couple of projects using the inefficient method which does produce great results one was a bird simulator with a randomised forest but the start up time to merely test the game became so infuriating I eventually stopped work on it.