You may or (more likely) may not have noticed that I haven’t written any blogs since the last 2-month recap. Being as I’m doing all this on my lonesome, I’ve decided to cut back to just these 2-month recaps, for now at least, so as to use my development time more wisely. I’d also just like to point out that the word “Recap” is short for “Recapitulation”. So without further ado, please allow me to recapitulate for you the last 2 months of development.



(biome-specific)Because I had just finished some of the animal models and just had to see them in context, the first thing I did during this bimester of creation was to upgrade my “jittery-grid tree spawner” into a “jittery-grid– jittery-grid-object-spawner– spawner”. To be less confusing: it used to randomly spawn trees on a grid with some random offset (jitter). Now it randomly spawns a GROUP (another, smaller “jittery grid”) of trees (or whatever) at each point.

Besides flora & fauna, it will also come in handy for biomes requiring unique weather or visual effects.

-TIME

“…it’s just an illusion caused by the world skybox spinning round.”

The basic concept is simply just to create a time variable and add to it every tick. That’s obvious enough, so I won’t get into that, except to say, everything else in this section happens based on that variable.

The real fun starts with a rotating, 6-sided, HDR skybox with images of the sun & moon built in. Then 2 rotating directional lights are added to match: 1 bright sun & 1 dim moon.



To really sell the day/night illusion, I am interpolating 3 attributes, based on the time of day: the intensity and colour temperature for each light (sun/moon), and the tint of the entire skybox.

Obviously, the light intensity gets higher as the light rises in the sky and then back down as it sets. The colour temperature works the same way. For the skybox tint, I put in 4 colour pickers to LERP between throughout each part of the day.

With day & night in place I added “months” by providing a different moon texture for each moon phase and having that side of the skybox flip to the next moon texture each day (hence the 6-sided skybox).

And if at some point I decide I want seasons, it’s really just a matter of tweaking these variables over time and of course the…

-WEATHER

One thing I’ve decided to do that I haven’t seen in many games is to have the water level change with the weather, allowing for occasional floods/droughts and their concurrent effects on the local flora & fauna.

In addition to the ground water layer, I decided on 3 more atmosphere layers:

The 1st, and lowest, has big, puffy clouds and can cause gentle storms.

The 2nd layer, slightly higher than the first, contains smaller, puffy clouds and can cause thunderstorms.

The final, highest layer contains sparse, wispy clouds and rarely causes weather events.

The main ingredient is temperature which is essentially: sunlight – cloud cover. (Complex, I know..). So here’s how it works:

As the sun heats the ground layer, the water level goes down (evaporates), which causes the 1st atmosphere layer to begin to fill up with moisture, and therefore, clouds. As this layer becomes full of clouds it begins to catch more sunlight, both lowering the ground temperature and causing evaporation from this layer into the next one. As the 2nd layer fills up with moisture/clouds.. you guessed it! It heats up and starts to pass moisture to the 3rd level, only by this time, the layers below have started to cool and are becoming low on “moisture”. When a layer gets too heavy for the layer below it to “support”, it begins to rain; calmly from the 1st layer, and stormily from the 2nd (Yes, ‘stormily’ is a word). If you didn’t already guess, as it rains, the moisture from the upper levels finds its way to the ground level which then raises the water level.

By far the most interesting (and difficult) thing I worked on these past couple of months:

-Animal AI Behaviour Trees (+ Scriptable Objects)

It’s pretty much the natural order of things for me to be in way over my head, but for some reason I felt the need to double down on this one… I painstakingly slogged my way through these 2 concepts, but I eventually dug my way out, and I’m quite pleased with the results.

My goal was to make AI creation as easy as building with legos. After many hours spent researching the concept of Behaviour Trees and Unity’s Scriptable Objects, I set up the following simple, yet extremely powerful Scriptable Objects:

A NEED is basically just a bar that fills up constantly. The goal of the AI is to keep all of their NEED bars as empty as possible (similar to The Sims needs system). Each NEED has a priority curve which helps the AI decide which NEED to consider top priority, and therefore, solve.

A TRAIT simply changes the priority curve of a certain NEED based on a certain variable. (ex. “nocturnal” could make sleeping a higher priority during the day)

A BEHAVIOUR is a Scriptable Object which does ONE thing, and one thing only: “find target”, “add to need”, “go to target”, “spawn object”, etc.. -This is the real power. These are the ‘lego bricks’ of the AI system.

I also have SEQUENCERs and REPEATERs which are just arrays of BEHAVIOURs that run in order once (Sequencer) or over and over until a stop is reached (Repeater). The trick is that they themselves are BEHAVIOURS, so a Sequencer can contain another Sequencer or Repeater (and vice versa.. and on, and on…).

So in order to create some pretty complex AI, you simply set up a few NEEDS, and then plug in SEQUENCERs filled with pre-built BEHAVIOURS to solve each NEED.

This setup is so powerful and flexible, I have no doubt I’ll be using it for much more than just animal AI.

This one doesn’t make for much explanation, but for the record I also made:

-PLANT GROWTH BEHAVIOURS

Plants require light and water to grow. (I’ll actually probably combine the way I did this into the AI system I gave the animals)

So now you know, and knowing is half the battle. As for the near future, I’ve just barely gotten the AI working, so there’s still quite a bit do there. After I breathe life into some more animals, I’ll probably move on to harvesting/crafting systems. So Follow Stonewood Games and I’ll tell you all about it in 2 months!

@StonewoodGames

Facebook.com/StonewoodGames

Instagram.com/StonewoodGames