Trending
Opinion: How will Project 2025 impact game developers?
The Heritage Foundation's manifesto for the possible next administration could do great harm to many, including large portions of the game development community.
Featured Blog | This community-written post highlights the best of what the game industry has to offer. Read more like it on the Game Developer Blogs or learn how to Submit Your Own Blog Post
With PowerUp's imminent XBLIG release this Friday 13th, Psychotic Psoftware's Mike Hanson continues to report back on his enemy design discoveries while producing his one man SHMUP.
Hello,
So when we left off I'd just started telling you about the processes involved in coming up with the baddies for my game PowerUp. If you remember, I was attacking them in chronological order, my logic being that as my understanding of coding for enemy AI improved, so would the intelligence of my enemies... a logic which, as it happened, more or less made sense.
You can read Part 1 here.
---
So where were we?
Well, in looking at the first two Chapters of the game, we've pretty much covered the basics of blind enemy movement around the screen. That's to say enemies who's movement is not based on where you, the player are positioned. Sure, their movement is well paced, gracefully animated and generally makes sense as far as nice solid moving enemy elements should, but the thing is... those early baddies can't see you. They're blind.
And I was sick of em! I wanted baddies that could litteraly challenge me. I wanted baddies that could see!! And that's what was foremost in my head when I started PowerUp Chapter 3. "Cracked Planet".
---
Enemy: The PINCraft - Pincery, Insecty Squirmy and Smart!
For the most part, I was finding that the process of coding my game was relatively smooth. Generally, As I concocted new and wonderful enemies, I'd just build on the ideas and the code that I'd developed in earlier enemies, twisting things a little perhaps, in the hopes of prompting a change in player tactic and most importantly, a change in optimal player weapon.
As I say, for the most part this was doable by evolving a bit of code I'd already written, saaay, making an enemy's right to left movement speed a bit less predictable by instead of having it initialise with a speed of 3.0, having it initialise with a speed that was randomly between 3.0 and 4.9.
Boom! Immediately, you've got a baddie type with considerably less predictabillity than its predecessor. Add to that, a vertical floaty-wobble from another previous baddie and you've got something that's more unique still... Finally, add a random directional bullet from yet another predecessor and... you get the idea, right. I was able to swap and change mechanics between enemies.
However, sometimes there were bits of code that I'd have to go looking for... Well, I suppose that applies to almost every bit of code the first time you use it, even when you're in a rythm, you occaasionally need to stop to gather clues on what comes next.
...And that's exactly how it worked with sighted baddies. It sounds simple in theory, but it took me the best part of a four hour coding session to locate the snippets of tutorial and example code I needed in order to find the syntax I required to do what seemed so simple in my head: And in this case, that simple task was to refer to the player's hotizontal and vertical position. Its Vector, if you will.
I'd messed with this stuff when doing the player's movement... I'd familliarised myself further with it all while dealing with baddie movement. But getting one class to refer to another's position, at first was hard work! However, when I cracked it I was like a kid in a sweetshop!
...and to begin with, I applied a bit of code to the creepy looking PINCraft that set its intelligence a cut above the rest. It said that if the player was above the PINCraft, move the PINCraft slowly up. If the player was below, move it down. Simple, but effective. This had two effects...
Firstly, the PINCraft became that little bit more deadly, or at least, it appeared to. Homing in on the player. Then attacking in huge numbers, the PIN gave the impression of oppression! An overwhelming force that was closing in on the player from in front, above and below. Choking and confining any freedom of movement. .....Ace!
But most importantly, the effective antidote battling to a PIN wave was to switch weapons. There were a lot of PINs, but they were physichally weak. Bullet-power asside, what the player needed was A LOT of bullets, and switching to the fast- repeating Plasma cannon while watching my step, I was soon cutting great gaps through PINCraft assault!
Closing in - In coding the PINCraft's collision, I was careful not to make those splayed pincers collideable with the player. Imagine how impregnable this wave would have been if they were.
---
The RATCraft: Biting the Aimed Bullet
I had been pretty determined that when I reached the enemy planet and the dealing with locations that had floors, I'd have to take up the challenge and create a few grounded enemies. Early in the "Cracked Planet" Chapter seemed like a good place to start and my first land dwelling baddie was a heavilly armoured, armadillo-like little ATV called the RATCraft.
It was pretty obvious that a grounded baddie was no threat without the abillity to throw a few projectiles our way and supplying the RATCraft with a handy orb firing tail, I gave it just that abillity.
however, emboldened by my experiences with homing my PINCraft in on the player, I decided not to rest until I had RATCraft aiming its arsenal directly at the player.
First attempts were thwarted by the simple fact that I hadn't thought this through.
The PINCraft had been written in such a way that it was forever checking its vertical position in relation to that of the player and updating it, constantly homing in.
With the bullets, however, what I actually wanted was for the baddie to aim, shoot and forget. The bullet would then take the trajectory it was sent on, and just go with it... Trying to get a coherent google search out of that one was a bit of a mare, I can tell you!
It took a few nights of searching and blindly tapping possible solutions in before I found something that worked. What I did note was that the territory I was entering was no longer that of clean cut solutions, of code that you could just copy from a tutorial and paste into your game, changing graphics, speeds, etc. I was now entering the oblique territory of clues!
...Little bits of code, similar to that which you're looking for, but not quite it. Bits of code that hint at the kind of variables you should be thinking of using, maybe something that alludes to the possibillity that I'd need to acquire the enemy's position as a startPoint, then the player's position as a targetPoint, then work out a line between them just on the frame of the game that spawns the bullet, basing the speed of the bullet on the distance between the two points so that even close up, the player has a chance to see it coming and to move out of the way.
Desert Rats - This term is actually where the RATCraft originally got it's name, but the Armadillo look it ended up with was based on a totally random design scribble I took a particular liking to.
---
Shades of Red
I was approaching the middle of Chapter three, the halfway point of the game, and became accutely aware that the creation of more and more new baddie types was going to seriously slow down PowerUp's production. The use of more difficult variants of the growing library of enemies at my disposal was becoming a more and more realistic solution here. With my new baddie homing and bullet targeting skills, I resolved to investigate this properly.
Specifically, I revisited the FABCraft, the DEFCraft and even the dreaded RAYCraft!
The new FABCraft variants, or the "RedFAB" were bigger, slower and stronger against the player's firepower. the RedDEF shared similar properties when compared with their earlier predecessors, although now with the abillity to fire off infrequent, aimed shots at the player's ship.
Heat Rising - The inclusion of Red variants of previous PowerUp enemies turned out to be a great way to visually reference the raise the game's difficulty gradient without losing too much time or straight-repeating too many previous enemies.
---
Enemy: MisCraft - Almost A Titan.
It was becoming apparent that the PowerUp was getting a bit heavy on the fighters and fighter size/class ships. The BATCraft, DEFCraft and FABCraft (While more of a mine, the current incarnations of FAB were more or less fighter sized) were beginning to outnumber the slow and lumbering forms of the likes of BUSCraft and RAYCraft. Even REDRay was closer to a fighter than a large-class ship.
As I'd started Chapter 3 with some new smaller offerings and proceeded to hurl red variants of familliar ships at the player in its mid section, I thought it was about time I rolled in one of the big boys... You have to bear in mind that at this point, I'd barely even considered what I was going to do about bosses, so these larger ships were as big as my imagination was currently allowing me to get.
I heaved in the MISCraft. MIS was basically to be a missile launcher. I realised that I'd managed your basic homing capabillities with the PINCraft and was beginning to wonder how well that code would translate to what was essentially an arc-based homing bullet. Of course, the answer to that was that it would translate just fine.
My modelling was speeding up now and after a little break to work on Red ship variants, I was only too eager to get back to a bit of original 3D art. I was also becoming a much tighter, faster modeller of ships, and found myself modelling far fetched but vaguely functional ship parts into MISCraft, the large funnels at its rear would be the source of the ships screen-right to screen-left homing missiles and I particularly took pleasure in dictating the precise starting-source of the missile in relation to the enemy firing it, as opposed to just firing it roughtly from the central area of the baddie as I had with the RedBAT and RedDEF ship classes. The MISCraft had an all together less chaotic, more deliberate feel to it.
At first, MIS also simply moved in from right to left, but I soon came to realise that I could experiment a little with this one. After plenty of earlier encouragement for the player to use their Plasma cannon, what with the weaknesses of the Cleaner, the RAYCraft and the PINCraft, I settled on a mechanic in the MISCraft that would limit the player's use of that particular weapon... A huge flickering lightning-like shield which extended from the front of the ship and spelled instant death on contact with the player. The shield was also long enough that anything but the very highest levels of plasma would simply not breach through to the craft behind.
I had the ship tank its way on screen then pause for a while with a menacing demeanour while its missiles swooped off toward the player. I wrote in an extra bit of code which had the missiles count down their vertical speed to zero when changing direction, then count up again when finding the player, giving them the impression of arcing around the player, as though dragging their own weight.
It worked wonderfully, the elasticated flight paths of the homing missiles as they came toward the player, weaving vertically up and down toward their target became a very effective distraction. After they had passed, I left another pause for the player to battle the MISCraft, then if the hulking enemy was still surviving the onslaught, MIS itself would kick its engines in, accellerating toward the player and finally off screen left. Very cool, and ever more complex than what had come before.
Hulking Mass - The MISCraft could take one heck of a pounding and with it's complex shielding and intelligent homing missiles, it was the baddie that really started me thinking about my options for the Titanic level bosses to come.
---
Enemy: Infantry - Litterally Taking down An Army!
You read that right. Wouldn't that be ace? Just to be able to unleash hell on hundreds of (obviously inherently evil) ground troops using some seriously chunky firepower? Well that was the plan.
I was thinking, "Hang on... All this talk of fighter class ships and titan ships and here we are in Chapter 4, "The Cityplex", essentially one of the enemy species' major cities, and we haven't seen a single ground troop!... Hmm, would they even have ground troops??... This is MY game, and I say of course they would!!"
And do you now what?... They did.
Mountains of em'.... erm, but not so many as to make the wave impassable. That goes without saying though, right? ...so I toned down where I felt I had to and threw a load of very easy to kill, little silhouetted reptile men at the player, earning a mark for violence on XBLIG indie games in the process, but hey-ho. It was SO worth it!
Death from below - While the reptillian soldiers posed little threat on their own, they became a cunning distraction when coupled up with large enemies like the RedBUS.
---
Enemy: BOLTCraft - A Big Baddie That Can See??
It's probably worthy of note that while I was no longer populating with as many unique new ship shapes at this point, between the soldier and the BOLTCraft I had included a great many new Red variants, all exploiting these new tricks.
The BUSCraft and PINCraft had now recieved the Red treatment, improving on their speed, homing senses and aimed firepower while the SLOBot had been upgraded for the smaller, sighted REDBot, equipped with a wicked experimental fast repeating aimed shot that served to spray bullets in deadly squiggly lines across the play area.
It's safe to say that by this point, my two crowning achievements were definitely in creating baddies with the abillity to locate the player's X and Y positions, then adjust its own position accordingly, and in creating baddie projectiles capable of establishing its own position and the player's position on being fired, then creating a trajectory between the two... And I was exploiting both of these techniques to the full!
Dodge THIS! - RedBOT sends off a naughty little squiggle of aimed bullets your way as the bullet blasting RedPIN Craft home in on the player.
Creeping Death - Under the pressure of a powered up player, RedBOLT bears down regardless. By now I was really getting a feel for how effective Titans would be as bosses.
---
Enemy: Red GLOWBall - Somewhere between a Baddie and A Bullet.
So, I'd made a baddie that could detect and find your vertical position via the use of detremental integers... You know, that thing I was on about in an earlier blog where when a baddie goes past its target, it starts taking 1 off its speed, making for an arc, until it's moving in the opposite direction. Remember?... Right.
Well, in a nutshell, it's the thing that I used in older games when I wanted to make things jump in arcs as opposed to sharp up/down movements... which suck! Anyway, back to the point. This worked well horizontally with RATCraft and the ground troops, and it worked well vertically with PINCraft, BOLTCraft, etc when homing in on the player.
...So it was really just a matter of time before I tried experimenting with something that did this horizontally AND vertically... and what better enemy type for the job than one which, when animating, was non-direction-specific... something that I'd used before maybe... something like a GLOWBall mine??
If you cast your mind back to the previous part, you'll remember that the GLOWBall was a durable enemy from the first level that mostly made for a dodge distraction while taking on other enemies. Well, on Chapter 5, when the player was powered up to a level best described as "Well 'ard", those things popped like baloons when they even vaguely considered coming within a hundred feet of the player's ship.
Sure, they'd be just as deadly when touched, and for that reason would still make a good minor distraction at this point, but what if the real danger came from the much advanced Red versions of them?
The Red GLOWBall enemies were actually similar to the GLOWBalls in art only, at about half the size of their counterpart, the Red variant spawned at a random horizontal position across the screen-top and the screen-bottom, checking its own horizontal and vertical position in relation to the player's, then it would accellerate toward the player at speed. Upon missing the player ship, Red GLOWBall would then arc to a halt using a countdown of its speed variable (or a decremental integer), pass zero, then promptly start counting the other way. This would happen for horizontal and vertical movement!
Forcefield at the ready - It's the unnerving beginnings of a massive Red GLOWBall attack.
--- Enemy: TENTACraft - Only Backshots Can Save Us Now!
It seems that the PINCraft really opened the pandora's box of wierd and freaky baddies, and TENTACraft was to follow in the same vein. While TENTA's head section was a fairly simple spikey-jawed, chomping mouth affair, its rear section was quite a slick collection of parts which came together to make rather a hypnotic impression that I was very pleased with.
As for its moves however, TENTA simply came up behind the player, homing slightly as it did and blasting the MISCraft's very own homing missiles at the player's rear end. It was a fighter class ship whose design was based mainly around encouraging the payer to utilize their Back Shot. This was one of those weapons I'd found myself skimping on up to this point in development, so the inclusion of a relatively durable rear-attacking fighter was intended to have the player thinking ahead and powering up accordingly.
...As it happened, this powering up the Back Shot thing wouldn't prove to be too much of a problem as the Chapter four boss I was to concoct later on would really help to fill that gap... but I'm getting ahead of myself.
Watch your back - The Tentacraft's first appearance is supplemented almost immediately with it's Red upgrade!
---
Cranking Up The Nasty
I liked those BlackBAT ships from the end of Chapter 4... and now that I had the core coding skills for some seriously tricky baddies I wanted more level 3 enemies in black. Over the course of the final chapter, great big BlackBUSCraft ships began to make an appearance, free-roaming and barely penetrable, pumping out highly dangerous, slightly-faster-than-expected aimed bullets at a rate which simply refused to allow the player to get into a comfort zone while attempting to pummel the enemy with everything they've got.
Then there was the Black FABCraft, huge variants of the floating bombs with unpredictable firing patterns.
FABCraft by the dozen - Even powered up to the teeth, the stakes get high with these particularly well armoured last-level enemies.
The big guns - Even at full power and cheating my backside off, I stil break a sweat fighting off these guys.
---
Enemy: Gun Turret - Just One More Thing...
You're tired, you're battle ravaged! You haven't stopped playing PowerUp for hours now. Look, you need to eat! ...Sleep! Just tear yourself away for sanity's sake..... but, you've made it this far.
Pick yourself up, Pilot! you've still got to run what I lovingly call The Gauntlet!! That's right... a nice long corridor of Gun Turrets! And these aren't just any gun turrets. These bad boys will be changing pace constantly... one moment it's manageable... the next, they're coming at you in fours! Fast-firing and furious, above and below.
...and just when you're getting into a rythm... I crank it to 11 and throw in some more baddies for good measure!
Sorry.
If you make it to that final boss you'll be catching your breath and calming your nerves first ...at least, that's what I have to do, and I designed the flippin' thing!!
Running the Gauntlet - Some sections of the final level would require fast changes between weapons to counter unexpected attacks, all while weaving between Gun Turret bullets!
---
So!!
There I was with a game full of enemies. I'd mastered the moving of baddies and bullets around the screen. I'd managed the generation of said bullets and various shot, impact and death effects. I'd even sussed out how to code things to happen in relation to the position and state of other things. Nifty!
By now I'd spent many a sleepless night coming up with the bosses I'd need to do this game justice, ensuring that each and every one was visibly distinguishable from the others and loaded up with its own brand of bullet-storm.
I was sure that If I were to start at the beginning of the game, and code these things thoughtfully and with the reverence they deserved, starting with the simplest and working my way to the most complex, I'd be able to do them all justice.
.....and I'll tell you all about that next time.
Thanks for following my blog this far guys.
See you in the next one.
m
You May Also Like