Monday, 14 December 2015

How we handle terrain dressing

Terrain dressing is what we call the sprites which appear on the surface of the terrains where the cars can drive.

We create groups of terrain dressing objects, for instance one group for trees, one for bushes, one for foregroud bushes. These are stored in a .asset ScriptableObject database.
Each group contains a lot of parameters which determine how the dressing is generated.
These include horizontal spacing, offset ranges in Z (to create parallax) or Y (clouds, for instance), and scale ranges.
There's also a Max Slope Angle which determines what slope the objects should appear on. We don't want trees on steep slopes, but bushes can go there fine.

Added on to this is a script which is called per-object. I derive classes from a base Dressing Base script. When being placed, all DressingBase scripts are called in the object's hierarchy.

The two in use here are DressingPlacement and DressingColor.
DressingPlacement decides whether the object should take the angle of the surface (eg. for bushes) or not (eg. for trees). Also there's a random range which is added to the rotation of the object.
DressingColor simply modifies the color of various parts of the object randomly for variety.

When AutoUpdate is set on the terrain script, we can adjust the variables in the groups database and see the result in realtime in the editor.

Once we have a set of groups in place, and have decided how we want the particular game to look, we can duplicate the groups for other types of terrain.

Here we have 3 more terrains which are basically the same as the first one we made, with a few groups duplicated and modified:

Visit our Facebook page for the latest updates!

Thursday, 10 December 2015

Dressing Scripts

For our latest game, we automate scenery dresssing, which I'll cover in overview in another post. But today we made color modifications to various items of scenery.

Here are the trees, made from multiple source sprites

When these are placed down in the scene, the code searches for any scripts derived from DressingBase and runs that code on the objects.
We have all kinds of scripts to modify things, but here's the colour modifier script for the trees:

It simply lists the sprite renderers which are to be modified, and changes their colors. In this case we use a green gradient to colour the trees per-tree (rather than per-renderer).

The result we get when putting the trees in to the scene is this:

This also has other randomization applied, but you can see the trees have a nice variation in color now.

Depending on the game, we might use a palette database for this colorization, so we can tint everything in the level depending on other factors, like time of day, or time of year.

Wednesday, 9 December 2015

Unity 5.3 arrived last night, with some nice new improvements. Upgrading was painless.

They now have multi-scene editing, which looks interesting.

Currently we have multiple levels in each scene, split between me and Rob doing the design. We do this because it's very useful to have different levels easily accessible, so we can check things, or copy and paste parts from other levels.

On my current task list is a tool to split the scenes up in to multiple scenes, one per level, to make loading quicker. I deliberately avoided getting on with this task because I knew the new Unity version was coming out soon.

It looks like it was a good decision. I think we can now have one level per scene, and still have all the other scenes on-hand as reference. I'll be trying it out in the next week or so, but fingers crossed, this could be a big improvement.

Monday, 7 December 2015

Working on a new sidescrolling racer in Unity3D.

This is exciting for me, even though I've created loads of these games, because I get a chance to re-write it all from scratch. I can get rid of all the hacks from previous games.

Working on a mission database at the moment, so I can link up tasks and unlocks. For instance:

Level1, wheelie for 5 seconds -> unlock the Bus.

I'll keep this updated every day! (honest!)