Archive for the ‘apple’ category

Project Sadist: Dev Diary #1

October 19th, 2014

Hi all, thought I’d update you with the current status of the game.

Things have been pretty busy recently so development has slowed down to a crawl, that being said I occasionally have time to work on it. The process I’m currently working on is the main bulk of the games scene with the intention that once working I can issue a few arguments into the scene and the game will populate meaning I can split my code into essentially two sections which should dramatically simplify things. This scene is soon to be finished and I am currently working on a few bug fixes, optimisations and general layout & look improvements.

Optimisation is something I’ve been working a lot on recently I had problems a little while ago with some code I used to generate borders on gameobjects and… well… it went bad I went from having 200~ draw calls a frame to over 1000 draw calls, this piece of code has gone through 3 transformations now but we’re finally at one with code that brings the draw calls back down to 200. A lot of this was due to rendering multiple 3D objects at real time to give the appearance of rounded edges whilst the new code now generates textures during the build setup so these can be cached and loaded instantly from RAM. Another series of optimisations had to be done to work of the current state of the users interactions and as this was part of the code this affected the frame rate whenever run meaning that if animations were running you could definitely see that the CPU was struggling, although this is an awful lot quicker its still not perfect, I may have to use coroutines however this isn’t desirable as the slowdown may manifest some other way. One more area of optimisation will also have to be made for the generation of the level, in the game you can choose settings for the level and it will check and generate the level, this can take a while as the calculation is random, ideally I need to pre-calculate every possible condition, store the valid levels into a database, then when I make a level all I need is a select for the inputs then load a random entry. Although usually it returns a valid level in a couple of seconds it would be nice for this to just generate immediately.

Anyway thats enough from me bye.
PS. I really need to think of a name for the app, no way is Apple gonna left me have the name Sadist in the app title

Shaders not loading properly in iOS Unity builds

September 24th, 2014

It’s that classic routine everything works in your game but when deploying to the device everything goes wrong, this time its due to unity’s shaders, you’ll most likely see something like this inside of the ios’s console logs

NullReferenceException
  at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00000] in <filename unknown>:0

So whats going on here, we can see that the error is clearly with the shaders and the issue is that it can’t seem to find it. Let’s fix it

What should happen but doesn’t work
Shaders take up disk space and theres an awful lot of shaders that you can add, unity gets around this by only including shaders that you use in the scene. However some times you only mention the shader in the code so you need to inform unity to include specified shaders this can be done by going into:
Edit -> Project Settings -> Graphics
In this menu you can amend the array to include your added shaders, however closing the application and rerunning it shows the shaders no longer there so essentially nothings being saved, somethings going wrong here, and this is why you are getting the issue

The fix
Basically these can be fixed by ensuring shaders are available in the scene in edit mode, create a new material for each shader you want to use and add each to an object, I prefer to add these as child objects to parent with an empty scale, this way you can store it as a prefab and use it on multiple scenes.

Once built the ios device should be able to find the shader and your game can load again, happy days

Modifying Apple Propriety Audio Software

January 26th, 2009

So I’m sitting here in the office during my lunch break watch Hak5 (Mad props) and I’m looking for something to do, this is when I realise all of my mp3s on my server and that I need to get them onto iTunes at home. The disadvantage is that im not at home and I’m on a very slow network connection (500k for the whole office!!) so I’ll need something light preferably over ssh. Thats when I remembered Atomic Parsley.

Atomic Parsley is a little unix application (windows available through cygwin) that allows you to edit the metadata inside of the m4a files (note I convert mp3 to m4a with pacpl and don’t start with ‘quality issues’ the audio is for me and no one else). The website explains that the tags inside are now refered by Apple as Atoms and take 4 bytes for each Atom. With this you can modify almost all of the data needed in your collection.

This is particularly useful if like me you have a strict policy on the content in your Library to allow better workings on it, with this you can just drag’n’drop your m4as into the library an itunes will do the rest

Atomic Parsley can be downloaded at http://atomicparsley.sourceforge.net/