Racing A.I. Squeezed In how much is left?

So, I’ve established some form of racing A.I. which will at least, keep them on the track a lot better and they still perform some homing in on the player, making them particularly tough to pass easily on the test track at least.

Lap counters, speedometers and damage counters are in place and ALL THE BASICS ARE THERE! Which is really nice, but. I’m pretty much maxing out the CPU on the Classic Gameboy, which means there’s not much more I can fit in before things get janky and framerate-y.

Essentially, I’m now really limited to what else I can add to the game without breaking the Gameboy version (the Gameboy colour version is a-okay though, faster CPU (~8MHz) so more time per frame)

Hopefully some power-ups are possible. I’m thinking either boost pads or boost fuel drops in odd places on the track would be pretty cool to force the player off-line.

I **could** drop the game down to 30fps instead of 60 but I don’t really wanna do that. That smells of just giving up on performance, there’s got to be another way around it.

I need to add some toughness to handling the cars also, make the controls a biut more analogue in the steering. That should make things a bit more interesting regarding mastery of the game.

Animated A.I. Cars (click for big)The Lap count is currently going up from 0 and taking up to much window space so It’s going to be changed over to a countdown instead with “L:XX”. With XX being the number of laps remaining.

There’s only a few days left until the end of the month now and #1gam is looming, I’m still hoping to add a few game modes in there though, including a championship mode, time attack, not to mention intro screens, car selector and results summary. Oh and a password system.

I think I’m going to need to cut-back a bit!

More Gameboy screens in Photoshop

Refresh Games Gameboy Title Screen Game Intro Screen with mode selectNot the most productive day for coding today but, thanks to my sleep pattern being slightly messed up this weekend, I managed to fit a couple of screens of pixel art in tonight / this morning.

The Refresh Games logo needed some Gameboy love and should fit easily into RAM, but, the main title, I’m not so sure about.

Some clever tile mapping will be needed no doubt, I guess that’ll be tomorrows gubbins!

Still, it looks pretty cool there, I used a 3d model of super deformed F1 car I’d made a couple of years ago which just seemed to fit in really nicely when posterized in Photoshop.

We’ll see tomorrow I guess then.

[P.S. most of my tutorial code for part 2 of my GBDK tutorial series is nearly ready also, it just takes a while to write all about it.]

Background collisions, SFX and TURBO!

Well, today went really well, I fixed up my collision routines with the scrolling background, yup, it was using a simple offset, with a case for looping every 32 row increments, seems to work well. Possibly un-optimised but good enough so far.

There’s some rudimentary noises from both cars on screen based on their speed and distance from each other, also collision noises are in there now.

The fuel-o-meter has turned into a working turbo bar to help catch-up or overtake other racers. It’s getting there, but I’m down to 4kb of ROM remaining now and the racer A.I. needs improving on the sly. I’d like to get some BGM in there also somehow.

CPU Usage is getting pretty high now though, so I may need to inestigate into other ways to load my level up. Setting colours for each tile through a switch is probably slower than referencing another variable directly I imagine but, well, a balance needs to be struck.

Tomorrow I’ll most likely be sorting out the code into banks to save space and going from there with more advanced A.I. (Not simple homing, falling of the track A.I.) those cars need to fall foul to going off track also and that’s going to be inetresting to set-up correctly!

Screenshot tonight is from the gameboy classic mode where, yes. Identical cars. I’m not too fussed about that. I am fussed about adding some steering animation though!

Getting There

How To Get Started with Gameboy Development using GBDK

So, you’ve decided to make a Homebrew Gameboy Game using GBDK, Good for you! Let’s get you up and started with some of the vital tools that you’ll need.

  1. GBDK – GBDK Download & Install Guide
    ( I installed my copy to C:\gbdk and will refer to that location throughout this series of tutorials.)
  2. A Text Editor. Programmers Notepad is pretty nice and FREE
  3. BGB (Gameboy Emulator, again FREE and the best one out there.)

Please note that I’ve only done GBDK coding on my Windows Machine so some installation bits may vary depending on your choice of Operating System.

That’s it, that’s the bare minimum you’ll need to get started and get used to bare minimums, because the Gameboy, despite being a well-balanced machine, isn’t powerful, if you’re used to Unity or other modern development tools, this will be quite the step back. Let’s take a brief look at the specs

Yay Gameboy!CPU Speed: 4.19 MHz ( or 0.000419 GHz if you prefer)
RAM: 8kb – Expandable to 32kb depending on your ROM Carts settings

And we’re looking at ROM Sizes between 32kb to I think 1Mb. Not much space, and to start we’ll be dealing with 32kb ROM Size only.

Everything Graphical is Tile-based (8×8) and we have a screen resolution of 160 x 144 Pixels, In 4 shades of grey.

And yes, you can still make a game, running at nearly 60FPS on this, cool huh?

Tomorrow we’ll write our first program which will cover that most important thing, getting something on-screen with a few lines of code and running, it’ll be great!

So, 2 Gameboy Games, 2 weekends. Is this a trend for me?

Probably not, haha! I do love making games for the Gameboy though, so I’m going to continue down that line for a while now. It’s still enjoyable to code games for limited hardware for me and it’s taught me a fair amount about code optimisations, which is handy for me in general. There’s also plenty left for me to learn about it, I may have made 3 games in total for it and have one in the pipeline but there’s a lot to learn in that lil system and I’d also quite like to make myself some tools I can use better within the games I make.

I nearly ended up using my own system for the sprites for Novascape, but, sadly it had a small bug, which has now been fixed so I can make more complex backgrounds and sprites with a bit more ease than before!

I might try my hand at making a basic platformer next time around, It would be nice to get a better hang on properly mapped scrolling backgrounds. Then again, They Are Everywhere has been waiting in the wings for quite some time now and really needs completion sometime soon. Ohh decisions, decisions…

Additionally, I put some feelers out on twitter regarding making some videos to help people into Gameboy Development with GBDK as the documentation on getting started with it seems rather scarce out there. I remember searching for hours in an attempt to find a PDF that contained the actual values that converted over to notes! I made my port of Spike Dislike using an inaccurate emulator, which then showed up on actual devices and my current emulator of choice, BGB.

So, I’ll spend a lil bit of time during the Christmas break putting some videos together for the New Year, yeah!

Completed Novascape, My GBDK Gameboy Game for Ludum Dare 34

So, last weekend Ludum Dare 34 happened and I really love the Ludum Dare game jam events, my first attempt was way back in Ludum Dare 24 and since then I’ve entered almost every one.

This time around, I set myself the additional challenge of making a Gameboy game and whilst my Flash Cart had just given up the ghost, I persisted with the plan.

For the first time ever, two themes were tied for first place, so I could choose which one to go for. Either “Growth” or Two Button Controls”.

I opted for the latter and within an hour I’d roughly planned out in my mind what I was going to make, essentially a game where you have to escape from a pit, as a spaceman, before the rising lava plume consumes you.

GAMEBOY & GAME ASSETS… OH BOY!

Now, asset creation for the Gameboy isn’t a trivial thing sadly. You’re limited to 4 colours which simplifies things a lot but, GBDK only contains some basic tile editing programs, which I love by the way, thank you very much to the developer of these, they mean I can actually get my hea around things!

So, I’m limited to 8×8 groups of pixels, which is okay for smaller sprites and looping backgrounds, but not so much for creating detailed backgrounds, that becomes a lot more time consuming and error-prone when transposing from Photoshop into each 8×8 tile.

When it comes to sound, it only gets tougher, you don’t just load up a wav file and set it to play, you’re manipulating the sound channels directly and the Gameboy is armed with:

2 pulse / square wave channels
1 noise channel
1 custom channel, so, you could in theory import wav files somehow but, it’s not recommended, we have minimal RAM and ROM to play with here!

Coding in plain C isn’t too bad though, as long as you keep everything small in terms of code size and try not to use comparison operators (e.g. less than, greater than, etc) or multiplication, division, sine, etc. (At least not without look-up tables). then you’ll be okay.

No floating point variables either, those would really bog the 4Mhz Z80 down, ideally keep everything to an unsigned 8-bit integer (0-255) which again, is tough initially but a couple of 16-bit integers are allowable.

Having mentioned all of this, the game managed to get to a fairly playable state within the first day, although at this point there were a lot of gameplay issues that still needed to be fixed, for example, you could simply hold A and not much would get in your way, sometimes not at all!

Also, there was no horizontal movement, only vertical, which felt a bit boring, so the following day, whilst refining the newly added enemies and trying to generate their placements in more annoying ways I stumbled across an idea.

A FUEL METER!

Quick, get that Fuel Can!
Quick, get that Fuel Can!

Of course, why didn’t I think of this before. If the jet pack runs out of fuel, then that’s it, you’re toast. But, it needs balancing out somehow, so in went the flashing fuel cans and gun recoil, allowing for some control over horizontal movement with the B button whilst vertical motion is all handled with the main (A) button.

But how to handle giving the player fuel? It should be based on performing a task and also, as horizontal movement is slow, lava is rising up quickly under you, it could be too tough to reach!

There was only 1 solution in my mind that would bring another layer into the game at this point, shooting enemies could release homing fuel cells which the player could collect with relative ease.

This meant that not only were enemies deadly, but you had a damned good reason to hang around and aim for them, your jetpack quickly runs out of fuel on the hard mode in the game, so enemy destruction is a must!

The game was looking pretty close to it’s final form by around 4-6pm on Day 2 and with around 7 hours left it was mostly debugging, polish and ensuring all the standard trimmings such as endings, title screens, differentiating easy mode from hard mode more and, in general making sure it all run without too many bugs.

Because, there are bugs, just a couple, but I couldn’t find how they were occurring. In the scope of things though, they’re fairly minor and, in some circumstances, give a player an advantage whilst playing, sooo, yeah. I guess I’m okay with that.

All in all, I thoroughly enjoyed Ludum Dare this time around, it wasn’t as stressful as previous ones, how much of that is down to experience and how much of it is down to going for the Gameboy, I don’t know. However, you can play NOVASCAPE for your Handheld Nintendo Gameboy System here and I recommend that you do, it’s fun, you just need to learn the controls 🙂

Ready to Gameboy Jam through Ludum Dare 34

 

Well, with Ludum Dare #34 Just around the corner, under 12 hours away as I type this out, I’ve been preparing myself to put together a Gameboy Game in Under 48 Hours, based around a theme. Which I’ll discover at 2am.

So, what am I doing to prepare for this then, huh, huh?

  1. Clear some space around me in my lil home office so I’m not being distracted by clutter.
  2. Made sure I have made a gameboy game recently,in a small amount of time, so I’m not going in to this completely blind. You can play it on your Gameboy here, it’s a tough space invader clone and didn’t take too long to make, just a bit of time to debug. GBDK is funny with variables sometimes!
  3. I Managed to write myself a handy tool to make sprite creation easier, meaning I can now use photoshop, export to PNG, run it through my tool and out pops the relevant data for both GBDK and it’s Tile editor program, I can see that saving me a bunch of time and allowing me to make more complex sprites a bit easier! I’ll pop this online at some point, just not right now though, time is pressing!
  4. Probably grab a bunch of snacks later on tonight for easy eating. Not too junky though!
  5. Most shocking of all, I’ll be getting myself a decent nights rest, so I can make sure I’m not going to burn myself out over the 2 days, I love game jams and everything that goes with them, but yeah, sleep, that’s important!

Why in the hell am I making a Gameboy Game? Why Not Use Unity. Unreal / Something else?

Haha, yeah, I’d normally be a Unity bod for any Gamejam, but, what with my recent endeavours with GBDK  and Gameboy Development I wanted to see what I can make, from scratch, in 2 days. I’m not expecting my entry to fare particularly well in comparison to other games out there, but, this is just for the joy of game jams!