Development Diary #7: More Progress…

I’ve recently been fiddling around with various interface elements, at this stage I’ve settled on an “in context” approach with only relevant interactive options appearing when required, as opposed to the old school verb box…

Ideally, I want to be able to build my scene in 3d, set the relevant Playmaker template for items, doors etc. click a few check-boxes and hit play. Certain elements are common to most point-and-click games and at first it seems pretty straight forward to just have objects to collect and other characters or scene elements to interact with, as I tried to nail these down though, more and more variations seemed to appear. What I need is a setup that allows me to add various actions as I need them and accommodate one-off custom options as well. My current solution uses two templates, the first covers the mouse-overs and pop-ups and the second covers the button actions on each of these…

Each interactive Item compares itself with a global variable called Hovered_Object which is updated with a Mouse Pick every frame the cursor is moving, (you could probably just use a standard OnMouseEnter!) when they match it sends an Over event to any child FSMs, the individual buttons then handle the scaling. Over Idle only checks for a not-equal response, this stops the FSM changing state while hovering the cursor and means we always fire the next event off at the correct time. Upon the mouse moving off the Item, after a short Wait, we check for mouse overs on any objects tagged as Buttons, this ensures that the user has time to move the cursor between the item and Buttons without throwing a Mouse Off event. Button Over Idle again only checks for not-equals while the mouse is over a Button. If the cursor moves off a Button we make one last check to make sure the user hasn’t moved the cursor back over the original Item before sending the Off event to the child FSMs and we end up back at Idle

Each Button has its own FSM:

The Idle state is empty as the Button template relies on the parent Item to trigger the initial Over event. Scale Button Up handles the scaling, checks for a mouse-over on just itself and also for a Click event (in this case a Finger Gestures Tap). Clicked then scales the button to zero and sets a global Click Type variable. Each button is assigned a string variable in the inspector that corresponds to its function, the relevant actions can then be selected via a String Switch, this way I can use the same template for all buttons. At some point I’ll probably be adding more Click events to cover various inputs, I also might add a broadcast event to Clicked so all buttons disappear simultaneously, having everything set up in one template means these kinds of changes can propagate to all the various button types instead of me having to add it to each one individually.


Another relatively new addition to my set-up, and one I feel like mentioning, is Shader Forge, a visual, node-based shader editor for Unity. Below is the tree for the basic, flat toon-shader I’m now using on nearly everything in the game:

For anyone, like myself, with a background in 3d (or 2d-compositing or motion graphics!) the above should look reasonably familiar, it’s very similar to the nodal graphs you find in common 3d packages and entirely removes the need for writing shader code directly, replacing it with a process that I for one find infinitely more intuitive. In the same way I’ve found Playmaker so freeing creatively when setting up interactions etc. I now feel equipped to solve my own shader issues and, more importantly, play around and experiment with setups until I get what I want!

Just as an aside; I do occasionally hear a similar set of criticisms regarding both Shader Forge and Playmaker when I bring them up, that these kind of tools add unnecessary overhead, that they limit your control over the code, encourage “bad” working practices etc. As far as I’m concerned it’s plug-ins like these that make good on Unity’s promise of democratising game development, they open up avenues between a bunch of different creative disciplines and shorten the distance between code-centric developers and those of us who are more visually minded (you can see it working already in the post-production industry with tools like ICE in Softimage, or whatever the equivalent will be now T-T). For me, seeing the number of illustrators, animators and designers getting involved in games in the last couple of years is super exciting! Olly Moss, Scott Benson, David OReilly, Heather Penn… and those are just a few grabbed from my Twitter feed, I would imagine a similar trend can be seen in all sorts of other areas too. Most of these folks seem to be starting/joining small studios and partnerships with other developers but as the technical barriers to entry diminish, it’d be great to see games becoming accessible in the way short-films and comics have. Hopefully we’ll see lots more small-scale, single-artist creations appearing, as well as collaborations between all sorts of disciplines not usually associated with games! The more tools we have that make it not just easier, but even just possible at all for more people to make more things, the better!

Anyway, with most of the mechanical bits and pieces starting to come together, I’m hoping to get something playable together in the next few weeks. There are various conventions and meet-ups coming up before the end of the year and it would be great to try and get the game entered for one or two…

As ever, comments, questions, crits and corrections are all more than welcome…

8 thoughts on “Development Diary #7: More Progress…”

  1. I absolutely love that you’re continuing the blog, and the game. Things look like they’re really taking shape.

    Re: common complaints with Unity and Shader Forge…Two things: I tend to think that anyone who poo-poos these things doesn’t understand the value of getting something from concept to reality relatively quickly. Second, especially with regard to PlayMaker, I feel like grasping these mechanics in a visual format can actually start to understand the code side of things. I’ve been teaching myself programming pretty intensely over the past six months or so, and introducing PlayMaker into my work flow (and following tutorials on it, etc.) has helped me to conceptually connect a lot of dots when it comes to code creation. Long story short: rock on. 🙂

    Also – thanks for sharing such detail on your PlayMaker FSM’s. They’re invaluable!

    • Thank you for the kind words! Glad some of this is useful for somebody!

      Completely agree, especially about working visually, my issues with code never seem to be about the overall concepts, more the process of putting them together in a text editor. This is 100% the reason I warmed to Unity so quickly, you start with the 3d scene, fill it with the stuff you want to play with and then worry about the technical stuff after. That way everything has a relatable context! To me that’s totally the right way round, though I’ve heard loads of people complaining about precisely that work flow when coming to Unity from a pure code background!

      I mentioned before in an earlier post that I’ve worked with people (TDs invariably!) who seem to simplify in the opposite direction to me. Like, if they were trying to explain a concept in terms of a simple analogy, I’d say: “Oh! You mean like a sandwich!?” and they’d respond with “Yeah, so if the bread is X and B,L and T are always arranged along X’s normal we could express it like…” They would take things I already understood and abstract them away with letters and symbols!

      I think there’s just a fundamental difference in the way some folks process and approach problems, from my point of view Playmaker, Unity etc. just help bridge that divide? Who knows, at the end of the day all that really matters is getting stuff done!

      Thanks again and good luck with your work!

  2. Hi Nick, I’ve been reading your blog over the last while and I look forward to when your game is out. I hope you still get time for it!

    I’ve got a question after looking at your Shader Forge shader. I’m still very much a newbie when it comes to 3D and especially shaders are an unknown beast to me. Do you have a texture material that you use in conjunction with this lighting shader or do all the colours come from the vertex colours? I hope that question made sense. Or rather do you use more than one material per object?

    Thanks for all your tutorials and showing how you went about it all!

    • I played around a bit and added some vertex colours to a model in MODO and tried it out in Unity with the shader and voila the colours were showing. My shader doesn’t look anywhere near as great as yours but that’s most likely because you have artistic skill and I’m a programmer. 🙂 Will play a bit more during the week.

      • Hi Ruan, no worries, glad you found something useful! 😀

        It’s a pretty fiddly process getting the shaders to look just how you want them! I’m not using any textures here aside from the ramp so, aside from a little tint coming from the various different lights, all the colours are coming from the vertices.

        I do use textures occasionally for the odd, extra-detailed element like the vending machine in these screenshots: though, in this case it’s actually a screengrab of another scene set up with objects using the vertex-shaders!

        I do also use a couple of shader variations with different ramps:

        It took me ages to get even a vaguely consistent look, aside from the shader itself, having a fixed palette of colours made a big difference, as did keeping to blocks of colour as much as possible; it’s easy to get carried away with modelling in details but things can get noisy very quickly, especially with this kind of hard-edged lighting.

        It’s definitely a case of playing around until you’re happy though!



        • Whew Nick, at this stage I’m still stumped. In MODO Indie if I add a vertex colour map and then try to add colour it will change the colour of the vertex itself and parts around it. I can’t figure out how to change the colour of a polygon.

          For instance if I look at the ‘What’s in the Box?’ post of yours. I can’t make the box because there’s no way for me to set that middle stripe to a different colour. I’d either have to do it in a material or well that’s the only way I can seem to do it.

          Am I understanding correctly that you change the colours of the polygons using vertex colours or am I barking up the wrong tree?

          Eh my apologies for bugging you like this. I just love your style and even though I’d never be able to replicate it I would like to do something small and similar in graphical style. 🙂

          I will sit for an hour, not get it right, then come and post here and then a short time later figure it out. Typical. But yes, it was the smoothing! So I’m glad to say that I’m making progress. And at this rate I’m writing a mini blog in your blog.

          Have a good week!


          • No bother Ruan! Yeah, There are a few different ways of getting colours into your vertex map, XSI has a raycast tool as well as a brush for painting directly on to a mesh, it allows you to assign values to specific faces, maybe Modo has an equivalent?

            You can also bake the colours into the map, which is what I’ve been doing mostly. First, do a really rough UV unwrap of your model and assign a texture with your palette in it, I just use a grid of coloured squares. Then select clusters of faces corresponding to the different colours, separate them out in the UV editor and move them over the colour you want, like this:

            After that you can bake the surface colour to the vertex map ignoring any lighting, not sure how you would go about that in Modo though I’m afraid!

            You could also just use that same texture in Unity though, and forget about the Vertex Colours entirely if it’s a hassle? The look depends a lot on the details being modelled in rather than textured on ie. the boundaries of each section of colour run along the edges of polygons. That’ll still be the case if you texture your model like above!

            Not sure if any of that makes any sense!? 😀


            • Thanks Nick! That does indeed make sense. I’ve been unable to figure out how to bake the surface colour to the vertex map in Modo so far but will ask on the Steam forums.

              Thanks once again. Your are a kind person in helping a random stranger.

Comments are closed.