It’s pretty easy to setup an Orthographic Camera in Unity, but without paying attention the settings can cause us numerous problems when it comes to sprites, textures and the quest for pixel perfect graphics in our games.
When wanting pixel perfect graphics it is important that we set the camera size to give us a 1:1 pixel/texture ration between Photoshop (or your alternative) and Unity.
For example, if our game resolution is set to width = 960px height = 640px and our camera size is set to 5 a Unity cube (scaled at 1,1,1) will be the equivalent of a 64px by 64px square in Photoshop. This means that our game screen will have space for ten 64px sprites stacked on top of each other.
Many game devs will prefer to work with a set size in Photoshop and then adjust their camera setup in Unity accordingly. Depending on the resolution and the target Photoshop size this can require some complicated trial and error. However an untraceable contributor in the comments section of Rocket 5’s wonderful tutorial series on 2D in Unity , provided a formula thus avoiding the trial and error.
Camera Size = x / ((( x / y ) * 2 ) * s )
x = Screen Width (px)
y = Screen Height (px)
s = Desired Height of Photoshop Square (px)
It’s a formula that works perfectly and I have setup a calculator to make the calculation process even easier via my Pixel Perfect Camera Size Calculator – Google Doc. Feel free to share, use and download as you wish.
An orthographic camera is commonly used when designing 2D games within Unity and setting up an orthographic camera is pretty simple:
Step 1 : Set position to x=0, y=0 and z = -10 (any depth that you choose depending on the Z values of your game objects).
Step 2 : Rotation to x=0, y=0 and z=0
Step 3 : Scale to x=1, y=1 and z=1
Step 4 : Change the ‘Projection’ drop-down to Orthographic (default is Perspective).
Step 5 : Set Camera size to 5 (this number can vary – with my game resolution a size of 5 worked).
Step 6 : Create some objects (I added three simple cubes) and change Ambient Light to light grey via Edit > Render Settings > Inspector > Ambient Light (colour chooser). You can use any light colour or if you prefer stick to the default black ambient light and add some lights to the scene.
In a recent interview with Jared Bailey of NoCanWin, he stressed the importance of the prototyping stage for beginner game developers. His comments really struck a cord and I realised that I had to stop working on the look and style of my game ideas and simlply get them coded up in their most basic form to see if they ‘feel right’.
I researched into prototyping further and found some very interesting articles:
Tear Down This Wall – Third Helix : A build to build break down of the prototyping process
Prototyping 101 – #AltDevBlog : Excellent Overview of Prototyping
After soaking these ideas up for a day or two I have been getting deep into a prototype for a game I am currently calling ‘Let Me Fit In’ – a fast paced scroller with a back story of ‘an ugly duckling done good’.
Prototyping is a bit slower for me than most as I am learning a lot of scripting as I go – thank the lord for Unity Answers! I am very happy with the prototype, it is engaging but there is a lot that I need to recode and structure again if I were to flesh out the project but it’s working. I have hooked my Xbox Controller up and it feels great to test play with such a good controller, especially as my game is fast actioned.
A game I am really enjoying at the moment is Cubed Rally Racer, it’s fun to pick-up and play but also engrossing and a rewarding ‘playful racer’. It’s creator Jared Bailey (the man behind NoCanWin) agreed to answer a few of my questions about game development and his game design process. I feel interviews with game developers will be a perfect way for me to learn the craft further and help add to the online community supporting new game developers as they make their baby-steps like me.
Indie Hood Games (IHG): How long have you been making games?
Jared Bailey: I’ve been making games for 12 years now. I’ve been at a couple studios, Presto Studios, Konami and Tetris Online, but I’ve been a full time indie for the past year.
IHG: What was your first real project (maybe unfinished, but the first one that you really got stuck into)?
The first game I ever made was a simple choose your own adventure game. I wrote it in basic on an Atari 400 when I was probably 10. My first professional project was Myst 3. I’ve done tons of small personal games, but the first one I got really into was Cubed Rally Racer.
IHG: What software do you use to create you games?
Unity3d, Max, Visual Studio and I code in C#
IHG: Your games Cubed Rally Racing and Cubed Rally Redline have been released for a while, are you happy with their sales and reception?
I’m really happy with the reception both the games have gotten. People seem to really enjoy them. Sales are ok, enough to pay the bills.
IHG: Can you describe what you were thinking when you first came up with the idea of Cubed Rally?
I was playing Dirt at the time and for some reason I thought combining rally racing with Marble Madness would be fun.
IHG: Which software/language did you use to create Cubed Rally?
Unity3d, Max, C#
IHG: Do you have any early scribblings, artwork, screenshots that you could share with us?
Here’s a video of my Alpha Prototype of Cubed Rally Racer
** IHG ** Very similar to the feel of the real game, a remarkable early prototype! **
IHG: What do you think worked well in the games?
I think they have that “Just one more game” quality to them.
IHG: Your latest game Fist Face Fight is a very different game – which did you prefer making?
FFF was a struggle to make. The original idea was a little half baked, but I just kept prototyping until I had something I liked. The Cubed Rally games basically popped into my head fully formed and I loved my first prototype.
IHG: What is the project you a working on now?
I’ve been making lots of failed prototypes, but I think I’ve found one that’ll work. Wish me luck!
IHG: Do you own an Ouya? Will you be releasing games on the Ouya?
I don’t. Not right now, but I’ve thought about it. It’s tempting.
IHG: How much do commercial pressures impact on your design process and creativity?
I’m making commercial products so the business side is something I do think about, but not in the beginning when I’m prototyping and trying to find an idea that excites me.
IHG: What game were you playing on your 12th Birthday?
IHG: What would be your advice to people starting out their journey into game development?
Prototype, prototype, prototype. It’s easy to dream up and idea you’re excited about that day. It’s hard to find an idea that will keep you excited through a long development. Prototyping can help filter out those ideas that don’t have what it takes.
IHG: Thanks for your time and looking forward to seeing your next project soon, maybe even in prototype phase!
I stumbled across Chris Deleon who runs an amazing website called Hobby Game Dev which aims to share game development treats to individuals or small teams developing games in the garden shed. He seems passionate about helping newbie game devs into the scene and enticing people into the world of code, builds, demos and the thrills of game making.
There are lots of good articles on Hobby Game Dev but I found the video below to be good motivation and encouragement at this early stage of my game dev lifespan – thanks Chris!
I have been looking at formulating my ‘big project’ idea so that I know where I am aiming at as I learn to create games. Knowing my final destination will help me choose the smaller projects to act as building blocks towards the final game. One game genre that is intriguing me is the ‘playful racer’, it reminds me of happy days racing against my sister and cousins on Nitro for the Amiga in the 1990’s – a truly fantastic game of it’s day!
I was looking to find what is out there at the moment for the ‘playful racer’ fanboy and I stumbled across Cube Rally Racer from Jared Bailey founder of NoCanWin. Cube Rally Racer is a fun isometric styled racer where you have to collect petrol picks, dodge cows, jumps walls and get to the finish line as fast as possible. It’s a good play and it’s a cheap app – well worth the money! I like it’s simplistic (looking) art style and also love the handling of the car. Some good inspiration to be take from Jared’s creation, well done him!
I am definitely drawn to this art style it has a retro/pixel art feel which will fit well with the Ouya’s audience. Phil Fish‘s Fez is a pixel art spectacular and should be included in the Museum of Design’s collection of video games. I will endeavour to research further into isometric game art and how Unity3D aids in the development of isometric gaming.