Thursday, June 2, 2011

Unity: Making Stuff Happen #2

Some additions to working features. Namely pickups, and a power-up which increases player speed by an arbitrary value for an arbitrary time frame (in this case, x2 for 5 seconds). The pickups created a bit of a problem in that they're rigidbody objects (ie. they collide with stuff) which had to not collide with the player (which would cause hitches in movement), but instead act like a trigger (which detects a collision, but doesn't actually respond to it). So in short... the pickups had to be both a collider and a trigger, which isn't possible.

The solution was to parent one gameObject under another. The root is the rigidbody which collides with the world, while the child is the trigger which responds to the player.

The power-up, once the issue of collecting it was solved, was actually ridiculously easy. Coroutines are the best thing about Unity. Seriously.

Didn't get the moving platforms done tonight, but that's the next thing on my list.

Note: The playable demo has been moved to its own post. CLICK HERE TO PLAY.

Time to collect some coins!

Ideas in Limbo

I just found this floating around on my hard drive, and thought I'd share it. It's an image I painted for a game I was working on at my last job.


This was to form something of a style guide for the first level in the game, and was rushed onto digital canvas in the early hours of a sleepless night as the realities of global finance marched inexorably towards dire circumstances.

Sound vague? Deliberately so. Business happens.

But to remain positive, it was an amazing team of people, and a really great product (can you believe we were regularly playtesting within a few weeks, and actually fighting for the controller?) Best of all, I had the incredible honour of being art lead/director on this project, and working with some people who truly humbled me. Illustrators like Jeremy Love, Mike Manalac, Richard Lyons, Brendan Deboy, Jared Pullen and Danh Nhan; the best 3D sidekicks ever in Dean Walshe, Kieran O'Sullivan and Stewart Alves; the awesome designers - Paul McInnes, Christian Carriere and Mark Hurst; and the coders - James Podesta and Shane Lontis - making all the cool stuff happen. And of course our producer, John Whiston, who fought the hard fight for us. It sounds like I'm accepting an award... Well, we should have been!

It was one of those periods of creativity where deadlines and schedules and budgets never interrupted the process. We were always on time, always over delivering, and always thrilled with the results of our efforts, despite the usual production difficulties. I've rarely loved what I do more than on this project.

Unfortunately, as I vaguely hinted at above, due to business-type things out of any of our control, the doors were closed and this project, as far as I know, has drifted off into the ether.

[Insert long and wistful sigh here]

This image is obviously unfinished, and it saddens me to think it never will be, especially since I was super happy with the direction it was going in, and had surprised myself a bit with it. But such is the way of the creative industries.

Sometimes bad things happen to good ideas.

Unity: Locator.cs

My first code example! It shows how I draw the custom gizmo for the Locator game object (an empty game object which I use to define nodes such as waypoints or spawnpoints). Not very exciting, but this was one of the harder things to find in my googling, so if a beginner like me stumbles across this page and has a bit of a lightbulb moment, it'll be worth it!

The OnDrawGizmos() MonoBehaviour override is, as the name suggests, the method in which to place Gizmo drawing, as it's called automatically by the editor, but not during the game. I believe there's also an OnDrawGizmosSelected() method which you can use to draw a custom gizmo when the entity is selected.

Just drag this MonoBehaviour onto an empty game object to create a visible locator. Easy as that :) Best of all: You can select the entity by clicking the gizmo!

Unity is so clever, amiright?

// Basic Locator object
public class Locator : MonoBehaviour
{
 // Draw Gizmo
 void OnDrawGizmos()
 {
  Vector3 pos = transform.position;
  Vector3 scl = transform.localScale;
  Vector3 posX = new Vector3(pos.x + scl.x, pos.y, pos.z);
  Vector3 negX = new Vector3(pos.x - scl.x, pos.y, pos.z);
  Vector3 posY = new Vector3(pos.x, pos.y + scl.y, pos.z);
  Vector3 negY = new Vector3(pos.x, pos.y - scl.y, pos.z);
  Vector3 posZ = new Vector3(pos.x, pos.y, pos.z + scl.z);
  Vector3 negZ = new Vector3(pos.x, pos.y, pos.z - scl.z);
  
  Gizmos.color = Color.white;
  Gizmos.DrawLine(posZ, negZ);
  Gizmos.DrawLine(posY, negY);
  Gizmos.DrawLine(posX, negX);
 }
}

Unity: Making Stuff Happen

So I don't really have a design document. But I do have a feature list - a collection of bits and pieces I want to learn to create before I go about designing the game. You can't build the house until you have the tools, right?

Here's where I'm currently at:
  • Custom editor gizmos for invisible nodes such as locators, spawnpoints, etc. (done)
  • 2D platformer-style character movement (done)
  • Smooth follow-camera movement (done)
  • Portals that teleport the player to a new location (done)
  • Linked portals (done)
  • Portals that can be activated via contact, or by the player pushing up/down (done)
  • Simple camera effects such as fading to black (done)
  • Layered camera transforms for additional movement effects such as screen-shake (done) 
  • Scripted sequences (done - coroutines freaking ROCK!)
  • Simple pickups
  • Complex pickups that cause a temporary effect or event
  • Moving platforms
  • Portals working between levels
This effort represents about 8 hours of work. My hope is to have the pickups, moving platforms, and inter-level portals working within the next 8 hours (of active Unity time, not real time). I'll try to keep posting updates either at qualifiable milestones, or time-based intervals.

Future updates will include:
  • Player health
  • Environmental hazards, such as spikes and lava
  • Simple enemies
  • The ability to attack and kill enemies
  • More complex enemy behaviours
  • And more!
It's all so exciting! I'll try to figure out syntax highlighting for C# in blogger (I tried earlier and failed miserably) and then I can post my code stuff, for anyone who cares.

And here is a playable 'demo'. Not much happening, but everything starts somewhere!

Note: The playable demo has been moved to its own post. CLICK HERE TO PLAY.

I've never been happier to be a nerd :)

Wednesday, June 1, 2011

Unity: Love at Second Sight

So, as promised, here is my first entry, post-changing-teams.

I began playing around with Unity about a year ago. Up until that point, my impressions (sadly) were formed on unsubstantiated negative heresay and the handful of student games I'd seen which didn't particularly sell it as a bad-ass indy toolkit in a world which had just received UDK for free.

So I'd heard about this thing called Unity, but to be perfectly honest... UNREALENGINEOMG.

Between then and now, I flip-flopped between XNA and UDK. XNA because it was super easy to code with and I'd been learning C#/XNA for 18 months or so, and UDK because it's so good at making stuff look insanely sexy.

But whenever I tried to learn to code in UDK, I hit a wall of outdated tutorials, limited video resources, and a small community who were too busy to answer my inane questions. I had a lot of trouble advancing in UDK beyond a graphics toolset.

I was much more successful in my "learn to make games" self education in XNA. I actually made quite a few little playable (albeit unpublishable) mini-games. Most didn't have a point, and some didn't even have gameplay. But it was fun, and it was learning, and it was going somewhere. Documented on this blog are a few examples of some games I loosely call 'in progress', because when it came down to it, I had no idea how to do 3D in XNA, and I kept getting bogged down in attempting to make a functional game editor for my 2D ideas. I made an aweful lot of progress, but not a lot of product.

Then I decided to try Unity again, after reading about it in a much more positive light. First delightful surprise was how easy it is to navigate: Within minutes, I was moving through the interface, adding entities, getting things happening without so much as a peek at a tutorial. After the first hour, I had an actual mini-game, playable. Not particularly fun or inspired, but certainly inspiring.

The next thing that surprised me was the asset pipeline. Importing Maya assets directly? Truly, what voodoo magic is this?!

And then, I discovered that Unity is quite happy to let me script in C#. It can't be understated how important this is to me. I'm not a programmer. Learning to program, even to the intermediate-ish level that I'm at, was an arduous and time-consuming task: I'm talking an hour or two every single night for the last two years. And it just so happens that the language I learned to code in was C#.

Unity and I seemed to be made for each other.

So the last few days I've really started to dive in. I have (from scratch, or almost from scratch), a side-scrolling platformer, with a really nice, tight feel to the player controls. I enjoy just jumping around (there's even a double jump!). There's also a smooth tracking camera, portals, screen fades, and I just added a camera-shake effect. It all works so nicely, I'd like to squirt a little lemon in my eye just so I can wipe away a tear of happiness.

The next thing I'd like to try to create is a pickup of some sort. Maybe a power-up that applies a temporary boost to player speed, or something else like that.

It's all just white boxes and white capsules and white spheres at the moment - no art to speak of. But that's okay. For the first time since I began this journey, I have something truly playable, and I can't wait to make it sexy.

I'm wondering how mister-green-short-shorts-pirate-guy might look as a 3D character...

Changing Allegiance

Ouch. It's been too long. So much for daily creativity, amiright?

Though it might not excuse me, I have a reason of sorts: My life is still transitory. I am here-and-there at the best of times, and sometimes who-knows-where? Not that I'm suffering; as a matter of fact, I feel better about (and more connected to) the important things than I have in years. It has been a wonderful shift in gears. I finally have time to see my friends and family. I've been taking time, just to take time.

I've been watching some television, reading some books, playing some games, and doing some nothing at all. And it's fantastic.

Not to say I've been uncreative. Some days I shoot some photographs. Other days I write a bit, or sketch up some ideas in my notebook. And quite a bit of the time I'm still doing the indy-game-thing.

I haven't been posting my endeavors, partly because I haven't really got all that much to post (it's hard to make code look exciting), and partly because I've been lazy about posting. I'll try to fix that. I am also, for the foreseeable future, going to have to renegotiate my contract. I would love to be in a place where I have at hand the time, the space and the equipment to be so optimistically proactive. But the thing is, I'm loving more right now just being able to coast... Meander... Take a breath and hold it...

So I'll talk briefly about the title of the post, else it makes no sense.

A change of sides; allegiances altered; an utter betrayal: XNA, I have something to tell you... There's someone else. It's not me, it's you. Yes, his name is Unity, and we're totally doing it.

And with that confession, I don't have much more to say right now. There's been a lot going on with Unity and I. Some coding, and designing, and objectifying, oh my! Later, when I'm slightly less transitory than I am at this very instant, I'll post some details of the sordid affair. With pictures. Oolala.

Until then, peace xox.

Monday, March 7, 2011

Dark Castle Adventure

Does anyone else remember an old DOS game called Castle Adventure? Follow this link to jog your memory. I remember playing this game many years ago on a friend's Tandy1000 PC - a great, chunky, noisy, utilitarian looking beast of a thing, and it was in many ways one of my earliest introductions to the joys of video games.

The memory of Castle Adventure itself was triggered in a bit of an unusual way. Let me preface the story with a promise that it does not contain gross stuff: I was using a friend's toilet. I hadn't used it at this point, but was in the process of intending to (a detail which is imperative to the following), when the particular combined aroma of their scented toilet paper and their chosen brand of deodoriser was like some B-movie flashback sequence trigger. Memories of Tandy1000-Friend's toilet some 20 years previously, and more critically an unrelated (albeit bizarrely connected) series of vivid memories of playing these old computer games accosted me with such force that I briefly forgot what I was in there for.

Sometime later, and in a great deal more comfort than I had been previously, I found myself Googling a huge list of old video games that I hadn't thought about in years. Ultima, Bard's Tale, Digger, Eye of the Beholder, and of course Castle Adventure being some of the more noteworthy ones. Castle Adventure in particular. Not that I can clearly explain why it has so much appeal to me. Maybe it was the mix of Pacman-like labyrinthine escape gameplay, exploration, and (simple) puzzles. Maybe it was also a bit to do with the antiquated graphics and the need to fill it in with imagination. I expect it's something like the passion that drives Nethack players, but in the "...For Dummies" version.

And then, as I'm wont to do, I was hit with the overwhelming urge to pay it homage - to attempt to capture the essence of it in my own way, which is kind of a nice way of saying "rip it off". Here are my early efforts:



It's is a bit of a weird way to get back into the creative contract, so forgive me for being particularly underwhelming, but I'm really excited about this in a weirdly nostalgic and childlike way.

Also, the art is way easy to do (LOL).