Points of Interest (POI) are combinations of Game Objects that are spawned together to form one common structure, e.g. a farm with a chicken coop and fences. Even though they represent one large object, Gaia can still place the single objects correctly according to terrain height and even allow smaller game objects to spawn inbetween. This article describes how to set up such a POI in a Game Object spawner, and discusses spawn settings you can tweak to avoid larger POIs appearing on slopes or colliding with other objects.
Setting up a POI
A common example for POIs are the farm building spawns in the Gaia Pro Sample Biome:
These farms consist of multiple game objects that are spawned together as a POI. These farms were created by arranging the individual objects in the unity editor, and then dragging and dropping all objects together on the Game Object Prefab Drop box in the Gaia spawner:
Tip: It can be easier to drag and drop the collection of objects on the spawner when the inspector tab is locked after you select the spawner (small lock icon right to the inspector tab). This will keep the inspector locked to the last selected object until you unlock it again.
The result of dragging the objects on the spawner is that a single spawn rule is being added to the spawner, but all objects from the drag and drop maneuver are being created as individual instances, keeping the positioning between them intact. This procedure is far more convenient than adding all these Game Objects to the spawner manually one after another and then editing the offsets until everything is in position.
Tip: As mentioned the spawner will take on the positions of the Game Objects as offsets - if you are building a new POI make sure to design it around the world origin X=0 Y=0 Z=0 in the unity editor before dragging and dropping the objects to the spawner - else the instances might be created with high offsets and spawn off center.
Tip: If you want to experiment with the farms as example objects for your first POIs, you can find the prefabs we used for setting up the spawners under Procedural Worlds\Gaia\Asset Samples\3dForge\Prefabs\Complete
Tweaking spawn rules for POIs and large Game Objects
The POIs you created as described above can be spawned as any other game object with the game object spawner. However, since the POIs usually claim a larger area, users often run into the issue that the POIs are being spawned in unfit areas, for example on slopes, on roads, etc. These farms were spawned without a slope mask in place and ended up in rough terrain:
This can be prevented by tweaking the spawner settings to prevent spawning in such places. The relevant settings for this are:
Bounds Radius - Determines the area of the POI / large object. The spawner will look at an area of this radius around the spawn point to see if the POI fits in here. By tweaking this setting you can make sure that the object either has some extra space around it, or is rather squeezed in tight corners that are not 100% optimal for position.
Location Increment - This is the "step size" the spawner takes when placing objects on the terrain. The spawner starts in the lower left corner of your terrain, checks the location there, then steps to the next location according to the increment. This value has a minimum and maximum setting. The minimum increment is used in areas with perfect fitness, the maximum is used in areas with bad fitness. In other words: You can let the spawner place objects closer together in areas with good fitness and take larger steps in areas with bad fitness.
Normally you would want the minimum location increment to be larger than the Bounds Radius - otherwise your spawns might intersect with themselves when they are placed too close to each other.
Jitter Percent - This adds randomization to the location increment, so the steps taken by the spawner appear less like a grid structure.
Min Fitness Required - The minimum average (!) fitness required in the Bounds Radius area for a spawn to happen. When a spawner checks a spot, it will look at the Bounds Radius and calculate the average fitness across the area of the Bounds Radius. This is especially important for large objects / POIs since those cover a larger area. For a large POI it can happen that the location the spawner picked would place half of the POI on even terrain, and the other half on a slope - this can be prevented then by raising the "Min Fitness Required" value. More on that below!
Bounds Check Quality - The number of checks used inside the Bounds Radius area to calculate the average fitness. Less checks spawn faster, but more checks give more precise spawn results when calculating the average fitness.
To fully grasp the effect of the spawner settings and masks, we can conduct a little experiment. Imagine we create a cube with the side length of 30 meters to represent our POI. Then we spawn this cube across the terrain with the spawner settings as presented in the screenshot above:
Since the location increment is fixed to 40 meters, there is no jitter applied and have no masks set up yet, we get a grid-like structure, every 40 meters a cube is placed across the entire terrain. So far so good. However, usually POIs do not spawn across the entire terrain like that. Let's add a slope mask to filter out the steep areas on the terrain:
The spawn result now shows that the cubes are not placed on the steep areas on the terrain anymore due to the active slope mask:
However upon closer inspection it is noticeable that some cubes are still placed in unfavorable places. If these cubes for example would be a farm / village spawn, this would probably not look very good, since the underlying terrain is very rough:
Now why did those cubes still spawn in this rough location when we ruled out slopes before? The answer lies in the visualization and the spawner settings that were used:
The visualization shows that there are areas with mixed fitness within the area covered by the cubes. Since the minimum required fitness is set to 0.25 for this spawn, the average fitness in these spots is still high enough to allow spawning. To drive the cubes out of these areas, we need to increase the minimum fitness required for a spawn, here is another spawn with a stricter minimum fitness of 0.9:
As you can see, this results in less spawns since more locations are being ruled out due to the stricter minimum fitness requirement. If we still find cubes in areas that seem to be too rough for our intentions, we can also make the slope mask more strict to rule out more locations. In the example below the slope mask has been made more strict by reducing the allowed maximum slope:
This results in even less "valid locations" remaining for the POI spawns - those remaining locations therefore are neat, flat areas that would be perfectly suitable if the POI would be a farm or a village:
Now what does all of this mean for our spawn settings when spawning a POI?
- When spawning larger objects / POIs there is a trade off between the amount of valid spawn spots versus the accuracy of the spawn. You can make the spawning very strict so that your POIs are only placed in absolutely perfect locations, however this leaves less possible total locations on your terrain for spawning.
- In extreme cases you might end up with no valid locations remaining for your spawn.
- When the location increment is high, it might happen that the spawner never hits a valid spot on the terrain and therefore does not produce any spawns because the spawner steps over all valid locations on your terrain. The example with the cubes above is a bit artificial in so far that normally you would not spawn your POIs in such a grid structure, but with much more space and jittering applied between them - this makes it much more likely to run into a scenario where the spawner does not hit any valid locations anymore.
- When using slope and height masks, the terrain shape can take a huge influence on the possible number of spawns - on a very rough terrain it might happen that no POIs spawn at all while on a flat terrain the same settings produce too many spawns.
Note that these circumstances are rather logical restrictions than issues or bugs in Gaia - when you want to spawn a large object on 100% flat terrain only, but the terrain simply does not possess such spots, there will be no spawn results. If you then loosen your spawn settings to allow a bit more wiggle room for spawning, it can happen that a spawn ends up in a non-optimal spot.
TIP: If possible let your POIs be the first spawners to spawn on the terrain - POIs usually need much room and they might not spawn anymore if trees, etc. are spawned first and the POIs check for collisions while spawning.
TIP: You will always get the best results when tweaking the spawn settings for the terrain / world at hand. It is difficult to find a setting that works 100% well across all possible terrain shape. A setting that is good for one terrain might prevent spawning on a different terrain completely and vice versa.
TIP: The optimal settings can also vary by what the POI you are spawning represents: If your POI is a bunch of rocks and dead trees, it probably does not matter as much if the terrain is 100% flat and you can apply more lenient settings.
TIP: If you don't get no spawns at all, try to deactivate all masks on the spawn rule first and set up a reasonable location increment, then add more and more restrictions to circle in on the optimal spawning settings.