Unity Package

Decorations

With this system you can improve the visual appearance of COALA areas. Some examples are shown below.

To use this feature, we provide two configuration options, the DefaultDecorationsSpawnLogic and the LightweightDecorationsSpawnLogic, each using a different logic to spawn decorations on the map.  

Since version 0.2.2 of the COALA Package for Unity, users can also create and implement their own decoration spawning logic.

DefaultDecorationsSpawnLogic 

The DefaultDecorationsSpawnLogic lets you define an additional, highly customizable layer of objects that will spawn on top of your data layer of choice. (Keep in mind: The decoration logic is "cell"-based.) 

Explanation

(Tip: Every entry is has a tool-tip that describes its purpose.) 

Preview

LightweightDecorationsSpawnLogic   (Available since COALA Unity Package v0.2.2)

The LightweightDecorationsSpawnLogic is generally faster than the Default one, it allows for more decorations spawned and higher performance, and it is easier to use. (Keep in mind: The decoration logic is "cell"-based.) (It;s no longer as strongly Cell based as default one).

Explanation

Preview

User-generated logic

To use your own decoration spawning logic, simply create a scriptable object derived from CoalaDecorationsSpawnLogic implement the DecorateArea method inside it. Once this scriptable object is created, assign it in the Decorations field in the Coala Config (peristent object).

Use cases

The examples below are made with the "PaperMap"  project template from the COALA backend.

Trees and Mushrooms

Imagine having a forest mainly decorated with trees where you additionally want to have some mushrooms growing.

A nicer pond

There are many water areas in the world. You may want them to look like ponds with waterlilies, water grass, pond leaves, and reeds.

To best understand how to approach this advanced decoration example, we can go into the COALA back-end and search for a real-world pond in the Visualization tab to analyze its appearance.

We notice that in the center area of that pond the blue_cell tag is having the highest priority while the outer area (where the water ends) is having the green_cell tag as the highest priority, but the blue_cell tag is still present.

Therefore, we define two pairs of decorations - two decoration objects for the center and another two for the ponds border.

The result is the following: 

Luckily, there is another pond in the same area that we can use to easily verify the result.

Medieval siege (advanced) 

Let's say you want to have a castle POI on the map which is attacked by different siege weapons and supported by rafts if there is water nearby. The siege weapons shall only attack from the land. They also should have some tents spawning near them to represent the enemy campsites. On the other hand, reinforcements for the castle can only spawn on water. All of them shall fire boulders or arrows. The two factions are colored: the red ones attacking the castle, the green ones defending the castle.

Apart from the meshes and textures, you will need three simple scripts for that:

To achieve the whole spawning logic you can easily copy the PaperConfigPOIs asset and modify it. For this example we want to define a castle POI that only spawns where real-world museums are. The castle has a custom mesh with five defense spots (that are firing arrows and boulders at the besiegers) and four spots that can be attacked by the siege units. They are positioned on top of the castle's towers.


Two important settings are hiding here:

2. To prevent siege weapons from spawning too close to or even inside the castle, we are adding a box collider to the castle model inside which no siege weapons are allowed to spawn (please notice the Is Trigger checkbox). 

Now we create some siege weapon prefabs and the ammunition that is fired by specific units. 

We don't want siege weapons to spawn inside other siege weapons. This problem can be resolved in the same way as with the castle: By creating a simple box collider on the model and marking it with Is Trigger.

The last configuration we have to do is define where our siege decoration should spawn. We keep it simple and let them spawn everywhere (using the "*" as the desired GameTag) and roughly adjust the spawn count and the distance as seen in the images below.

Because of the randomized placement of the decoration objects, every time you visit a battlefield it will look a little different, but it should look something like this:

Update #1 - Stationary ballistas

The attacker increased their efficiency by placing stationary siege weapons on top of obstacles.

Update #2 - Water reinforcements

Sea reinforcements finally arrived.