Xerra's Blog

Drunken coder ramblings

Who knew walls could be so tricky —

The Paradroid transfer game is actually turning out to be a bit of a bugger to get in place. After a couple of rewrites I’m actually going back to basics and putting the code together on paper to try and get a proper build routine for random maps. At present everything is switched off apart from the generation of walls on one side of the playfield circuits so they can be tested. And retested. And then retested again.

I’ve been breaking it down into stages with this, as it’s so important to take into account other elements around an area before a decision is made to plonk a wall down there. Actually getting it on screen isn’t the problem but it needs to follow the rules so that circuits can be activated through it, and that multiple walls don’t screw each other bit.

Start on the left side of the play area and start reading the first line horizontally deciding randomly wether a wall should be put down or not.

If a wall is to go down then I need to follow this decision up by deciding if this wall will have two circuits leading into it, and one leading out. Or should I have one line leading into it and two lines coming out.

I will then need to check the surrounding blocks to ensure I’m not going to break another walls 3 blocks by creating it. I say will then as I’m not at that part yet.

Decide to build my wall and place the blocks.

Depending on which way round the circuits go – one wire into two, or two into one, I then need to clear either the middle line in front of the wall up until the end of the play section then plonk a closing zapper to tidy it up, or clear the upper two lines behind the wall as it should only have the one wire going in.

I will then need to decide if I have another wall to maybe close off the two sections and then put it into a single wire again, perhaps, just like the original Pardoid did. That will naturally mean rebuilding the middle line again from the wall and this time clearing the lines above and below this wire from the front of the wall.

This is all for just one of the 11 lines going horizontal, so I repeat for the other 10 and will need to make sure that when i put down another wall they aren’t too close to one already down so the circuit would be broken.

After all that it’s going to be running through the board again, looking at each location and deciding wether to put any blockers, zappers or switchers on, and ensuring they are in legal postions.

That all make sense so far? Probably not. It just amazes me how Andrew Braybrook did it back in 1985 – and in 2k of memory using 6510 assembler. I’ve been at this for over a couple of months now – allowing for a real life couple of weeks break I needed to take for work reasons. Yes, I have a day job, too.

The reworking of the walls will fall into place soon, which looks like it’s going to be the hardest part, so I’m hoping the rest will come together much quicker after that. It’s a good job Aaron doesn’t have those droids in the game yet as he’ll be needing the transfer game slotted into his project by then.

I’m actually almost looking forward to going back and completing all the title screen stuff once this is over. Next time I’m volunteering to do the maps or something 🙂

Here’s a snippet of the terrible code that’s currently in there for generating the walls. I have a build script that can be called with multiple arguments for doing stuff like clearing the play areas and filling with wires, throwing random chars in the area to check I’m not overwriting the background display and testing animating pylons etc. That’s why it’s such a lot of lines at present.

As with other code I write, I often tend to hack it together to get it all working and then will go through it again tidying up the messy parts and optimising to an extent. I always comment the hell out of something when I first put it together in case I don’t finish that part in that session. I will then often tidy up the comments later just in case someone else does read the code, so they don’t fall asleep with too much information.

The code shown above will likely look nothing like this once it’s actually finished.

As it stands, however, I can just press a key when running to generate a different map which is how I’m testing if my walls work. As you can see from the screen shot below – they don’t. Ignore the vertical/horizontal text – that’s a hangover from when I put in the control pad code.

Work in progress, people…


Categorised as: Development | Game Studio 2 | Paradroid

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.