Sunday, April 20, 2014

Unity Engine Tips & Best Practices - Mobile Games

I've been working on the Unity game engine for more than a year now and this year I happened to attend GDC 2014. Here is what I gathered from a combination of sessions and from my own experiences. If you're a Unity developer here are some tips that might come in handy or will reaffirm your faith if you already know them:

On Game Testing
Always test your application on the latest devices. Never test on jail broken devices because their behavior may vary from the regular devices which might skip a problem or reveal one specific to a device.

If you're working on the iOS platform keep in mind that the iPods touch's specs are always one step behind its current generation which means that the 5th generation iPod will not give your the same performance as the 5th generation iPhone. In short iPods is not a non-cellular version of the iPhone and their memory and GPU performance is always too low compared to the screen size. Just a heads-up though, if you ever consider knocking iPods off your list of supported devices, iPod 4 was one of the most sold iOS devices.

Profiling and Optimization
Use the profiler throughout the during of your project. Profiling and optimization should not come as an iteration once everything is done. I can relate to this point from my personal projects as well. If optimizations are pushed back till the end, they will add unnecessary development time.

While working on Run Sheeda Run, we had already decided how and which textures will be divided into atlases but we still used individual textures which took more than a day of artist's time. On the other hand the GUI textures were all bundled into atlases because NGUI dictates it which prevented us from making the same mistake we made with the rest of the game assets.

Unity profiler makes a build unplayable which is why developers avoid it until completely necessary. If you're working on the iOS platform, this is where the XCode's profiler comes in. It gives you the basic statistics which include CPU and memory usage, along with the FPS.

Best Memory Practices in Unity
Use the Resources.Load feature for assets there are used very rarely in the game. This does makes the code slightly complicated because its always easier to drag and drop prefabs in the scene but on mobile devices, its worth the effort. Don't forget to pair it up with Resources.UnloadAsset or Resources.UnloadUnusedAssets as needed.

Best Lighting Practices in Unity
If flat shading is not going to work for you in a particular project, a lot of visually appealing games make use of light probes, which fake real time lighting. Lightmaps are baked into the textures and use virtually zero memory.

Asynchronous Load Screen
Until very recently, I thought that Unity only provides only a single way to load a new scene (Application.LoadLevel) and that you cannot display an animated loading screen. This might have been extremely obvious but if you didn't know Application.LoadLevelAsync lets your load a scene asynchronously. Which means that you can display a progress bar or an animation while the game loads.

Multiple Screen Sizes
There are too many devices with varying screen resolutions out there, even if you're working on the iOS platform. It's best you're already prepared for it before you starting working on a project. Fortunately, Unity makes it really easy to calculate the aspect ratio of a device and according to that you can adjust your UI components. How to determine screen size using DPI is a blog post by a colleague at we.R.play that provides a code snippet that will might in handy.

Building for Windows Phone
  • When building for a windows phone device, Unity first creates a Visual Studio project. The native code of the application is stored in App.xaml.cs file.
  • Unlike iOS and Android, Visual Studio's simulator is supported for Unity applications.
  • Additionally, unlike iOS and Android, the application icons need to be manually added in the Visual Studio project. 
  • If you're too used to working with the Visual Studio IDE, good news for you, it can be used with Unity as a replacement of MonoDevelop.
  • If you are making use of custom shaders, its a good idea to test with different version of DirectX to be sure that the shaders' behavior is as intended.

Citation:
Apart from my own and my colleague's experiences at we.R.play, this post contains a lot of tips I learnt from the following GDC 2014 sessions:

- iOS Games in a Day by Gareth Jenkins
-Your Unity Game in More Hands presented by Microsoft

Saturday, August 31, 2013

CustoMac Project # 2


My second hackintosh project after the success of the first one. This one has the following specifications:

Motherboard: GA-B75M-D3H
Processor: Intel Core i5 3550
GPU: Inno3D GT640
RAM: Kingston 8GB DDR3 1600MHz
HDD: Seagate 500 GB
SSD: Corsair 64GB NEUTRON
PSU: 420 W
Operating System: Mac OS 10.8

Just like last time, I created a bootable flash drive with UniBeast, and ran MultiBeast after installation. The following guides were really helpful:

http://www.tonymacx86.com/mountain-lion-desktop-guides/70359-beastly-success-gigabyte-ga-b75m-d3h-100-a.html
http://www.tonymacx86.com/golden-builds/58062-moarfishs-build-ga-b75m-d3h-i5-3570k.html
 

Saturday, June 1, 2013

CustoMac Budget Build



Here is my build for a very low priced customac: 

Motherboard: GIGABYTE GA-H61M-DS2
CPU: Intel Core i3 - 3210
GPU: Nvidia 8600GT
RAM: Kingston DDR3-1333 8GB
Mac OS: 10.8

All I did was use unibeast to make a bootable USB and install the Mac OS. Then I used multibeast to set "PCIRootUID = 1". Everything is working fine except the sleep mode; the hackintosh does not wake up once its in sleep mode. I tried a few solutions but haven't been able to make it work yet.

References:
http://www.tonymacx86.com/
http://www.macbreaker.com/
http://www.hackintosh.com/

tonymacx86.com was of enormous help. It is the best place to start if you're new in the hackintosh community.