# Pixel Perfect Calculator for Orthographic Camera : Unity3D

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 )

Where:
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.

# Orthographic Camera Setup

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.

References

1. Overview of the Camera Class – Unity 3D Documentation
2. Detail on the Orthographic Camera – Unity 3D Documentation

# The Quick Joys of Prototyping

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:

1. How to ProtoType a Game in 7 Days – Gamasutra : An excellent read with numerous pointers by a group of indie dev’s who started the Experimental Gameplay Project.
2. Prototyping for Games – Applicus
3. Tear Down This Wall – Third Helix : A build to build break down of the prototyping process
4. 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.

I have found the following key points from the Experimental Gameplay Project, about prototyping really useful:

Setup: Rapid is a State of Mind

• Embrace the Possibility of Failure – it Encourages Creative Risk Taking
• Enforce Short Development Cycles (More Time != More Quality)
• Constrain Creativity to Make You Want it Even More
• Gather a Kickass Team and an Objective Advisor – Mindset is as Important as Talent
• Develop in Parallel for Maximum Splatter

Design: Creativity and the Myth of Brainstorming

• Formal Brainstorming Has a 0% Success Rate
• Gather Concept Art and Music to Create an Emotional Target

Development: Nobody Knows How You Made it, and Nobody Cares

• Build the Toy First
• If You Can Get Away With it, Fake it
• Cut Your Losses and “Learn When to Shoot Your Baby in the Crib”
• Heavy Theming Will Not Salvage Bad Design (or “You Can’t Polish a Turd”)
• But Overall Aesthetic Matters! Apply a Healthy Spread of Art, Sound, and Music

General Gameplay: Sensual Lessons in Juicy Fun

• Complexity is Not Necessary for Fun
• Create a Sense of Ownership to Keep ’em Crawling Back for More
• “Experimental” Does Not Mean “Complex”
• Build Toward a Well Defined Goal
• Make it Juicy!

# Interview : Jared Bailey – Cubed Rally Racer

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?

It was probably Spy Hunter.

IHG: What is your favourite game of all time?

It’s a tie between Counter Strike: Source and Battle Field 1942 Wake Island Demo.

IHG: Is there any game designers that you particularly admire?

I really like what Vlambeer (@Vlambeer) is producing.

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!

# Inspiration : The Truth About Game Dev

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!

# Tip : Designing an Isometric Game in Unity3D

The idea of isometric art in video games is normally to make a 2D game look 3D, a lot of effort goes into making this work and look right.

Our friend Unity3D helps us out a lot here, to setup an isometric game all we need to do is adjust the Main Camera settings to give us a isometric view of our scene.

Step 1: Select Main Camera from the hierarchy

Step 2: Within the Inspector and under the Transform tab change the Main Camera’s position as follows : x = -10, y = 15, z – 10

Step 3: Within the Transform tab change the Main Camera’s rotation as follows: x = 30, y = 45, z= 0

Step 4: Under the Camera tab select ‘Orthographic’ from the Projection drop-down menu, which is normally set to ‘Perspective’ as default.

Check Your Work: With a few object in your scene you will see them displayed in the Isometric style within the Game View.

Your settings should look the same as below (Unity 4.1.5):

# Inspiration : Cube Rally Racer

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 NoCanWinCube 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!