Daydream Bee-liever: The Making of Buzzy Bee – Part 4

Look at all that lovely debugging text... Mmmm!

By mid-February I’d got Buzzy flying around flowers of various sizes and sling-shotting between them. With the basic controls done (and yes, feeling pretty pleased with myself), it was time to start working on the game proper!

I wanted the game to feel fresh each time it was played, so I decided to create an algorithm to generate the playfield pseudo-randomly. Each ‘day’ the game would look up how many flowers of each size were needed and then it would go off and build the playfield, randomly placing flowers while ensuring that they didn’t overlap and that everything was wonderfully playable.

Of course, this proved to be a lot easier in theory than it was in practise. I tried several ‘clever’ (to me!) approaches to get this working, none of them effective.

Look at all that lovely debugging text... Mmmm!

Look at all that lovely debugging text… Mmmm!

In the end I plumped for sheer brute force: the game plonks down the flowers in turn, starting with the biggest first and working down to the smallest. Each flower’s coords are generated randomly and that location checked to see if the new flower collides with any already in place. If collision is detected, a fresh set of random coords are generated and this new position checked.

This process repeats until the flower is either successfully placed or, if the game makes too many failed attempts (i.e. it’s deemed that there’s not enough space to place the flower), the whole playfield is cleared and the process begun again from the very first flower. Yes, I know, it’s as ugly as hell, but hey, it works!

Now I just needed to add some pollen. Again, I wanted the pollen to appear randomly but I also wanted to ensure the player was forced to travel all over the playfield – the trouble with random stuff is that you might get the pollen all generated near the hive, which would make for a dull level.

So I gave the flowers ‘states’ – some are ‘ready’ (i.e. they could potentially pollinate), some are ‘resting’ (i.e. they pollinated previously) and the rest are ‘active’ (i.e. they have pollen surrounding them). If the player collects all the pollen around a flower it turns from ‘active’ to ‘resting’. When all the pollen on the playfield is collected, the game randomly picks some of the ‘ready’ flowers and makes them ‘active’ (and thus they spawn new pollen), and turns all the ‘resting’ flowers into ‘ready’ ones. This system ensures that flowers that just carried pollen can’t pollinate again until at least one refresh later, and seemed to work well.

Next I added a hive, for Buzzy to drop off all his collected pollen at. As Buzzy orbits the hive, pollen is automatically deposited onto the hive and a combo multiplier is applied to the score – i.e. the more pollen you drop off in one hive visit, the faster your score growss. In this way, players are rewarded for risking it out in the playfield and carrying around large pollen loads.

Now I had the bare bones of the gameplay in place, I spent a little time polishing things up and adding a few graphic flourishes, like a wobble to the flowers when they pollinated, and then girded my loins for the next stage: enemy bees, which would force me to face my biggest fear of all: AI.

Just the thought of it gives me the fear so you’ll have to wait until next time to hear about that, true bee-liever!

(By the way, I’m aware that my previous post’s promise of regular, frequent updates was not kept. I think I’ll keep my big mouth shut this time – you’ll get the next one when you get it. ALRIGHT?)

This Post Has 0 Comments

Leave A Reply