Tuesday, 29 April 2014

Cocoa is tough

I'm finding it hard to understand what all the Ctrl+links and delegates are for, which windows need controllers, how they talk to each other, notifications, bindings...
I have a grid and a zoomable canvas now. Next: worlds!

Friday, 25 April 2014

Game on hold for a while

Bad news: I started learning OS X app development and kicked off a level editor project for SpaceTaxi. This will take a while. 

Editing game level text files was fine until I thought of dropping hundreds of power-ups and coins in space. I need a visual editor and a grid to snap to.

I'm taking some code from Apple's Sketch sample project. This is how it looks after a few hours:

Sunday, 20 April 2014

Mo' Buttons!

I can now place working buttons on the HUD layer - the HUD layer is the same resolution as the screen, so things will look more spaced out on a tablet than on a phone, that's why I had to allow anchoring the buttons to any corner or centre of the screen.

Also, the countdown timer down at the bottom gives more a sense of a game, but so far nothing happens when it reaches 0:00.

Monday, 14 April 2014

Parallax background images

Got parallax background layers working. Everything set up from the game level script. In this image there's one "space" 1000x1000 distance units (light-seconds?) backdrop image with a parallax factor of 0.9, meaning it pans at x0.9 the speed of the foreground.

Also there's fire, smoke and sparks coming out of that engine... :-)

I'll soon have to stop adding more stuff in and look at optimising the rendering performance as it's all very raw at the moment and I know there's lots to optimise away.

Friday, 11 April 2014

Now with 100% more text!

Ported text rendering in! This uses bitmap fonts generated by BMFont and applies a colour and alpha to it and any transformation. The text below is being rendered to the HUD layer - a top layer that's always there to have UI controls like the joystick, buttons, text.

Thursday, 10 April 2014


I ported the Objective C particle emitter sample code by 71 Squared onto C++, used libxml2 to read .pex files and let ParticleEmitter objects be Sprites. So now the Rocket game object has one of those and it works beautifully!

The grey circles that look like lens flares are actually the virtual joystick.

Monday, 7 April 2014

Scale, Translate, Rotate...

I fixed all the scaling and translating issues I had in the old GL ES1.1 SpaceCab. Everything works perfectly now according to whatever is in the game level script. Also, I'm detecting and working with the retina x2 displays.

In this image:
- the small planets forming a square are 200 distance units apart.
- the square (1000x1000) is the defined game level area.
- zoom level is set to a fixed 1.0 everywhere.
- the viewport is set at 800 distance units wide.


Sunday, 6 April 2014

Aiming for the Moon...

Fixed the alpha, textures and some of the scaling issues. Rocket is still not centred on the screen and I have to do whatever I did to sprites to image layers and the text renderer.

Saturday, 5 April 2014

Got textures working

After much fiddling, I disabled all objects (text, image layers) but the sprites and I can now see the virtual joystick and an animating rocket. Next problems to fix:
- the alpha is not being applied
- the rocket image is sheared at 45ยบ
- it seems to think the resolution is still 320x480

Tuesday, 1 April 2014

Deconstructing... starting again

So I deconstructed the whole SpaceTaxi project: started a new project using Xcode's OpenGL ES app wizard and copied most relevant classes over from the old project. This also meant discarding OpenGL ES 1.1 and the fixed pipeline and starting using shaders for everything and a custom matrix and transformations class - with ES 2.0, I had lost all the standard transformation functions (glScale, glTranslate, glRotate), matrix stack management (glPushMatrix, glPopMatrix) and quite a lot more. I still don't know exactly what I can count on being available.

After weeks of part-time tinkering, I turned SpaceTaxi from this:

 to this:

And that's a good thing! It's a red sprite being rendered on a green background via my own shaders and transformation matrix. Now that I have this set up, on to getting the game back up!

No more iPhone 3G compatibility :-) but on the other hand I now get retina (was stuck with 2x scaling) and all the power of shaders on my hands.