• entries
383
1075
• views
352190

# Brixtar v0.2

81 views

I've got the next version of Brixtar ready. In terms of raw gameplay features it's pretty much the same as the original, except for the following additions:
• Mac OS X support. Brixtar is now multi-platform. My brother has tested a slightly earlier version on his PowerBook so I'm fairly sure it should work on both PowerPC and Intel Macs. I'd be grateful for Mac users to give it a go.
• Mouse and joystick support. As requested, you can now play Brixtar with the mouse, which makes it a lot easier to hit the ball.
• Sound effects. I've put some generic beeps for when the ball hits something, or when a powerup is collected. I'll probably replace these with something a bit more refined in a later version, although the beeps do have retro charm. Press F2 to toggle sound on or off; Brixtar should remember the setting for the next game.
• Pausing now prints "Paused" on the game screen. The game also automatically pauses when you minimise the screen. It should also stop that "blue screen of death" problem with restoring a screen after being iconised.
• Added in a readme file and an icon. I still need to get icons to work on the Mac OS version, since I don't know how to do that and my limited attempt failed.
• I think I've solved that annoying freezing problem with multiball, but I can't be sure whether it's solved for all platforms (it seemed to be a particular problem on Vista 32-bit).

With mouse support the gameplay is probably now totally unbalanced. I'll need to play the game a fair bit myself (from the perspective of a player, not a debugger) and see what needs to be done. Or I might just post a link up on the design forum and get the GameDev.net crew to do it for me.

There's also an issue Kazgoroth brought up a little while ago that I haven't fixed; it seems balls can occasionally bounce of the top of the screen. I've seen that happen when debugging when I was doing something strange, but I haven't seen that in normal gameplay. It'll be easy to put in a hard code hack fix to stop that condition, but I'm worried there might be a subtle logic bug in there I need to track down.

The most annoying problem to solve for this edition was that freezing on multiball. After trying it out with debug code myself I was able to replicate the error on Windows XP, so I assumed it wasn't a platform problem with Vista. I checked the main gameplay loops for hang conditions but it didn't seem possible. Eventually I had to crawl through the code to find exactly where the hang position was.

It turned out my gut reaction was right and it was a while loop, but not the one I was expecting. It was this little bit of code here that regulates the speed increase on the ball:

    if (isOnPaddle)    {                 // don't do anything if stuck on the paddle        my_accelTimer = 0;    }    else    {            // see if we need to acclerate        my_accelTimer += timeDelta;        while (my_accelTimer > 0)        {            xVel *= ACCELERATION;            yVel *= ACCELERATION;            if ((xVel * xVel + yVel * yVel) > (TOP_SPEED * TOP_SPEED))            {                float speed = sqrt(xVel * xVel + yVel * yVel);                speed = TOP_SPEED / speed;                xVel *= speed;                yVel *= speed;            }            my_accelTimer -= ACCELERATION_TIMER;        }            // move the ball according to the velocity        xPos += xVel * timeDelta;        yPos += yVel * timeDelta;    }

Since my timer class was affected by the global timer (which caused problems with pausing, as this timer wasn't stopped) I'd changed the timer from a special timer class to an interal float called my_accelTimer. Unfortunately I stupidly forgot to initalise it at the start of the ball class. This wasn't a problem for the first ball, as it always spent some time stuck on the paddle. But for multiball, my_accelTimer could be anything. It turns out for me it nearly always is zero, but occasionally it's something ridiculously large which causes the while loop to run (virtually) forever. I'm hoping this is the halting problem on Vista 32-bit.

Now the second week is over, I'm not sure I want to leave Brixtar as it is forever. Reviewing what I'd like to get done, I think Brixtar will make a great test-bed for new game features. As I add more functionality to the Diagonal Game Library I'll add more code into Brixtar as a first test; probably start with a menu system, maybe a mousr cursor in there, and end up with a full blown level editor.

But with the MAGIC contest tomorrow, it'll be time to put Brixtar to the side for a week while I work on something else. I don't think I'll be making anything too fancy on the contest theme (I'm not in the competition, after all), but it'll be good to have a second game to act as another test. It's a pity I didn't get more time to add more features to the library though; I'll have to go with the same functionality as I have for Brixtar.

P.S. Mac programmers; how do you get an icon to be associated with an application? I'm not sure if it's because I was using a Windows icon or I just misused the Info.plist file but it didn't seem to work for me.

A Mac icon has to be in the icns format, otherwise you have it set up right. I use Icongrapher to convert images to the format.

Quote:
 Original post by soggyfries A Mac icon has to be in the icns format, otherwise you have it set up right. I use Icongrapher to convert images to the format.

Ah great, thanks. I hoped it would be that simple, but I couldn't find an app on my MacBook Pro that easily converted images to icons and I didn't want to delay the v0.2 release. I'll try it out for the next version.

FWIW, IconWorkshop will make Mac icons, as well as all formats of Windows icons. I can't recommend it highly enough.

Hi Trapper,

I can confirm that you have fixed multi-ball for Vista 32-bit :-) at one point I had 6 balls flying around the screen. Well done.

Quote:
 Original post by ukdm Hi Trapper, I can confirm that you have fixed multi-ball for Vista 32-bit :-) at one point I had 6 balls flying around the screen. Well done.

Thank goodness [smile]. I'm glad you can now play the game!

## Create an account

Register a new account