At Super Icon, our first live project using Unity was a brick-breaker called ‘Brick Break Blitz’.
This was a really fun project to work on, and actually the first time I had ever really programmed (I learnt the basics of C# for the project). My coding was shaky though, so Steve was on-hand to help and handle the trickier bits.
The Unity Wiki was also very helpful, with lots of code examples and advice:
The Answers section on the Unity community site is another brilliant place to get coding advice:
To get things up and running as swiftly as possible, I used one of the Asset Store project templates; the Advanced Breakout Kit (https://www.assetstore.unity3d.com/en/#!/content/5763).
It was a good starting point, although truth be told we ended up re-writing most of it.
Once the kit was installed, my next task was to prepare the graphics. I used Lightwave 3D to create all of the meshes, with the exception of those I purchased from the Asset Store (which I’ll cover in a moment). The models I created included the bricks, ball, paddle, walls, backgrounds and enemies.
In order to get the meshes into Unity, I had to export from Lightwave in FBX format. FBXs are a little tricky as they are supported via a plugin, so not as reliable as native Lightwave objects (LWOs). That said, it didn’t really cause any issues.
The next stage was to tweak the shaders used for rendering the meshes. I used a combination of the Unity default mobile-friendly normal mapping shader, and the following shader add-ons, again from the Asset Store:
Gem Shader – https://www.assetstore.unity3d.com/en/#!/content/3
This is a free shader created by Unity, which renders gem like surfaces – and they look great.
Metal Cubicmap volume 1 – https://www.assetstore.unity3d.com/en/#!/content/3949
Cubicmap is used slightly differently, in that I used the mobile-friendly simple reflection map surface, and applied one of these cubic map textures. The results were brilliant – perfect looking metal, yet optimised for mobiles. I used this for the metallic balls, paddle, bricks and metal walls.
Creating the Levels
Then came the tricky bit – creating the levels. The Breakout Kit only included one level, and that was populated by hand (i.e. positioning the meshes via the Unity scene editor). Not an ideal solution, to say the least!
After a little head-scratching, I decided the best approach was to try a tile painting system. These are usually used for games like platformers, where you position the platform tiles around, but of course lends itself well to a block based breakout type game.
I settled on the Rotorz Tile System in the end, and it worked like a charm. Each of the game bricks were converted to Rotorz brushes, set within a grid size of 16 blocks wide by 12 blocks high. I could then easily paint with the brick brushes for each level, which allowed me to populate levels quickly and easily.
Rotorz can be found here – https://www.assetstore.unity3d.com/en/#!/content/3344
Next up were effects and particles. Again I used Score Flash for the in-game messages, and the 8-bit style particles for explosions and impacts. I also created a few particle effects of my own – once you get started with Unity particles, it is fairly easy to get some good stuff going. Work from example particle systems, study how they are setup, and then start trying to create your own.
Another plugin that came in very useful was Particle Scaler, which allowed me to tweak the overall sizes of the particle effects with a single scale setting, rather than having to modify each element of the particle effect individually. You can find Particle Scaler here:
One more plugin that I can’t recommend highly enough is the Advance PlayerPrefs Window. The Unity PlayerPrefs are where you store things like save data, player progress, options settings and so on. The PlayerPrefs window allows you to view all of these at once, watch real-time updates and edit/delete prefs as you wish. You NEED this plugin!
I included four different ‘themes’ within the game, an ‘Arkanoid’ style metallic theme, an underwater theme, a space theme and a cloudy sky theme. Again the Asset Store came in useful here, in particular the Unluck Software particle sets, such as Toon Clouds:
I also needed a few extra meshes for ‘enemies’ – basically obstacles that float around and impede the ball movement. So I added crystals with the gem shader and asteroids (https://www.assetstore.unity3d.com/en/#!/content/7315), rubber duckies, treasure chests (https://www.assetstore.unity3d.com/en/#!/content/9057) and more.
And there we have it, lots of testing and tweaking later, one Unity game ready to go out into the wild!