Gaming Your Way

May contain nuts.

From script to code and back - just to discover coding again

Hi folks,

most regular readers will have noticed that we've jumped onto the Unity wagon after it finally came out for the windows world and so I think it's time to write down a few of my thoughts ...

What it is:
an easy to use development platform for 3d games (although easy, well, I'll cover that later)

What it is not:
Simply put: easy.
And it is not flash.

So?
The best part of it is, that you can do a decent 3d based game with it quite quickly, that is if you know how to code unity (I might have twittered once or twice that the docs are not one of the strong points) and (what's more important if you or someone in your team) can do low poly 3d.

So?
I really can't stress enough that it is NOT flash, not at all, when you get started with Unity all is nice and straight forward, but once you hit the point where you really would like to do a quick tween for the main menu, or use a fancy drop shadow on your font ... you'll probably start cursing and wish you could use a timeline and some keyframes.

One of the really big letdowns for me was to discover that a quick, easy and nice UI is not going to happen fast in Unity. You can get away with it if you don't need dynamic text to appear, but I need to do a lot of stuff with that, because nearly all of our games are prepared to be played in at least two languages.

How does all that relate to the title?
When I first got in touch with flash (6 I think) AS was really nothing more than a scripting language, coding for the best part was ... shit and most of us messed with onEnterFrames per movielclip. Then AS2 hit the light of the day and with AS3 it came very close to real coding ...
But when I entered the Unity world it seems like the old distributed scripts came back to haunt me. You've got the choice of using a set of different languages: javascript like, c#, boo and some others.

JS on the one hand is easy to use, ridiculously lose typed and commonly used. I really don't like lose typed coding, so for me it was c# ...
Anyway something that commes very close the the old MC based onEnterFrame is Update ... so a script that would move the object 1 "unit" (since we have no pixel) to the left would be:

function Update () {
    transform.position.x++;
}

(or something very close to that, I said I use c#, oh and I'm sure I saw some other methods to do the same)

Save that as a ".js" text file, add that to a cube on stage and viola (there you have the back to script part covered).

I hope you won't be doing that for a complex game, but ... thinking back ... I knew people who did that with flash  ** shudder **.

As I already mentioned, I hate lose typed coding and as I used c# for some years now for coding anyway it was a logical choice (that and the fact that I could continue using Visual Studio).

Oh and did I stress that there is NO timeline?

Everything you want to have animated either needs to be coded (ie for dynamic text) or already be animated in a 3d app ...

Oops, I think I need to get back to work ...

nGFX

ps: just to have something to look at a screenie of the menu (the start of a camera move) of my "test" game to see how I get along with Unity, if everything works well, I might be able to invite for a private beta test on Friday (give me a shout if you want to) ...

pots_menu_de_00.jpg
(the text for the menu was a big lesson in cheating, it uses GUI.Button, btw)

 

Comments (6) -

  • bas

    4/22/2009 2:33:07 PM |

    Nice introduction to Unity, nGFX.

    I’d like to believe that Unity has a great future. Looking at the specs, it covers most of your typical features developers and customers dream about: multiplatform, 3D graphics, tools for map building, networking, etc.

    But really:

    - Stability of the web player is awful. Just now ( when I was writing this comment the FIRST time ) it crashed my real-job’s computer while trying the “paradise” demo on the unity website. While at home I’ve not been able to run it at all.

    - Multiplatform is nice, but Unity LOOKS multiplatform. There’s a shockwavy-feeling to the games I tried. Maybe I’m spoiled with high-end 3D, but I much rather see beautiful 2D than so-so 3D. ( Although I admit I haven’t seen a lot of games yet )

    - I never wrote a line of Unity code. I did however read various stories like yours. And it makes me wonder if developers are prepared to go back to *** shudder *** again.

    You guys look to be smart boy and girls and I’m sure these ‘complaints’ must sound familiar. So now you left me wondering… what was the decisive reason to make the jump to Unity?

    Take care,
    bas

  • Squize

    4/22/2009 4:54:03 PM |

    Just to answer for myself, the choice to move over to Unity was pretty clear cut within the first hour.

    It has rough edges and the scripting isn't anywhere as near as robust or as nice as as3 ( I never thought I'd write that ) but... you know when you're on a plane and it's heading down the runway, and all of a sudden they really kick the engines in and you just feel power ?
    Perhaps a bit of a romantic view, but it's the best way I can describe it. It just does what you'd expect it to and a lot more. There's a lot of wow moments in the first couple of hours, and that's something which is missing from Flex ( Although to be far the profiler did make me giddy ).

    I've never been a huge lover of making 3D games, don't get me wrong I play them on the 360 and love them, just in my own work I'm still very 2D, but Unity is kinda lifting that veil for me and I'm starting to think in terms of what 3D can add.

    As for the games looking pretty poor, I can't argue there. I think the shortage of web games in general, rather than just a shortage of good ones, is that everyone is just developing for the iphone using Unity.
    That will change as the core user base moves more towards Windows with it's lack of iphone ( And Wii ) support.
    But in terms of graphical power, it has got a lot, it's just not being used for anything more than the demo's they have on their site.

    The web-player crashing isn't the best selling point for it :|

  • chrisError

    4/22/2009 7:35:39 PM |

    So I'm about 90% through my first full Unity game (being developed for iphone, which in all honesy, bar a few hours extra debugging hasn't made much difference) and yes, I agree most of the slog work I have done has been on UI ans other such things, which would have taken me no time at all in Flash. But of course, on the flip side of it, I really can now do things which were simply impossible or insanely time consuming before in Flash,  and after my first project I in Unity I am starting to dream up (and 'borrow') some time saving ideas when it come to UI (for example, I like the idea of the file names of assets having their x,y locations in them and using that to position them and I am sooo writing a tween class for it).


    I've never really had any crashes that I can remember in the web player.

    ChrisError

  • Jeff Fulton

    4/22/2009 10:14:39 PM |

    I want to get to Unity, and after your description, nGfx, I think it is pretty similar to my experience with pure Flash Develop AS3 coding. No access to a timeline, no easy to use UI objects, frames, etc, but pure power at your finger tips. If I feel that way about Flash Develop, I'm going to be blown away by Unity. Still, I have trouble finishing games for the SWF platform, so I bet I'll have more trouble trying to finish a 3D game. Oh well.

  • nGFX

    4/23/2009 8:07:07 AM |

    So here we are, talking about leaving what made us rich ... flash :)

    Lets write down some replies:

    bas: (I'll just hop through you list if that's ok)
    A quick note first: there have been other plugings that promised to deliver 3d and interactivity to the web (anark might be one to mention, and it had a timeline if I recal it right), but what hit me first with unity was that I can code c# with it (later more on that).

    - stability: I must admit I didn't had a crash for the web player (a few unrelated with the IDE, but I'm used to that from flash), the Island demo on the other hand is a beast, if you look into the file there really is a lot going on (like the grass and a few hundred trees, some advanced light effects - so it might also be the gfx card driver that fucked up there).

    - multiplatform look: true, but then that is a fault of what have been done with it so far, not a fault of the player/engine. See all the shitty mouse avoiders that pester the web, done by script kiddies ...
    I believe that right now there are more coders using unity than artists or teams (and you can spot coder gfx in most cases). We are in the luck positition that we can deliver 3d and code (and I think I can do some decent 3d if I need to, and do the coding)

    - coding: well, yes it very much looks like a step back, but then again you can do a lot of code only stuff once you got into the "unity-style", on the plus side, you can prepare some code and hand it of to an artist which simply drags and drops a level for the game.

    The reason to jump on the unity train for me was (as Squize said: power). With Visual Studio I'm able to use one of the best coding environments I came across, I can do decent 3d, so I don#t need to fiddle with bitmaps and it not flash (because Adobe's nice price policies pissed me off big time here in Germany).
    Another reason is that there are right now no script kiddies pestering the market, using their cracked version of f10 trying to make a squid with selling a shit game for shit money (sounds bitter, I know, but for flash games there still seems to exist no sense for quality)
    I admit that there is no market for unity games right now too.

    If you want a deeper chat about it, give me a shout.

    ------------------------------
    ChrisError:
    Yeah, you can get around that pretty easy once you let go the "flash" experience. Though, as I said multi language support really is no plus for unity :)

    ------------------------------
    Jeff:
    Well, you can get away in flash without timeline quite good imho. Tools like TweenLite make up for that easily. In unity however there's a 100% difference between UI and 3d elements.
    It is a breeze to "tween" some 3d object from point A to B, but the UI system is a good deal harder to come by ...

    Quick example:
    Basically to write some text and image into the GUI layer you do it in the "OnGUI" event ...
    void OnGUI {
      GUI.Label(new Rect(0,0, 100, 20), "text"); // writes some text
      if (GUI.Button(new Rect(100,0, 100, 20),"myButton")) {
         // do something
      }

      GUI.color = new Color(1, 1, 1, 0.5f); // from now on everything has 50% alpha
      GUI.Label(new Rect(50,100, 100, 20), "text");
    }

    It's executed line by line and to do some fance moves/fades you need to jump through a few hoops.

    cheers, nGFX

  • bas

    4/23/2009 9:05:58 PM |

    Not that there was a need to, but you guys actually convinced me to take Unity out for a ride ( as soon as time permits, that is. )

    I'll write down my +/- considerations list.

    + Like Jeff, I rarely use the timeline in flash ( nor the Adobe IDE environment for that matter )

    + We've got 3D artists in the team, so graphics-wise I'm ok too.

    + My day-job is mostly about Visual Studio programming ( VB, but grammar aside, C# doesn't SEEMS to be much different )


    - ChrisError and nGFX haven't had problems with the web player, but I'm not completely convinced yet.

    - WTF? No market for Unity games? Well, there's always the risky road of publishing on our own.



    Recently we did a 3D-ish flash game that had to be playable full-screen because our customer insisted. Although I was quite impressed with the result ( yes, blowing my own trumpet here ) I admit that Flash is not a really good environment for 3D. We've got another project around the corner; possibly 3D and definitely CD-distribution, and it's looking to be a candidate for Unity.


    Coming back to your offer; I'd love to see what you're brewing nGFX, show us what you're doing with Unity! And give me teh codes, lolz!

    bas

Comments are closed