It’s Been Awhile

My posts have become infrequent but I haven’t given up on game dev. Too many things going on so blogging was put on hold. To get me back in the habit I decided to at least provide an update on what’s been going on.

MetaWorld

After completing In Space, No One Can Hear You Dance, I started working on a much bigger, more ambitious project. MetaWorld is an open world VR experience where players can explore a huge world with others. This project has been super challenging for many reasons. The first being I’m the only developer. This is made even harder by the fact that VR is so new that I often need to rewrite entire systems when something doesn’t work. On top of that, being an early adopter of SpatialOS has presented many challenges. The Improbable has been working hard to create better documentation and a more stable API but the journey has tested my resolve. Also, building on top of SpatialOS requires a much different approach then commonly found in game development. The results though have been great. Creating something new that hasn’t really been done before is very satisfying. An awesome moment for me was talking to Rachel Webb from GamesIndustry.biz. She really captured why this project is so special.

There is more to come for MetaWorld as well as more challenges but nothing great is every easy.

Wordsum

Wordsum reached a big milestone with 1,000 downloads. I never honestly thought I would make a game that this many people played. I still want more downloads but I’m also very happy with this number. Being my first complete game, Wordsum is special to me so I don’t see myself letting it die.

Wordsum Blitz

This game has been a long time coming. The original Wordsum opted for a level based design to give the player a sense of progress. Originally, I wanted to make Wordsum a score based game that never ended much like Tetris. You simply just try to get the best score and compete against friends. Instead of adding this to Wordsum, I wanted to make a new game that was lighter, without ads, without IAP, with better art and that was straight to the point. Over the past year, I’ve slowly made updates and changes but only recently has it been looking like a finished game. The last little bit that I had to overcome was performance. With that finally conquered you can expect Wordsum Blitz very soon.

Donut For The Gods

Oh this poor game. Unfortunately Donut for the Gods has received the least of my attention. It’s not abandoned though. Once Wordsum Blitz is released I will begin the slow struggle make progress. The gods will get their donuts!

Use Texture Atlases to Improve Performance

Performance is always on the top of every game developers Todo list. It can be the make or break for how player’s respond to your game. Wordsum was a mobile game so that meant I had less power to work with if I wanted to reach the mass market.

Lowering draw calls are a simple way to improve the performance of your game. It’s simple, if the game performs less draw calls, it has less to do. So your first question might be, “How do I know how many draw calls my game is making”. Unity provides a great tool for this called the Rendering Statistics Window. The best part is it’s available in the free version of Unity. To open the window, click the tab in the editor viewport.

 Click the Stats tab/button to show the Rendering Statistics Window
Click the Stats tab/button to show the Rendering Statistics Window

When you run your game you will get live statistics. The thing we are interested in is the Set Pass Call number.

 The Draw Call number is highlighted in red. Fyi, SetPass calls is Draw Calls.
The Draw Call number is highlighted in red. Fyi, SetPass calls is Draw Calls.

Getting this number as low as possible helps save of CPU/GPU cycles. We will be using Texture Atlases to accomplish this.

There are some good paid tools out there to help us create the Texture Atlas. One of these is the highly regarded 2D Toolkit. Since I had a tight budget I ended up going with Simple Sprite Packer which gets the job done.

First thing you will need to do is import the Simple Sprite Packer package into your project. This adds a new context menu to the Unity editor. Find a place where you want to create your Atlas. Right (or command click for mac users) and select  Create -> Sprite Packer.

 Select Sprite Packer from the menu
Select Sprite Packer from the menu

Name it something appropriate and save. This will create two objects in your folder. The first is the Simple Sprite Packer object you will use to create the Atlas. The second is the image file that will be the actual Atlas.

 On the left is the Sprite Packer object. On the right is the Texture Atlas
On the left is the Sprite Packer object. On the right is the Texture Atlas

Select the Sprite Packer object. The inspector will display the options you have for creating the Atlas. You can leave most of these unchanged for now and start creating your Atlas. You can either drag your images one by one into the green area or for speed use the Sprite Packer -> Drag and Drop Window located in the Unity toolbar.

Note: Make sure the sprites you are adding to the atlas are uncompressed or Simple Sprite Packer will complain.

Once you have added all your sprites, select Rebuild Atlas. You have now created a Texture Atlas. Congrats! The only thing left is to swap out references to the individual sprites to your Atlas. Once your done, rerun your game and you should see a big drop in draw calls and hopefully improved FPS. 

Circle Colliders For Better 2D Game Touch Controlls

Making Wordsum was a great learning experience for me. I had never done a 2D game before and found the challenges much different than working in 3D. One of the most important issues I ran into was the feel of the game in regards to selecting the letter blocks. At first, I only supported tapping each letter to create a word. I found through much play testing that people expected to be able to slide their finger to select multiple letters.

It was easy enough to add slide selection to the game but something was not right. People were having a really hard time selecting letter blocks diagonally. The problem ended up being my use of colliders. Each letter block had a 2D Box Collider which handled both collision with other letter blocks and the player’s touch input.

 The green boxes are the Box Colliders. Notice how there is no room in between each collider. 
The green boxes are the Box Colliders. Notice how there is no room in between each collider. 

The problem with this approach is when the player tries to slide their finger in between two letter blocks to make a diagonally selection. For example, in the picture above this would be word C-A-T. Most of the time, the player would end up selecting C-L-A or C-T-A instead of what they wanted. This was due to the box colliders being so close together. Player’s got easily frustrated during play sessions and only used tap selection instead.

I was able to fix this by doing two things. The first was using a collider for collision detection between letter blocks and another collider for the player’s touch input. The second thing was creating a child Game Object of the letter block prefab and using a Circle Collider instead of the 2D Box Collider. This allowed the player’s finger to slide in between two letter blocks much easier.

 The Circle Colliders allow for more space in between letter blocks
The Circle Colliders allow for more space in between letter blocks

The results were very positive. After more play testing, there was less irritation with selecting letters. Players said the game “felt” better. The best part was this fix didn’t take long to implement. Moral of the story, don’t use 2D Box Colliders for everything. A simple concept which seems so obvious to me now.

 

Unity GUI Woes

Todays challenge isn’t some crazy null pointer bug but the ever elusive responsive GUI. When you thought that everything is cool, that brand new GUI element you tested over and over just doesn’t work on one device. I went to test on iPhone 4s and this is what I got.

Don’t get me wrong I do love Unity’s new GUI system much more then the previous one. I just feel like I spend more time on my GUI then my actual game…