As I always say I need to get better at writing these things. It always helps when I hear from one of you about the project as it helps me to know there is someone actually wanting to listen to one of my rambles.
This week I’ve managed to make a lot of progress. There is a lot of foundation code that I’m trying to build to ensure that the game can expand in the right directions. A good data pattern and data flow is rather important to ensuring I don’t bottleneck myself. This week I worked a bit on how some of the visuals get tied to some of the data.
As I’m using Unity 5 to create Mercury Fallen I had initially been using the Mecanim system for colonist idle/walk animations. The system worked fine until I wanted to be able to hot swap animations at run time. After doing some research I discovered Animation Override Controllers which allow you to override the current animation states clip. You can manually create a new Animation Override Controller in code which can be used to replace the current running clip. After doing some tests and getting it working I found the whole thing to be rather messy.
This led me to start thinking about the legacy animation system instead. I don’t need a lot of fancy state behaviors, I just need to play an animation for given actions. So I re-wrote the animation system currently using Mecanim and replaced it with the the simpler legacy animation system. There were two main reasons for switching over the legacy system
The end result of the new system allowed me to tie animation clip names to an action. This way any action could have an animation play while the action was being performed. Right now its focus is for the colonist, but I have some plans to expand the action system in to a more generic state machine type system that would also work for placeable structures as well.
The first test I did of the action/animation system was for construction. I wanted an animation to play while the colonist was performing the construction action, but the colonist also needs to hold an object in their hand while doing it. All visible objects in the game inherit off of a GameEntity class which also acts as a storage container for components. While Unity has its own component system I wrote a custom component management system for my data objects.
Using my custom component system I was easily able to add a basic prefab attachment component which could be used by an action to attach/detach the relevant prefab object. In this case I wanted a blow torch attached to the hand bone while playing the construction animation. It’s still a bit rough around the edges, but I’ll expand on it more later.
There was also a bunch of boring stuff accomplished this week like code clean up and organization as well as getting svn setup for my work files. I will leave you with a new picture showing a little bit more structure that is a lot closer to representing the direction of Mercury Fallen.
I spend entirely too much time trying to fix stuff that isn’t quite broken. The path finding system did need some tweaks, but I keep reworking a lot of the core code instead of focusing on the features needed to do what it needs to do. This is a common problem given that I keep feeling a can do it better or that there is a better way than how I’m currently doing it. This is not entirely a bad thing, unless you start spending too much time running in circles.
The path finding system is fine, as it is, for the time being while I continue to work on other aspects of the game. I have production machines functioning and have the work flow for ore processing pretty much done. The nice thing about the system is that I wrote how production works which means that I can now quickly add additional production machines for various production chains.
I also have the haul bot in and tweaked action assignments so that colonists won’t respond to haul jobs, but haul bots will. The nice thing about all of this is that most of the object definitions happen in external XML files as I’m trying to ensure that the game will be highly moddable.
I’ve been banging my head a bit on getting the crop system working as I’m just trying to nail down how I want to implement it. I keep bouncing back and forth on ideas, but I need to come to a decision at some point. I was originally going to have small crop fields with the intention that they would later get replaced with hydroponics later in game play. Given the structure of the game I can’t see much benefit, at the moment, to doing it two different ways so I’m focusing now on just the hydroponics station. New upgrades for the hydroponics, as well as other machines, will be unlocked via research.