I am a from Brazil, I like game, I like martial arts, I like computers, I like sci-fi and I LOVE making games.

RSS My Blogs

Fixing buffer underrun...

Original_Speeder Blog

The game had a serious problem: The awesome music from xaimus, caused slow-downs and buffer underruns, resulting in the music stuttering (among other undesired effects)

The reason for that, is how ClanLib handles streaming music: It waits for the buffer to end, and then it requests a hardcoded amount of data (1024*16 bytes), if this data is not calculated until the soundcard needs it, the result is a underrun.

The solution then was actually simple in theory, but hard to do for someone that never did it before, I would need to implement a ring buffer, and fill it in the background...

First, explaining what is a ring buffer: A ring buffer, is a buffer of fixed size, that you keep filling data, and reading data from it when necessary, when you read data, you overwrite the data that you just read with new data, it is called ring buffer, because when you reach the end, you start again in the beginning. This solve the problem because I fill it in advance, thus even if the music player slows-down it will take some time until it gets empty.

To fill it without slowing down everything else, or locking-up the game, I decided to make it in the background, so I learned how to use pthreads, a library to make threads (heh, you could not guess it, could you? :P), and it was really simple, all I needed to do was fire-up the player in another thread, and the player constantly fills the buffer, while clanlib reads the buffer, and both of them, before messing with the buffer, check if the other one is using it, so it avoid conflicts.

Although simple to do in theory, I never did that before, and I had several issues, first I accidentally made the buffer misbehave, by forgetting that it had stereo music, thus all addresses should have their values doubled, then I made some logic bugs, and some corner cases that caught me by surprise, like what happened when both pointers went to "0" but the buffer was full, the result was it re-filling again, resulting in the music suddenly skipping forward some seconds. Also I had the usual crashes caused by newbie errors, and etc...

After some extensive testing, seemly this solved all problems regarding music, now the game can play the awesome xaimus music without hassles! And I must say, that xaimus music is AWESOME! (well, for what other reason I would put it in the game?)

Making GNU/Linux port.

Original_Speeder Blog

Yesterday, I decided to give a try on the GNU/Linux port...

First, as some article say, the sound is in a sorry state, the best sound available, OSS4, is not supported by most distros, in fact it is even hated by some, even being clearly superior to Alsa + Pulseaudio...

On the contrary, the default is Pulseaudio, that in the words of their own developer is: "The sound library that breaks your audio", and not only that, but it cause some strange crashes too (some versions of Wine in particular hate Pulseaudio)

But aside from that, most of the problems in making GNU/Linux software are caused by Windows, mostly the non-standard line endings and directory separator (everyone use /, Windows use \, so anywhere in the code that you use "\' works only on Windows, while places where you use "/" works everywhere, including Windows), after some updating of my system (it was a good time I was developing solely on Windows), I just hit the "compile" button on Code::Blocks (that I use both on windows and GNU) and voila! it was done.

Well, sorta... The binary worked, and I can play my game on Linux by plainly pasting that binary in the same folder of the Windows version and then double-clicking it, now what I need is package the binary for the various distros and etc... Something that I have no idea on how to do, because I never did before (before, I distributed the source of my software...)

This proves that if you want, cross-platform development is dead easy and cheap, there are no excuse to not support GNU/Linux and Mac (well... Mac has the issue that you need one, and they are bloody expensive, but let leave this for another day).

So, Kudos to Steam, Doom 3, and the indies from Indie Humble Bundle!

Learning about PR, the hard way.

Original_Speeder Blog

Here I am, in Desura and IndieDB, doing stuff that I tought that I would never need to do...

While in university, I had several classes with a teacher that worked at Eletronic Arts as leader of the marketing team (I dunno his actual title, probably South America Marketing Manager or something like that), he taught us business administration and marketing.

I tought that I would never use the marketing parts, specially PR (not press release... but "Public Relations"), also I always tought that mouth-to-mouth would spread anything that I want fast...

So I released my first prototype, and wrote in my site to people don't hype it, mostly because I feared they would go around badmouthing the game, since it was my first public release...

Well, the game turned to be awesome as I wanted, not a single hater showed-up, and some people already turned into rabid fans, but they all did what I asked, and did not spread the word, soon I noticed that I was not getting sufficient amount of testers, almost all feedback was positive, never negative, and when I want feedback to know what to fix, this is a problem.

To solve that problem, I came here to this site, published the game, and hoped for the best... Then I remembered my PR lessons, and so I went to prepare everything, I learned the hard way, that without doing marketing and hype, I will not build a good community, and without a good community I won't get even testers, meaning that during release I would not get sales either. So I made a Twitter account (twitter.com/agfgames for those wondering...) I took my time to wrote my first press release ever piece to be published here on IndieDB (and I got featured on the first page! It is awesome! Even with my english that I learned playing fan-translared JRPGs!), and on four days, what I have is a rank around 100, from 2000, of course, it is a low amount of views compared to stuff like Platinum Arts Sandbox from my friends Hirato and Calimer (btw: It is a great engine, I used for a university project), but it surprised me, it got popular faster than I ever thought it would be, but of course, this would not happen without some hard work.

So, thank you all IndieDB people that are already my fans, and now you know, that you not only can spread the word, but I encourage you to do so! Let's build a community around a lovely arcade game, and let the high scores roll!