smithvoice.com
 Y'herd thisun? 

“It's better to be unofficial till you get the facts”
-Lt. Columbo



JPL, The Solar Sytem, Unity3d and MONO

TaggedCoding, Space

The other week as part of Dave Doody's Basics of Interplanetary Flight course my class had a private visit to JPL.

Following a nice leasurely time in the Spacecraft Museum (so much nicer than being in the shuffle with thousands at the yearly open houses) we got a mega-big-screen show of the new JPL online feature applet Eyes On the Solar System directly from project Technical Consultant Doug Ellison.  (Windows OS was on all demonstration 'puters, by the way.)

Go see that applet, it's pretty darned cool.  Just note that it requires Windows or Mac - if you're uber-hip and have somehow gone mobile operating subsystem exclusive or if you're really really really one of the remaining Linux-only geezers then you'll have to bite the bullet and see it on a machine from someone who doesn't cut off their own legs ;-).  It is worth it, old bean.

Anyway, as we were walking out of the demo, on the way over to meet up with Cassini Deputy Project Scientist Amanda Hendrix for an intimate conference room discussion of the Saturn missions, I asked Mr. Ellison what they used to code the webapp and he said "Unity, it's a plug-in like Flash."

"Unity", I said, "Unity, ohhhh yeah." I remembered that engine from years ago when I was searching for the perfect interactivity platform for Global Scholar... Colin Moock brought it up as a potential but back then it was just a very rough system; more a proof of concept than a working tool.  Even though it still has no intrinsic RTMP support, what a difference a few years have made.

I got home and blathered about the neat online JPL orrery to my wife and when I mentioned Unity she said, "We have some stuff being done in that and FusionFall has been doing pretty well."  I felt quite out of the loop, but then again after my honey got into real games I'd kinda packed up my Strata Media Forge and moved over to the fun of back-ends.

But this JPL app was sooooo neat that I had to see that tool and so I Amazoned a copy of Unity 3D Game Development by Example Beginner's Guide by Ryan Creighton.  APrime got it to me in a day and I couldn't put it down till every page and every line of code was read. 

It's a funny book, I know that that is probably not your idea of a great code book requirement and usually geek humor sucks but this one has some laugh out loud zingers in it... and yet it does a great job of covering the up-to-speed basics of how to build 2d and 3d interactives with the tool.  You start with a matching/concentration type 2d and then move to 3d "keep-it-up" in a live-rendered closed loop 3d hallway and then a spaceship fighting game, and the book keeps you moving along at a good clip and not losing you in any minutia.

If you read the book you'll see what I mean. 

Now, if you've never coded anything before, well, I don't know how much frustatrion you'll feel... while I was reading the part about "What Is An Array" I sat back and remembered the hours it took for me to "get it" way back when no matter how many books I read. I did eventually get it ;-), and so I'm sure you will too and maybe this book's description will do it all better for you than the tech stuff I had to use nearly 20 years ago. 

A point I have to make though is that if you have never ever coded at all then you still will get the quick satisfaction of creating a real working game by just following the steps and the small amount of code in the book - YOU WILL, I guarantee it.  And that moment of compiling your first app and seeing it actually run is still going to be a real life-changer, even if you did copy all the code without exactly knowing why it works - it is the spark that started us all into the silly life of pushing objects.

Oh, the book also adds in a great chapter of Game Design, covering the topic of the Mechanic.  I thought that was an unusual but very welcome addition.  It made the first Matching Game example more worthwhile... but to be honest I have a seven year old who loves playing matchgames with decks of cards so for me that game was not silly at all; I had a real user who I knew would appreciate it and like playing it... find a little kid to play your attempts and you'll realize that there is value even in the simplest games that you can make with this book.

Ok, now a bit for the folks who do have "Coder" on their resumes. 

Unity uses Mono.  I noticed during installation of the IDE that MonoDevelop was an optional package but I didn't think much of it because I remembered a single paragraph in the book that mentioned your code language choices in the IDE were Javascript, C# or Boo.  Thing is that the book only uses Javascript for the code examples so I figured that Mono was only used IF you chose C#... it's not.  The *Scripting Syntax* can be javascript, C# or BOO but the Objects in the core model are ECMA .Net via Mono.

That lightbulb glowed for me when I followed the book to code my first button and onClick posted a print statement of "You Clicked Me!" to the ide bottom pane.  I wanted to make sure that if I clicked multiple times I was generating multiple events so I appended the current system second to the string with Javascript:

var d:Date = new Date();
print("You clicked me at: " + d.getSeconds());

And the compile promptly failed.  The built-in code editor is pretty weak, it just told me that there was a compilation error and put the cursor on the offending line, so I went a googlin' and read that to display datetimes you have to import or explicitly use

System.DateTime.Now.ToString(format);

That sure looked more CLR than JS... but I tried it in the JS and whadyaknow it worked.  Huh.  In a later part of the book I noticed that a class was being coded to inherit from System.Object.  Huh.  So there ya go, boys, JS style/syntax but .Net object model.

Neat.

The book didn't make that feature clear at all, but then again, the book is about using a tool to make games and is targetted at beginners so getting into the politechnicals would be a useless distraction for that target reader.  However, if you're coming from a .Net background then there are a few little parts of the book that might make you a bit leery in that as the author completely excludes mentioning .Net he often flatly states that Flash people will feel right at home with the tool - I've been an AS professional as well as a Java/C#/VB guy and I personally think that coming from J/C/B would be easier than coming over from Flash.  Flex, maybe, but the author says "Flash" and it's a different animal.  But I may be wrong, perhaps it is true when you get more advanced and have to deal with framerate refreshes (but there are no Timelines in the IDE that I can see); Lucklily I have done both sides of the world - and Mono - so for me the whole Unity package just fell into logical place.

Code is code.

Died in the wool Linux people and those who still use the aren't-I-rahhdikal 1992 label "M$" will of course hate Unity, the geekier-than-thou crowd are all still all jumping for joy over Miguel's team getting released from AttachMate. Sadly, the fact that JPL made this amazingly great and fun app will be hailed by the living-alone nixers as EVIL and that's a religious shame.  They just can't ever find a single solitary good thing from Redmond - but that's the way the blind faith crowd-mind ruins a person; so they'll never be able to separate Microsoft from ECMA Public C# so they won't like Unity so now they won't like JPL and thus they see no fun in Space stuff from Space pros.  Well, they don't like anything ;-). 

Mono runs great on most of the useful distros but they want it out ... fine.  What the heck, Linux didn't need to have an Enterprise app footprint anyway.  ;-).

Shame though because nixies and fanatic Silverlighters alike could get a kick out of trying the Unity 3d tool with that easy beginner's guide.  It's a familiar yet alien hoot. 

And everyone should go see that JPL applet even if they have to ask to borrow a Mac or Winputer. That's some exceptional stuff!



home     who is smith    contact smith     rss feed π
Since 1997 a place for my stuff, and it if helps you too then all the better smithvoice.com