Submitted by bensmiley on Wed, 05/09/2012 - 17:40
In this article I'm going to explain how to store complex game or app data using the NSUserDefaults object in iOS. User defaults is ideal for storing structured information like: game state, high scores, game progress information. If you need to store unstructured information which you will be accessing by using SQL queries then you should use a built in database instead.
Submitted by bensmiley on Fri, 05/04/2012 - 02:25
In this article I'm going to explain what a game engine is and why it's useful. When I first started game design many terms confused me. I heard: game engine, sprite, game loop, physics engine, Cocos2D... I had a rough idea of what they were but not how the concepts fitted together. With the benefit of the experience I now have, I'm going to explain what all this things mean and how they fit together. This guide is designed for people who are new to game design and will focus and iPhone and Android operating systems.
Submitted by bensmiley on Thu, 05/03/2012 - 00:13
I'm currently working on a Cocos2D game which uses a lot of particles. Several times a second an explosion is triggered an every three seconds the background particle emitter changes. When I first coded the game I wasn't worrying about optimisation so I just loaded the CCParticleSystems from file each time I needed them. Now that I'm nearing completion, I've been looking at optimisation. When I profiled my game using Instruments, by checking allocations, I noticed that my emitters were causing a horrible memory leak. My game would start off running at a snappy 60 fps.
Submitted by bensmiley on Tue, 05/01/2012 - 18:42
Today I was doing some web design for one of my clients and I came across a frustrating problem. I wanted to provide a white background for a block of floating text. I setup a div container outside the text with a background colour set to white but the div container didn't contain the text. It appeared to have zero height. I could set the height manually in pixels but I needed the div to expand automatically to contain it's child elements.
Submitted by bensmiley on Tue, 05/01/2012 - 18:09
My general experience of CoreAudio on iOS is that it's logically put together and very powerful however woefully lacking in documentation. Even the simplest thing can take a morning of searching the internet to work out. I've decided to blog about the issues I come across to try to help save people time in the future.
In this post I'm going to explain how to set up a mixer to mix a number of CoreAudio channels to one output module. Then, how to change the output volume of the mixer.
Submitted by bensmiley on Wed, 03/28/2012 - 20:34
In this article I'm going to explain how to draw custom polygons using Cocos2D and OpenGL. Cocos2D has the capability to draw primative polygons using the ccDrawPrimative class. This however comes with some limitations:
- It is not possible to draw filled polygons
- The functions are primative OpenGL commands which means that you can't take advantage of Cocos2D's node actions
To get around this I've written a PolygonNode class. This extends Cocos2D's node object and allows you to create nodes which contain custom polygons.
Submitted by bensmiley on Tue, 03/27/2012 - 19:36
Here's a list of useful CoreMIDI and CoreAudio resource I've come across while writing my current iOS application.
There are a surprising number of example projects available involving CoreAudio. The problem is that they're hard to find. When I first searched I found hardly anything. After several days of digging I had a large amount of reference material.
Submitted by bensmiley on Tue, 03/27/2012 - 01:12
JavaScript Integer to Hex Converter
A simple Hex to Integer converter that I wrote using JavaScript.
JavaScript universal base converter!
I thought I'd have some fun and create a universal converter
Submitted by bensmiley on Wed, 03/21/2012 - 23:27
So in this post I'm going to explain how to produce MIDI driven animation on OSX or iOS using the CoreMIDI and CoreAudio frameworks. When I first started trying to do this I thought it would be easy - just register a callback in the MIDI player which is called every time a MIDI message is played. Unfortunately this is not possible and I ended up spending three long days figuring it out from the limited documentation available. Hopefully this post will save someone some time!
Submitted by bensmiley on Tue, 03/13/2012 - 00:08
This is a short post which might be helpful to some people who are using Box2D. If you want to filter collisions in Box2D you need to use mask bits. In order to manipulate mask bits you need to use Java bitwise operations. For a project I'm working on I need to store these mask bits and bitwise operations in a text file. The information then needs to be parsed by Java to create my mask bit. I need to parse strings in the form: ~0xFFFF&0x0001. Java doesn't seem to be able to parse this kind of string natively so I wrote a simple function which does the job:
Pages