Welcome to June's update! I realize it's not quite been a month since last update, however I'm trying to now get these going out nearer the start of the calendar month instead of kinda randomly! This post is pretty gif-heavy, so might take a bit to load...!
So what's happened?
Mid-June saw the start of me working 100% on the project, which means things are starting to pick up pace a lot better now!
Quite possibly my favourite feature so far is the wave feature! You can now run around town and press X to wave at villagers. Your wave has a "blast radius" that any idle villager within will be hit by your greeting and return the gesture.
Waving at a Villager
My thinking is that this will generate happiness in your town, which in turn can be used to purchase things to make the town even better! I'm still working out how currency will work within the game, but I'm looking for ways that will allow players to get a little boost every now and then by interacting with the villagers.
Looking at stuff
I built a quick component which is used for getting characters to look at things. This allows your avatar to look at items they're interacting with; or just look around the world when they're not doing anything in particular.
Looking at a plant
This component will be added to the residents when they get their new meshes too. Little things like this really help to bring the world alive I feel, so it was great to get this in! I'm going to work on the movement of the head, as right now you can do some quite unnatural things with it!
Stuff on Stuff!
I can now define objects that can be placed on other objects, and objects that can have things on top of them. This allows the player more fine-detailed customization of their town, both interior and exterior. Objects on top will also be moved along with what they're standing on, making it easy to rearrange things if you don't like the layout. The next step with this is to make sure that when the user interacts with an object in front of them, the one on top is prioritized first, so stuff can be moved/removed from the surface they're on for example.
Plants on a Table!
When interacting with things in the world, like doors, the avatar now aligns to the object and plays an interact animation. This will also work for NPCs. Throughout the world there will be lots of things that you and the villagers will be able to interact with. As villagers will have roles, and to a certain extent jobs in your town, they will interact with quite a lot of things. They may even just want to sit on a bench and enjoy the view on a sunny day! Next will be restricting certain objects to specific characters (the barista is the only one interacting with the coffee machine in the cafe, for example) or just the player.
In order to help clean things up, allow for more interesting NPC and avatar behaviour, and better interaction with animations I wrote a system that tracks a characters state. I can create state objects in Unity, that link to each other; and can be moved in between automatically or with a line of code from somewhere else. By doing so I've shifted the mess of doing things like defining animation parameters, keeping track of states and times, waiting for animations and other things to end etc into a much nicer system that can be used across all characters. It's essentially a character state machine that acts as a nice interface between a character and its animations. I would love to build a better interface for this in Unity, perhaps for a future game, but right now they're just ScriptableObjects containing data about the state such as animation events to trigger, exit events, durations, locking the character etc and what states can be moved to next. It's early days but it already feels a lot cleaner than how I would have done things otherwise.
I've started working on how the player puts together the exterior of a building. I've re-worked exterior items so that they function a lot more similarly to other items in the games that can be bought, unlocked etc. On top of this I decided to try out an attachment system for adding variation to how a building can look. Previously the player would choose a defined base, which would have a set of windows/doors laid out in one configuration. This meant to vary the location of any of these elements, or even change their appearance would require a whole new base to be constructed and exported into the game. Now I can put together a base plan of a building with its walls, and within Modo define attachment points. These attachment points follow a naming convention that defines what can be attached to them. This means in Modo I can set up multiple variations on the base of a building, that the player can choose between when placing a new building in their town. On top of this attached objects themselves can have attachment points, and so on, which should ultimately lead to a lot of potential variations in how a building can look.
Variations on Attaching Windows/Doors
Now that a lot of the base systems are getting into place I've started working on some content. First off is looking at parts for the building exterior, some of which you can see in the above gif. I'm going to work on content in "themes" I think; focussing on an architecture or furniture style, for example, and then creating a lot of objects that fit within it at one time. By sticking to themes I can hopefully maintain a better level of compatibility across items when placed together. By doing theme packs too, I can allow certain collections of items to be unlocked at points at the game. Reaching milestones, pleasing a villager, or doing a quest can unlock new furniture or building options; which I think should be a good reward!
The first style I've started with is the "French Farmhouse" style:
French farmhouse inspiration
I had a little play around with Unity's tree maker. It gave me a good start, but I was bothered by how it worked with materials on them, making duplicates of textures and being generally awkward to work with. I them got-hold of an OBJ exporter for Unity and took the tree across into Modo where I could assign materials and re-export the mesh to something more usable in Unity. I then sat with the wonderful Shader Forge to put together a shader I felt was more in line with where I wanted to go stylistically. I'm very inspired by the trees in The Witness, and I think the flatter, more "splatter" like appearance of the foliage fits closer to the art inspirations of the game such as watercolor paintings. From the side their gradient looks a little boring, but a more in-game angle gives them a bit more depth. I use a texture mapped top down to get variation of color on them over the map. Next thing I want to look at is smaller bushes, grass and trees.
Fixed animation bounce
With help from an ex-colleague through the wonder of twitter I fixed how the player animations are set up in Unity. Previously the run animation didn't contain any of the bounce it had in it in Modo after import. Turns out I needed to make sure that the Root Motion Node on my import was set to the Root Transform and not "None" as it was previously, and that Root motion was not enabled on my animation. And now the bounce is back!
Before and After Correction
I also found why some of the joints I had animated were being ignored in the animations. I have joints for animating things attached to the player's back, and head, as well as opening and closing the hands. As these joints are not part of the Humanoid Avatar set up in Unity their animation was getting ignored. By going through the animations and making sure the joints were enabled under "Mask" they started animating again, hoorah!