Sponsored By

Unity and Flash marriage (Tetris3D in 2.5 days)

Biggest Tetris challenge ever, some notes about a Single player tetris made in Unity3D as a good programming practice (it took only 2.5 days to make). Measure up yourself against the rest of the world by playing it.

Alex Nino, Blogger

December 9, 2012

5 Min Read
Game Developer logo in a gray background | Game Developer

Recently, there is a lot going on regarding to games development. Mainly speaking about how prominent Unity3D is becoming, we can hear more and more people speaking about it everywhere; even my wife (who doesn’t understand anything about games development) asked me these days about it, she said; hey! what’s that unit 3d plug-in for? Is that a kind of Adobe Flash competitor? I said; well to be honest I don’t know enough about it for calling it “competitor”.

About couple of weeks ago there was a conference here in London called bluegfx, mainly focused on 3D production stuff (film industry, cgi effects, etc) and also 3D game development… the Unity guys were there showing off some features and for the very first time I got the chance to look at it deeply. Guys! I have to confess that I fall in love to it same I did in 1998 when I first met Macromedia Flash.

Am I switching from Flash to Unity?

The short answer is no. Long answer is; nowadays I am really worried about Adobe’s attitude regarding the Flash platform. It seems to me Adobe cares every day less and less about Flash and for me, in this last quarter of 2012 the big question is; if Adobe doesn’t care about it why should I do it? It feels like those old days when our girlfriend is not anymore into the relationship, she stops feeding it and even worse, she’s interested in other men. Well my friend, maybe it is time to move on.

In my case, I truly love Flash more than Adobe does it, simply because I mainly use it not for making money but satisfying my joy, my creativity… but hey! we are here speaking about business not love, aren’t we? Yes, sorry I forgot about it. Money, money, so should we make things in HTML5? Huggg! once again I will skip this HTML5 part, It feels like going backwards in all senses… let’s just put it in this way; What you can achieve in HTML5 today is equivalent to what we did in Flash in 2003 (and back those days it was less painful). People are very ignorant about Flash and unfortunately these days there are more developers/designers using it wrongly than properly, which is understandable, not everybody have a certain skill set and responsibility to make a decent work in a robust platform that tries to satisfy us all. Sadly, the Flash platform trending is to get worse. I am in the games industry so let’s go back to what we were talking before, Unity!

Just in 2.5 days

Around a year ago Flash made a big step giving us multiplatform support for dealing with real 3D (rendering 3D using almost any GPU chipset), however we all know how complicated things are when dealing with 3D, especially the nature of 3D programs and the way they behave in the GPU. As expected, all what Flash (Stage 3D API) had to offer was something very low level and complex, so the chances of “pick it and go” were a bit low unless we use a third party 3D framework such as; away3d, alternativa, stariling… Unbelievably, Unity came with a solution that makes everything even easier; the whole Unity world is about “multiplatform 3D games” using an IDE which allows us to build our own scenes in 3D by simply using the mouse, isn’t this awesome?

Inspired by the blugfx conference I’ve decided to have a go with it and make a very simple game, a TETRIS game in 3D, which I’ve tried to do in Flash before but unfortunately I have to postpone it over and over again due to the amount of time it was taking me, surprisingly making it in Unity took me only 2.5 days to build the whole game logic and visuals. I am very satisfied with what I have achieved in just 2.5 days of work.

Tetris World Records game play in Unity3d web player

Tetris World Records



Unity exports to SWF (Stage 3D)

Although Unity uses C# as a main programming language, it also accepts a strict version of javascript which looks almost the same to Action Script. However I built the whole game using C# why? I just wanted to try something different. It was my first time with C# and you know what? I loved it!

The craziest part of it all is that Unity exports to almost every platform (Web, xBox, Play Station, Nintendo Wii, iOS, Android), and when speaking about web, it has its own web plug-in but it also exports to Flash SWF which was one of the things I was interested the most. My biggest question was; how on earth does it generates a SWF? How come? The answer is; it understands my crazy logic written in C# and translates it to Action Script… Whoooaaaaaa!!! amazing! the thing is that there are some resources in Unity C# libraries that are not available in Flash so, guess what!? In those cases you can tell to Unity that you have your own Action Script .as Classes and Unity compile them all together when generating your SWF. God! Is there anything else you could ask?

TetrisWorldRecords.com

Once I got the game done (in 2.5 days) I have decided to build its leaderboard so people can submit their score and compete against others. This took me an extra 2 days to get it done and then, and I have to confess that it was here when I decided to named it Tetris World Records, so I’ve registered its domain tetrisworldrecords.com which I am going to leave up and running for very long time, totally for free (no ads, no fees). I am pretty sure I am not the only one here who love tetris.

Also I made a quick test, exporting the game to other platforms (PC, Mac and Linux) it all works perfectly fine in all of them, same game experience. I highly recommend to you having a go with Unity, you will be surprised how easy is to make 3D games.

I hope you liked my Tetris made in 2.5 days.

Cheers!
 
Alex Nino (yoambulante.com)

Read more about:

Blogs

About the Author

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like