Over the past few days I’ve been tinkering with the code of the game I’m working on and trying to come up with a way in which the colour of all the objects in a game can switch between colour schemes. I think I have a reasonably reliable solution.
Basically my main game controller has two sets of colours: a target colour set and a current colour set. The current colour set is the one that you see, as all the game objects refer to that when updating their colour tint values. The second set, the target colours, are a group of colours that the current colour set is trying to replicate.
Basically what this allows me to do is always refer objects in the scene to the one set of colours without having to worry about how they’re going to transition. The game controller object is constantly managing the colour palette, and all transitions are done there. While it makes for a fair bit of code on the game controller object, it massively reduces the code on everything else in the scene.
There’s a new build that shows this colour switching. It’s not a sudden process, as the game controller only changes the current colour set values by a small amount each frame. You can try this by pressing the “C” key on your keyboard. The image below links to the newest version, so if I’ve updated it since writing this then it may not work any more (but will likely be closer to completion.)
Jake Kaufman does another great soundtrack after his excellent work on Double Dragon Neon. I’ll be listening to this while I work today.
I’ve been working on Unity, trying to wrap my head around it and see how it all works. It’s really great, much easier than I expected it to be and runs beautifully on my ancient iMac. Clicking the image below will take you to a Unity Player that will let you play what I’ve got so far.
This is my favourite track from VVVVVV – Pushing Onwards from the album PPPPPP. It;s probably my favourite tune from any indie game in the last few years.
The first version of my FBX batch exporter is up on Creative Crash. You can download it here. The exporter references your Maya files, selects the joints and meshes you want to export and exports animations too. As it’s a very early version there may be bugs, so back up your project before use!
UPDATE(30/7/13) If you’ve found this post and you’re thinking of using this code please try this instead. It’s my much more reliable and feature-rich exporter. The one below works fine, but it’s really just a check to see if batch exporting is possible. Once I’d established that I made the thing that’s on the other end of the link above.
A simple FBX batch export script, useful for exporting multiple animations from a single file. You can download the .py file here. It should be noted however that this script isn’t tested anywhere near as much as it should be, so back up your work before running it.
# James Kyle 12/3/13, http://www.jameskyle.net
# Maya to UDK batch exporter script
# Contains code borrowed from Mark Jackson's blog, which can be found here: http://markj3d.blogspot.co.uk/2010/09/exporting-simple-skeleton-and-mesh-data.html
# This is probably a bit buggy and isn't tested. Save your work before you use it!
# I take no responsibility for any data lost as a result of this script. Use at your own risk! 🙂
# Edit the Tuple data below with your own filenames, start frames and end frames.
# Select the mesh/meshes and the root joint of the joint hierarchy you want to export.
# Run script!
# Important importing...
import maya.cmds as cmds
import maya.mel as mm
# Lists of animation names, start frames and end frames.
# Add/remove as required.
exportNames = ("BE_idle", "BE_fistBump", "BE_pickup")
exportStartFrame = (1, 32, 300)
exportEndFrame = (23, 70, 333)
# This code selects the joints and meshes only. This isn't my code!
# Original author credit at the top of the script.
#find all joints
#find your Skinned Geo
for skin in cmds.listConnections(joints,type='skinCluster'):
if meshTransform not in meshes:
# Borrowed code ends here.
for x in range(len(exportNames)):
# Select the mesh and joints to export
# FBX Exporter options. Set as required.
# You can find a reference guide here: http://download.autodesk.com/us/fbx/20112/Maya/_index.html
# Just add/change what you need.
mm.eval("FBXExportSmoothingGroups -v true")
mm.eval("FBXExportHardEdges -v false")
mm.eval("FBXExportTangents -v false")
mm.eval("FBXExportSmoothMesh -v true")
mm.eval("FBXExportInstances -v false")
mm.eval("FBXExportReferencedContainersContent -v false")
mm.eval("FBXExportBakeComplexAnimation -v true")
mm.eval("FBXExportBakeComplexStart -v "+str(exportStartFrame[x]))
mm.eval("FBXExportBakeComplexEnd -v "+str(exportEndFrame[x]))
mm.eval("FBXExportBakeComplexStep -v 1")
# mm.eval("FBXExportBakeResampleAll -v true")
mm.eval("FBXExportUseSceneName -v false")
mm.eval("FBXExportQuaternion -v euler")
mm.eval("FBXExportShapes -v true")
mm.eval("FBXExportSkins -v true")
mm.eval("FBXExportConstraints -v false")
mm.eval("FBXExportCameras -v false")
mm.eval("FBXExportLights -v false")
# Embed Media
mm.eval("FBXExportEmbeddedTextures -v false")
mm.eval("FBXExportInputConnections -v false")
# Axis Conversion
mm.eval("FBXExport -f "+exportNames[x]+".fbx -s")