Sunday, December 15, 2013

Unity sanity check

The last several months have seen me subsequently looking for new work and then settling down into a new position.  As such, work on game development was slow to non existent.  I originally hoped to release Shattered Throne onto XBLIG this summer, but that window has obviously come and gone.

Also during that time, two key things happened.  The first was the release of the Xbox One and the exit of XBLIG Community Games.  I really wanted to get Shattered Throne submitted well before this happened, but alas, it just didn't work out.  As such, one of the primary reasons for working in XNA has expired.

Seeing this on the horizon a while back, I had been keeping a pulse on the Unity game engine, seeing it as a likely engine to use in my next project.  And it was in early November that the second key event took place, one I had been eagerly awaiting, Unity released its own build in 2D support.

So one event was a disappointment, the other exciting.  One small lesson I have learned in being a hobbyist game developer, is that you need to keep excited in order to keep moving forward.  So I gave in and played around with the new Unity release.  First following a nice pong tutorial, and the next jumping in and trying to puzzle out a tower defense game (which my son had designed on paper).

Feeling pretty good about Unity, what it could do, and how to use it, I gave myself a short quest, spend 2 weeks moving Shattered Throne to Unity, and see how far I could get.  It was the obvious question that had been in the back of my mind after all.  I was very nervous however, as Shattered Throne has been in my head for many years, and inevitably started and stopped on each new platform/engine that struck my fancy.  I was so close to release, had put my own money into art assets, I could not afford to start over.

But I could not let it go, so I gave myself two weeks.  Prove I could reuse a lot of what I had already written, or realize I would have to basically start over.

Things started out on the right foot.  I had been very good in keeping my presentation and game engine layer separate, and within 3 hours, I had the entire game engine data objects and gameplay engine moved over and compiling in Unity.  Nothing was hooked up to the display or player controls, but I had all the pathfinding, rewind, gamestate management, levels, unit and map data, combat calculations, game systems and AI sitting there, ready to be used.

Then I started work on the game play display.  In the simple act of putting the map display together, I realized that the new Unity 2D tools were not going to work out for me.  While Unity has a really good automatic sprite sheet splitter built in, there seems to be no way to switch sprite images within these multi-sprites from within code.  Such as when building a map from data loaded from disk....

Sure, it is possible to create a prefab for every terrain type, and then assemble a map from those, but this would end up being a large number of prefabs when all the water edge and corner transition overlays were counted.  Also I was likely to have the same issue with the Units themselves.

Some research led me to the 2D Toolkit.  Turns out it has been updated to work with the new built in 2D unity objects, and still provides additional value, such as Sprite Atlasing (automatically assembling individual images into a single texture to reduce draw calls), a built in Tilemap object, and ability to dynamically change sprite images in code.  I made the purchase, and have been very pleased with the results.  The author is extremely responsive on his forums, answering questions from users extremely quick.



So the two weeks are gone...what is the end result?

Things have worked out quite well.  The game is mostly playable, there are still some rough or missing animations and effects, but you can move and attack with the units.  Also a few button hookups away from Ending a turn and undoing actions.  I had planned on redoing all the ingame menus and screens (such as building units) anyways, so I will not be losing time redoing those elements, and they will likely come together quicker due to the built in support such elements have in Unity, as well as the NGUI toolkit, which I purchased when it was on sale for a song.




So for now, I will continue to work in Unity, at least for the near future.  I must say that there is some relief in not worrying about getting it finished before XBLIG completely evaporates.  Using Unity also opens up several additional platforms, such as Linux, Mac, iOS, and PS4 which I am all interested in.  Of course, the biggest hurdle on releasing to additional environments is testing, which is already a difficult task to undertake with just a PC release.



Thursday, October 10, 2013

Silent but Busy

So much for the commitment to make regular updates...

Been quite busy on Shattered Throne.  I am happy to say that I think I found some keys to scenario design and game play tweaks that have really improved the game:


  • Updated unit movement speeds, slowing them down a bit to allow positioning to play a more central role
  • Added roads to allow units to move from the player's reserves to where they are needed quicker
  • Change to use campaign map to influence the design of a map, instead of completely define it.  As my campaign map only has major features shown, maps were turning out a bit boring, especially a lack of water tiles.  A simple mindset change to think of the campaign map as showing only large/major features (instead of everything) has lead to a lot more interesting maps.
  • Arrangement of terrain in clumps to create choke points.  This works well now that difficult terrain is much more restrictive to movement than before
  • Updates to scenarios to allow key locations to be defined and include more generic events and triggers to handle adding units in addition to conversations as before.  This has allowed for some more interesting victory conditions to be setup.
  • Scenarios now have an AI flavor, which can be used to turn off certain AI modules.  In particular, I often turn off my multi-turn strategic module such that ai units only react to your units when they move close.  While this seems like a step backwards, for certain scenarios, it allows for a different flow to the map that is sometimes desirable.


I have been avoiding finishing up my series of AI articles, as I am still making tweaks to the AI here and there.  But it is really feeling solid now, so should be back to wrap up that series of articles.

And just kicks, here is the list of checkin changes to the project over the last month or two:

2013-10-1016:11
2013-10-0916:22
2013-10-0816:52
2013-10-0716:48
2013-10-0620:16
2013-10-0516:45
2013-10-0217:04
2013-10-0115:16
15:15
2013-09-3015:50
2013-09-2016:45
2013-09-1920:22
2013-09-1817:39
2013-09-1717:26
2013-09-1618:42
2013-09-1117:01
2013-09-0215:52
2013-08-3016:20
2013-08-2916:17
2013-08-2617:45
2013-08-2314:45
2013-08-2022:23
2013-08-1622:15
2013-08-0713:38