Posts Tagged ‘STG’

Messy code

Tuesday, January 12th, 2010

Or at least it was messy, but along with three hours of re-jigging the bullet handling and adding a “blast radius” value for each object (the size of explosions were previously tied to the collision area, now it’s possible to define small collision zones on large objects for cores and so forth but still have an Earth-shattering kaboom when the thing loses it’s shielding) I’ve just spent another hour and a half going through all the functions and entites to remove unused variables; the code is now leaner and slightly meaner than before. Which is nice.

That bumps the engine up to version 0.7 and the next step is going to be strapping a test front end into place to get the thing working properly as a loop. Fingers crossed that shouldn’t prove hideously difficult, but there’s bound to be some variables that are currently not initialised that’ll run wild or places where the order needs a bit of a juggle to prevent global variables being declared more than once…

A bit more blasting

Thursday, January 7th, 2010

Bloody hell, another update so soon… blame it on the snow.

The new spawning system I mentioned in the previous post has been implemented and the entire engine has just become a truly joyful thing to work with! Previously the system could only deal with one nasty at a time (either a single instance or a repeated stream of one kind of attacker) so having eight nasties appear from the top of the screen and fly down one after the other was easily handled with just one set of commands in the control script (which looks a little like XML but isn’t…). But if I wanted two waves simultaneously appearing from opposite sides of the screen I’d have to position an object at the left and another at the right, wait for twenty frames, add a second object at the left and another at the right and so on… fairly messy.

So one overhaul later and when the script interpreter finds something that needs to be spawned multiple times, the code just makes the first instance before shouting “this object, these X and Y co-ordinates, here’s the movement data, repeat it X times, wait Y frames between repeats and nudge the X, Y and angle values this much between each instance” at a newly-created spawning object and then leaves that to generate the rest of the attack wave automagically. There’s literally nothing to stop eight different waves being generated simultaneously from just eight entries in the script, so despite currently looking identical on screen to how it did before again what can actually be done with the thing has been vastly improved and it’s just not showing that because the script doesn’t use those newly crafted features yet!

The next thing I’m going to do (and hopefully that’ll be tomorrow… or more accurately later today) is construct some actual attack waves to properly test the system and then slap a test titles page in so that the game can be “persuaded” to actually run more than once – right now it just drops back to the BlitzMax IDE when it runs out of wave data or the player’s lives are all gone so I have no idea what state it’s leaving things in on exit!

Blast Engine remix

Monday, January 4th, 2010

After a gruelling four hours hacking away at the Blast Engine… it looks almost exactly the same as when I started – oh the irony!

Well, it’s not entirely identical visually; along with a small cosmetic change that converts them into travelling single-particle explosions when the smart bomb is triggered, the enemy bullets have changed colour because they’re now managed by the nasty object linked list rather than their own stand-alone one and that list doesn’t yet have colour control options. This change was partly for general efficiency (four linked lists is now reduced to three, two player to nasty collision checks boiled off to just the one) but it also allows for more complex bullet movements, multiple types of bullet (that would’ve happened anyway, of course), bespoke handling code in the same way the nasties themselves will be including the option for bullets to spawn other bullets… and most importantly of all it means the linked list for the player’s bullets can be renamed from MissileList to BulletList!!

Yes, not really the most important point of course but you probably wouldn’t believe just how irrational I was getting about that naming… it came about because the nasty bullets were added before the player’s, so they got first dibs on the name.

After a little break from the computer (the new season of Hustle starts in fifteen minutes) I plan to add the colour handling for objects and optimising the function that spawns nasties. After that, the next major change is optimising the wave script interpreter and building a better spawning system to simplify the launching of multiple waves – but that code’s not been touched for a while, so I’m expecting a disaster or two along the way.