Attack of the Clones: Invaded Space - Procedurally Generated

Attack of the Clones: Invaded Space

So site content kinda disappeared for a few days there, and this was part of the reason why. The general idea behind ‘Attack of the Clones’ is to force me to sit down for a weekend and recreate a “classic” game. This has a couple beneficial effects. First off I’ll have a portfolio of finished semi-presentable projects, it’ll force me to finish off coding required for the SDL Tutorials which have been languishing as my attention is stolen by other projects, and it’ll give me a good base for the SDL Gamedev section. For those of you who haven’t existed, there’s a video depicting gameplay below.

Now, there’s actually some semi-annoying parts to replicating some of these effects, what was done with physical tricks (Color was done with cellophane, how crazy is that?) needs to be replicated in code. The color bands depending on what height anything is at requires either image swapping or some fancy alpha blending. The shields get destroyed per pixel is where the enemy fire hits instead of a preset degrading image cycle as does the ground. There are elements we can’t help but eyeball. Invader speeds and fire rates are going to be guesswork. UFO points, spawn rates and the like are going to be completely made up.

We’re also going to be crafting our own graphics/sounds. The chances of someone actually caring and sending in the lawyers are pretty nominal, but no sense risking it for no good reason. We’re going to use the ever handy SFXR to create sounds (At some point I really want to play around with the source code to see how it works under the hood, but today we’re just using it).


Sure looks space invader cloney.

Sure looks space invader cloney.

This actually took longer than I thought it would. There’s nothing here that I haven’t done before, but rewriting my collision detection code and SDL mixer code from scratch to bring it into good enough shape for use in the gamedev/SDL tutorials (or at least close enough that all I need do is polish it) and crafting all the images myself took up a fair chunk of time. Trying to get systems to actually mirror the arcade cabinet also took quite a bit of playing by ear, tweaking and magic numbers. The conversion isn’t perfect by any means, but I think its close enough to not really matter, for example the UFO points are random instead of the inscrutable algorithm that is based on shots fired. I also elected not to spend a ridiculous amount of time trying to recreate the various bullets types and making things perfect and instead leaving some things a little janky (I’m not a good enough pixelsmith to get the explosions to overlap properly over multiple shots to encourage shield penetration).

This one is also a victim of fearless coding and desire for visual progress. I got cocky and thought I had enough of a handle on things that I could start putting things in as I went and as a result I have collision detection all over the place because I implemented it in various places as I went, two different kinds of bullets where a generic with a direction probably would have worked better, there’s some duplication and openness over multiple classes instead of having a singular asset manager. Just goes to show you even if you know the requisite parts backwards and forwards, it’s always better to have a plan on how you’re gonna fit them all together (even if that means hours of code in still having a blank screen).

On the other hand I’m fairly happy with how the pixel destruction stuff came together, the mixer stuff is from the ground up and a vast improvement over what I had, and I finally got a handle on SDL’s bizarre alpha blending process.

I also discovered that Space Invaders is incredibly boring to play for more than a level.

Invaded Space Source Code & Executable.

One Comment

Post a Comment

Your email is kept private. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Home of two pushpin murals, an X-COM lets-play, some C++/SDL programming, and some discussion of procedural generation. Wordpress Theme: Procgen, a hulking monstrosity that was originally BlankSlate. © 2019 Procedurally Generated. All Rights Reserved.