Wednesday, October 22, 2014

A love letter to Unity

I can't focus today.  At least not on my gamedev project.  Chances are it's because I just got done wrapping up a very complex landscape streaming system and although I really want to continue work, I need a break.  Sometimes it's nice to write without the restriction of the characters needing to compile into code that runs error free.  Sometimes it's nice just to write for the sake of writing.  That's all this is; nothing more, nothing less.

I'd like to start off by saying that I have no affiliation with Unity3D.  I am absolutely a fanboy, but before you judge me for that, please take the time to read what follows.  I'm not here to try and convince you that Unity3D is better than x gaming engine, or to convince you use it yourself.  These are my opinions, and I write them to express myself, not to sway you or anyone else's opinion.

That being said...

Thank you everyone at Unity Technologies, wholeheartedly and without reservation.  I'm not sure I can ever put into words what you have done for me personally, but what follows will be my (more than likely failed) attempt.

As a 32-year old programmer on the Autism Spectrum who only recently came to terms with this, I can't even begin to tell you the turmoil I have been experiencing lately.  Not just as far as I am concerned, but even more so knowing that I passed this on to my 18 month old daughter.  My days are an emotional rollarcoaster of ups (pride knowing that my daughter and I share this wonderful gift) and downs (guilt for having burdened my daughter with this diagnosis).  I have never cried so much in my life, and that's not an easy thing to admit, especially in a public forum.

For ten years, I worked as a freelance web designer and did pretty well for myself building rich, data-driven web applications in Adobe Coldfusion (although when I started, it was Macromedia).  It paid the bills, but I always knew that what I really wanted to do was make video games.  My (now late) grandfather gave me the wise advice to not jump in too early; "earn it, and you'll be less likely to take it for granted".  I spent a decade honing my SQL skills, my server architectures, my asynchronous data transactions, etc. etc. until about 4 years ago.  At this time, I sold the social network I had built myself for a decent sum of money and turned my attention to that piece of software that had been calling my name since I first discovered it: Unity3D.

It was absolutely love at first site.  The user-interface was gorgeous, full of a ton of things I had no idea how to use, but more importantly was the "Scene" window: a blank blue canvas that I could move around in with a mouse and keyboard.  I saw a world of possibilities as all the things I had always wanted to do with Adobe Flash over the years immediately became feasible.  I can only akin it to the first time played with Duke Nukem's level editor as a child, which if you have no experience with this tool, it was way ahead of it's time in-so-far as giving the player the freedom to create worlds in what I consider to be one of the best FPS's of all-time (although that statement may be a bit skewed by my memories of fragging friends at LAN parties).  In fact, the potential was so overwhelming that it wasn't long before I was back to programming web applications.

But like a child who is hesitant to administer that final yank on their loose tooth, I knew that in order to get the quarter under my pillow, I had to do it.  That was 3 years ago, and I've used your software every single day that I possibly could ever since.  I poured through the forums, the answers section, the works-in-progress; it became that thing for me that (at least in my personal experience) most high-functioning autistic's crave: our Fortress of Solitude: that place we go when the outside world gets to be too much.  For me personally, it's generally sensory overload that causes me to curl into a figurative ball and rock myself to some sort of equilibrium with what is going on around me.

The first several years with Unity were spent trying to find myself and my voice as a game developer.  I had no idea what I wanted to make yet, just that I needed to make something.  So, I started making stuff with my grandfather's wise words ringing in my ear.  I built top-down shooters, casual puzzlers, an RTS hybrid, and quite a few more projects that never really felt right.  I knew matter-of-factly that I wanted to make games, but for the life of me I couldn't figure out what game I wanted to make.

I'm not going to go into details on the circumstances, but when I lost my partner/graphics designer, I lost a lot of hope.  I thought all was lost, and although I'd be able to make games, I'd never be able to make the game I really wanted to make because I'd never be able to create the graphics assets that I envisioned.  In hindsight, I'm absolutely happy that my designer abandoned me.  I work better solo, I don't necessarily want to share the process of creating my Fortress of Solitude, and I tend to be a control freak when it comes to my projects.  But here is where the love affair hit its peak, because here is where my first tryst with the Asset Store took place; and my life has never been the same since.

I honestly couldn't tell you how much I've spent in the Asset Store to date, but in all honesty I probably would rather not know.  What I do know is that I've supported a massive number of artists while filling the role of "graphics designer" for my game without ever needing to post an ad or interview anyone. What I can tell you, matter-of-factly, is that my current project would not exist at all if it weren't for the assets made available in your store... well, that may not be exactly true, but it'd be more like a couple of cubes moving around on a plane pretending they have legs and can walk.

You see, Unity, you haven't just given me a piece of software: you've given me a way to express myself in a medium that doesn't require me to articulate my thoughts and emotions through conversation.  You have provided me with a set of tools that allows me to not only create my dream game, but literally walk around inside my Fortress of Solitude; and beyond that, I get to share it with like-minded individuals.  I have never once looked at the default blue-screen Game window in your program and saw just that; no, no.  To me, it's already a world full of wonder, enemies, innocent people in peril, friends, and lore that until downloading Unity, I never had the ability to express via any other medium, and trust me I tried several.

As an Autistic, there are very few places I can actually feel comfortable with my surroundings.  The list of places that feel like home is a very, very short one.  But from day one, Unity absolutely fit this bill.  What you have provided me with isn't just a gaming engine, but my very own world, and one that I intend to share with a lot of strangers.  I'm terrible when it comes to sharing; not in the sense that I don't like to share, but more so that I can't bridge the chasm that exists between me and whomever I'm trying to share with.  This constant disconnection rules my social life, and I have struggled for a long time to find ways to get people to meet me halfway when it comes to just about everything in my life.  Nobody waits for me to finish talking because I spend too much time trying to figure out what is/is not appropriate to say/do based off of the current topic.  Nobody gives me the benefit of the doubt when what I say is too blunt for societies standards even though I meant no disrespect with what I said.  Nobody spends any time in my world; they only expect me to live in theirs and any inability to do so is my own fault.

You've taken that lifelong Grand Canyon of a gap that has absolutely ruled my life for a long, long time and provided me with the tools to build a very large bridge.  I have days where I wish the bridge was done because I'm feeling especially lonely and connecting with people takes a huge effort on my part.  I have days where I am happy that it is still very much a work-in-progress, because as much as I want to share it, I also enjoy the emptiness.  To the point that sometimes I will just wander this world I have created in much the same way someone would hike a path.  I reflect, I ponder, and delight in knowing that this is MY world.  Nobody is going to move this tree to a spot that I don't want it; that spot is where it belongs, and I may not get that luxery in the real world, but in Revery, everything is exactly as I feel it needs to be.

I don't know that my game will be a success, but I do know that even if it falls flat on its face, I will probably be adding to it for the rest of my life.  It's my memoir; my take on the world; my imagination realized.  It's every part of me, and thanks to you, I get to share myself with so many people on a level that I had never dreamed possible.  Most importantly, creating this 3D world of 1's and 0's has allowed me to overcome my reservations about my autism: something that will be a priceless asset when my daughter is old enough to discuss this very sensitive topic with me.  I don't know that she will have the same passions as I do, but there is a lot of solace in knowing that if she does, she won't have to spend her first 30 years trying to find her Fortress of Solitude.  Like me, she can build it.  And like me, she can use it to share parts of herself with the world in a way that doesn't make her feel uncomfortable and anxious.

Thank you.  A million times over, thank you.  Not for your software, but for my sanity.  Thank you for making this wonderful medium approachable by even the most novice of programmers.  Thank you for creating an amazing community that is literally the only place I can go to on the internet where people actually treat each other with respect.  Thank you for all the friends I've met along the way that I would not know if I hadn't started building games with your software.  Thank you for giving so many artists a safe place to sell their work with confidence.  Thank you for my Fortress; it is the second most important thing in my life, and while I understand a lot of people may have trouble understanding that, I know that there are a lot of like-minded individuals who can relate.  You have given me reason to be proud of my Autism and to wear it proudly rather than hide it like an unfortunate zit jutting out from my forehead.

I don't know what I'd be doing with my time if I hadn't found your website, but I'm pretty sure I'd dread it.  Nowadays when I wake up, I no longer fear what craziness is going to come my way that sends me into a whirlwind of incomprehensible emotions; I find serenity in knowing that my Fortress awaits, and it is untouched, pure, and one day will be alive with players all unknowingly adventuring in my imagination.  They'll adventure in dungeons inspired by my ever-present feeling of solitude; they'll do battle with 3D representations of my personal demons; they'll save my inner damsel-in-distress from absolute peril and be rewarded with items inspired by games I played as a child; they'll do the things that I have never been able to do, and save my mind from itself in the form of textures and pixels on a computer screen...

...and I won't need to struggle to find the words to explain it to any of them.  For the first time in my life, they'll just get it.

Saturday, September 13, 2014

An Open Letter to Game Informer (and these studios that call themselves 'Indie')

I would have loved your article about the mutated definition of the word 'indie’ if I worked for a studio, but I don't. There is an entire community of gamedevs that I am proud to be a part of, that (for the most part) agree this new definition is BS. Indie has nothing to do with graphics, it has nothing to do with aesthetics; it's about community. It's about giving a dev a bit more slack because they are Indie, and you know he/she busted their rump on this game. It's about encouraging one another to be better than we already are and to not give up until our games are finished. We're not Indie because we don't have a studio to publish our game… we're Indie because we would still do this every single day if we never made a dollar. 

These 'studios’, and your article, miss this entirely. Yeah, it was a given that once indie became successful, big money was bound to come spoil it. That doesn't mean you at GI have to be part of the problem too. 

Thanks for distorting the view of our community for young game developers everywhere.

Friday, April 25, 2014

Adding Some Game Art To My Ludum Dare Entry

I've created some simple voxel-style textures for my cubes, which the character will be drilling through after some scripting.  The top layer is grass, and underneath there are 3 dirt (diggable) and 1 stone (non-diggable) cubes below.

Some quick voxel art

Basic Setup in Unity3D

I haven't imported NGUI yet, but I have got a pretty decent hierarchy setup in Unity already.  My concept drawing seems to be working out so far.



Time to get back to it, time is a' wastin'

* In all the LD excitement, I had saved this post as a draft rather than publishing.  If it is out of order, that is why.

Ludum Dare Has Begun!

My first Ludlum Dare started about 40 minutes ago with the theme 'Beneath the Surface'. In those forty minutes I played around with various ideas, ranging from Atlantis to spelunking to a dungeon crawler.  I wanted to keep things simple, so I considered games from my childhood that I enjoyed playing.  Dig Dug and Qbert came to mind and my idea was born.  My game for Ludum Dare will be a hybrid of these two game in which a character must navigate down the play area as deep as they can dig without getting killed by a falling rock (I may have other disasters like quick-sand and the like if time permits).

My concept drawing for this untitled mining/digging game for Ludum Dare

I'm not going to worry about names at the moment, but it's time to fire up Unity3D and get NGUI imported so I can begin work.

Tuesday, April 22, 2014

Unity3D: Getting a Camera to Follow an Object with Smoothing

For use in my current prototype, Codename: Factions, I needed a system that would allow me to pass a gameobject to a function and then the camera would pan over to center that object on the screen regardless of it's location.  I wanted the transition to be smooth, efficient, and useful in any scenario.


My first thought was to use the gameobject I wanted to follow as the target, but before starting I could see some scoping issues arising in the future.  My solution was to create a simple cube, disable the Mesh Renderer and any other Components I didn't need, and set that as the object for the camera to follow.  To follow a character who was chopping a tree, for instance, I could simply parent the invisible cube to the character, and wallah, it appears as though the camera is following the character.  This makes things much easier to work with, since my code is as simple as "camera, follow the same object you've been following since the level loaded" rather than "hey try and follow this object, and if there's an error, try this, etc. etc."  Best to keep things simple.

Mesh Renderer for the Camera Target is disabled rather than removed, so it can be turned on at any time for debugging purposes.

With that done, next was the transition from the cameras current location to the desired location.  Again, keeping things simple, I created a container object for the camera, which allowed me to position the camera however I wanted while keeping it's container nicely located at Vector3(0, 0, 0).  Why was this important?  Well, it makes animating camera positions much easier in the long run, since while the camera moves within it's local space, the container itself will always be located in the same position as the invisible cube that it is following.  So, if you want to zoom down to the object and get an up-close-and-personal shot, it's as easy as adjusting the local transform vector of the camera itself... meanwhile it's parent's world position is still exactly where it needs to be.  Need the camera to zoom out?  Just subtract from it's current local z position.  Wallah.

A very simple camera heirarchy

Alright, so now I have a container with a nested camera and an object to follow.  If I wanted the camera to simply snap to the position I pass to the function, then I'm basically done.  But what I want is to pass a Vector3 to the function and have the camera automatically pan itself to that position.  Vector3.SmoothDamp to the rescue!

 Camera.main.transform.parent.position = Vector3.SmoothDamp (Camera.main.transform.parent.position, cameraTarget.position, ref _cameraVelocity, _cameraSmoothTime);  

If you're new to Unity, and have not played around with Smooth.Damp, or Lerping, or Slerping, I highly suggest you take the time to learn it.  It makes smooth movement between Vectors in Unity as simple as one line of code, and that's pretty much as good as you're ever going to have it.


Monday, April 21, 2014

Adding A Little GUI To The Mix

What can I say... sometimes you just have to work on what has you most inspired at the moment, and right now that's my prototype.  I've added some basic GUI elements, which will come in handy when this Orc starts harvesting the trees for lumber.  I've also got some buttons down in the corner, which will come in handy on touch devices.  Lastly, I've added some selection indicators for both the current selected object (circular) and that objects target (square).

My opinion may be biased, but this is really starting to look like a game to me

My goal is to program the Orc worker so that when he chops the tree, he gathers resources over time.  When he has chopped all he can carry, he will return it to the tower, and then go back for more.  Before I get this done I am going to convert the movement system to use Unity3D's NavMesh, rather than the temporary one I have in place.  This will allow the Orc to walk around obstacles to reach his destination, which will come in handy in the future.  I'd put this off, but I have a feeling if I programmed the resource collection system first I'd pay for it in the long wrong with a lot of re-written code.  Best to do things in order, at least when the opportunity presents itself.


Chop A Tree or Raze A Defense Tower!

Adding interactions went smoother than I had originally thought.  With some quick trigger collision detection and animation controller scripting, you can now right click and tree and the orc will begin chopping it when he arrives.  You can also click the tower and he will begin attacking it.  I will be modeling a hammer in the near future to replace the axe when this happens, so he will be building the tower rather than attacking it.
The Orc can now chop trees and attack the tower

Unfortunately the treasure chest asset does not open, or I would have added that interaction as well.  
My next step will be to begin work on tracking how much wood has been gathered, and removing the tree when it's resources are exhausted.  From there the orc will bring the resources to the blank area where the tower exists now and use the lumber to begin construction.

<< TAKE ME TO THE DEMO>>