Playing sound using OpenAL

For sound I use OpenAL, it’s free, cross-platform, I’ve managed to get it working on iPhone, Windows and Mac. Setting up OpenAL to play a sound is pretty straight forward, a bit like OpenGL. First you need to create a context. ALCcontext *context; ALCdevice *device; device = alcOpenDevice(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); if (device == NULL) { // Handle Exception } //Create a context context=alcCreateContext(device,NULL); //Set active context alcMakeContextCurrent(context); // Clear Error Code alGetError(); Now for the second part, loading a wav file. You have to open a file, fill buffers with data and then attach it to a source. ...

June 10, 2011 · 2 min · 269 words · David Amador

Time for some new tools and editor

Holy cow, this is my 100th post. “Insert epic sentence” Depending on how much time you follow my blog or Different Pixel activity you may know that we have an internal Editor called Sapphire Past It was developed over a year ago with the intent of being a “All in one” 2D game editor for our games, built on XNA. It started out pretty well and I’m very happy with the outcome. It served it’s purpose. The problem now is, most of the stuff we need, apart from the generic sprites positioning, rotation etc, are very specific stuff to the game/project in hands. ...

May 27, 2011 · 2 min · 321 words · David Amador

Indie and day job, making it work

A large percentage of the indie developers have to work on their project at night and/or weekends. In order to pay the bills they have to maintain a day job. There’s no shame in that, many do it, I do it, not everyone can make a mega jump right into fame and fortune with a single project. The rest of us mere mortals have to gradually build a fan base, learn from past mistakes, do better PR, etc. Looking at successes like World of Goo, Braid, Trainyard, it all sounds so easy, everyone quickly makes such huge hype that it seems like they only have to finish the game and they are instantly rich. ...

May 13, 2011 · 4 min · 781 words · David Amador

OpenGL Render to Texture

Render to texture is a very handy functionality. Imagine your game allows for some character customization. You have the body, some different hats, different clothes and other small stuff. Now the easiest way to render this is to just draw it piece by piece every frame. With the proper Z coordinates everything falls in place. But you now have like 4-5 draw calls for one single object. Worse, you might have different textures and swamping textures is expensive. ...

April 29, 2011 · 2 min · 238 words · David Amador

Tracking/Identifying individual touches on iPhone

I got this question the other day, how to track individual touches if you are using a couple of fingers for a game? Actually it’s pretty easy if you can access the touch previous position and it’s current position. Let’s start with a small class to store the information class Touch { public: Touch(); ~Touch(); void update_position(float x, float y){ _current_position.x = x; _current_position.x = y; } bool is_same_touch(float x, float y) { if(_current_position.x == x && _current_position.y == y) return true; return false; } protected: CGPoint _current_position; }; Let’s a assume the “move” movement ...

April 15, 2011 · 1 min · 185 words · David Amador

A little on how to initialize and use GameCenter

Small side-note first, Vizati is now available for the Super Nintendo, more info. For my third idevblogaday post I’m going to talk about Game Center. Game Center was released only a couple months ago (September or so) but already tons of applications are using it and even more, players ask for it. It’s a way to track achievements, leader boards etc. Unfortunately It’s only available from iOS 4.1+, so some compatibility check has to be done. ...

April 1, 2011 · 3 min · 445 words · David Amador

Scripting week

This week I’ve been working on replacing my current scripting system. It worked great for Vizati but I need something with a little more flexibility. Instead of explaining what I’ve managed to get working I’ve made a screenshot with some notes. I think I’m going to make this my #ScreenshotSaturday

March 26, 2011 · 1 min · 50 words · David Amador

Loading images into OpenGL in iPhone

So you can’t make a game without images, right? Well, actually you can but that’s another story. But how can you load a jpg or a png and use then on OpenGLES? First let’s make a simple class Texture2D class Texture2D { public: Texture2D(int id, int width, int height) { _textureId = id; _width = width; _height = height; } virtual ~Texture2D(void) { // Delete Texture from HGL Memory glDeleteTextures(1, ((GLuint*)&_textureId)); } int getTextureId() {return _textureId; } protected: int _textureId; // The reference ID of the texture in OpenGL memory int _width; int _height; }; Now for the code to actually load the image ...

March 18, 2011 · 2 min · 319 words · David Amador

Bringing a game from PC to iOS

This is my first post to http://idevblogaday.com/, I’ve been waiting since November so I’m pretty excited about writing to a broader audience =P. Even though I only have one product on the App Store I have gathered some knowledge on how stuff works to get there. I’ll start by talking a bit about how we made our PC game Vizati to iPhone. When we started, this represented our chance of making games and putting ourselves into test. Without any pre determined rules and/or a major company dictating what to do we were able to have full creative control to try and do something a bit different. ...

March 4, 2011 · 3 min · 627 words · David Amador

Playtesting and Tech support, the other side of the coin

Something that has always been scary (well, it’ still is) before launching Vizati is tech support. No matter how much you tested your game, it’s bound to have bugs. Also what I’ve realized is that I don’t spend enough time testing the game, oh and you too, yes YOU (I’m assuming you’re a developer of course). The past year I gather around a few friends who never played it to test the game for 2 days. 6 people played it the first day, 4 played it on the second day. We gathered around all complaints and issues and addressed them. After that there was more play-testing but not as aggressive. There were 3 or 4 persons testing it regularly. ...

February 18, 2011 · 5 min · 989 words · David Amador