Codetapper's C64 Site

Diary of a Game

Batman Returns Part 2

Kapow! Whammo! These are just a couple of words you won't be seeing in any version of Batman Returns. Young boys in green stockings won't get much of a look in either. To compensate, however, Level Three features a certain female dressed from head to toe in clinging black leather.

'Life's a bitch and then you turn into one' said Selina Kyle aka Catwoman. I like to think life's a bitch' and then start coding one. The difference between turning into a super-baddy and talking to invisible armchairs is not as great as one may think. Selina had it easy: falling from the top of a tall building and getting resuscitated by cats. Compare that to my tapping at a keyboard wandering what topic Sammy (invisible a armchairs are called Sammy as a rule) has thought to talk about when I get home. You won't catch me complaining though — not unless you try anyway.

I think it was Bertrand Russell who said 'If Cartesian dualism is by definition remote in terms of perception then I'm a monkey's uncle'. Not very profound and not at all related to the matter in hand. Ok I must admit it. I didn't think my map data out properly before Paul started on the graphics, and when I eventually got them going I was way out of memory. At such times your best bet is to not panic — make a strong cup of coffee, sit down with a pen and paper and try to find a way around the problem. When this fails I pick all the lads brains to see if they've got any good ideas. Some of the printable suggestions were 'Give away a free PC with every game' (Tony), 'Compress and decompress the map — that's what I did on Where Time Stood Still' (John) and 'Have a Spicy Stick' (Paul T). I considered each one on its merits, then implemented my own master plan — to have another cup of coffee. As it was such a brilliant idea, I decided to go with it for a while and had several more. A few hours later — after I'd stopped running around the office gibbering hysterically — I came to the brave decision to change the block size. This meant the map could be stored in a quarter of the memory, although the blocks would take up to four times as much space as before. That was easily solved — I got Paul to use less blocks! He had to redraw the whole map anyway, so I thought it was a reasonable enough request...

Of course I had to redo my print to handle the new block size so it wasn't a completely biased decision.

It's Collision Data Entry Time! This is a game for one player whose task it is to type in lots of data like $6EF, $72C, $220, $228, STAIRS in as short a time as possible whilst holding on to their sanity and retaining as much visual capacity feasible. No conferring, your time starts now...

The average programmer takes about four hours per platform and a partially trained mongoose takes no time at all 'cause it's got enough sense not to play in the first place.

Stairway to hell

When's a platform not a platform? When it's thought up by an artist. Stairs are all very pretty as are sloped roofs. but give me a flat platform any day — left, right, top and bottom edges will do nicely.

I could really do without stairs. To make them, I have to create a box that surrounds the whole area, figure out how far from the left edge Batman is, add this onto the bottom of the stairs and see whether this value for the vertical direction is where Batman actually is. If all works out according to plan he's able to scale the stairs.

With the backgrounds, bullets, power-ups and Batman all working with the new multidirectional scroll, it was time to concentrate on Catwoman.

She had to be smart to give you a tough time on this level. This means I had to simulate intelligence that took several million years of evolution in less than tens of thousands of years of C64 processing.

The code had to be quick, and the best way to get code to run fast is to work it off data which avoids having to make lots of complex decisions. Unfortunately, there was no memory left for huge amounts of data, which meant I was going to have to use some higher brain functions — never an easy thing at the best of times. You couldn't hear me complaining. though — not if you were wearing ear muffs, anyway.

Catnip

Despite Catwoman's early insistence on not moving (I'd forgotten to take out the bit which changed her screen position when I was setting up her sequence) the game was shortly afoot. Platform collision data was already in, and the code written for Batman needed only a little modification for use with the cat herself. In no time at all — well, a day — Catwoman was merrily hopping from platform to platform following a preset route I'd given her. Next, she had to chase Batman and harass him at any time — this wasn't easy. First she needed to move toward the platform Batman was standing on by walking left or right. Secondly, she had to jump if Batman was above her. Thirdly, she'd drop down if Batty was below her — if the platform he was standing on was smaller than the one she was perched upon, she needed to walk left and right looking very confused. Following this I had to make a cup of coffee and wander around sulking, before actually sorting the situation out. There were many things to consider — a particular problem was working out how to get her to jump onto a series of successive platforms in order to reach Batman. It took four days to get this sussed so imagine how long it would take me to explain it. I won't bother if it's all the same to you.

In the beginning there was nothing. Space and time simply didn't exist — a tricky concept, but take my word for it. Then lots of stuff happened — far too much to chronicle in this short space — which brings us nicely to the present day and avoids quantum physics, molecular biology, evolution and the concept of soul which aren't the easiest things to get your head round either. Tuesday's a tricky day — a sort of watered-down Monday with subtle hints of Wednesday and a barely perceptible aftertaste of Sunday. Just one more day in the exciting life of a computer games programmer. Where was I? Oh yes, I was on the previous sentence. Caffeine is a very pervasive drug.

Giant Haywire Stacks

Let's talk Bugs. When everything goes completely haywire for no apparent reason, almost instantly you'll find half a dozen programmers standing behind you rubbing their chins in a vain attempt to appear knowledgeable, saying 'Looks like a stack problem to me' or 'Is it your stack?' or 'I think it's the stack'. This is not so bad if you're busy writing a computer game but if you're in the middle of an exam it's very annoying. It was, of course, the stack — one PLA too few, or one PHA too many, depending on your outlook on life.

Someone once worked out that for every hour a computer programmer spends writing code, they spend four minutes on the bog, eight minutes making a coffee, twelve minutes staring blankly at their VDU, seventeen minutes annoying other computer programmers and stopping them working twelve minutes debugging and seven minutes doing brief, inaccurate statistical studies. Out of six programmers questioned, one asked me to politely go away and five threatened me with physical violence. Too much caffeine, if you ask me.

Logical, well-considered thought has its place as a problem-solving method but you'd be one Yank short of a major military intervention if you didn't just lump in with both feet sometimes. Get hold of your code by the scruff of the neck and give it a right good kicking — that's what I say. You've got to be cruel to be kind — so if this doesn't work get your fingers on the delete key and ask, with your best Clint Eastwood impression, whether it feels lucky today. Sometimes it works, sometimes it doesn't, but at least you feel better for it.

Structure is important when it comes to AI (we like to make ourselves sound clever by calling our baddy code 'artificial intelligence'). Catwoman has three main modes of operation — PROWL, CHASE and FIGHT (that's what the routines are actually called). These can then be subdivided into smaller routines that can be shared across them all — JUMP, LAND etc. BATPROX is a simple but essential routine which figures out how close Batman is to Catwoman — it's a substitute for eyes. Whilst PROWLING, Catwoman will ignore Batman while he's still fairly close, but if he gets too close she'll use FIGHT code. CHASEing always takes into account Batman's proximity, where Catwoman can decide whether to switch to PROWLing if he's miles away, carry on CHASEing or again, start FIGHTing. FIGHTing is the most important part — specialist routines are needed to decide what offensive or defensive manoeuvre is going to be made. A typical Catwoman thought structure would be something like

  • AM I DOING A FIGHTING SEQUENCE? NO
  • IS BATMAN FAIRLY CLOSE? YES
  • IS HE CLOSE ENOUGH TO SCRATCH? NO
  • IS HE CLOSE ENOUGH TO BACKFLIP AT? YES
  • IS HE ABOVE, BELOW, LEFT OR RIGHT OF ME? LEFT INITIATE THE LEFT BACKFLIP SEQUENCE
  • EXIT ROUTINE.

Next time round it would be something like —

  • AM I DOING A FIGHTING SEQUENCE? YES
  • CONTINUE SEQUENCE
  • EXIT ROUTINE.

All sounds very simple, but with tweaking (and a few other bits I'm going to let you in on) it should make for a good old scrap.

It makes perfect sense when you think about it. If you were asked to make a computer programmer a cup of coffee (mine's black with no sugar) your brain would probably think:

GO AWAY AND MAKE YOUR OWN (in a less user-friendly manner)

Pleased to meet you

Friday meetings round the week off nicely. The Big Bosses (John & Ally) get out the fear-inducing yellow folder and try to extract as much information on what we've all been doing for that week. I try to get away with name, rank and serial number but I always crack and end up spilling the beans — I must learn not to mess with beans during Friday Meetings. This is the cue for a plethora of bugs to make their appearance. Having spent all week in a sloth-like stupor they burst into life and just as you're saying the scroll is working — cheerfully demonstrating it in all its glory — the screen goes haywire and a tiny high-pitched giggling sound can be heard. This is where the lines you've been practising all week come in handy 'Oh that's probably because of the fabbo-collision-detection-parameter-reduction-enabler code I've just written which isn't quite working yet.' Unfortunately, John's a programmer and normally cottons on that this isn't quite the truth. FIX SCROLL BUG is written down in the WORK FOR NEXT WEEK space. Then it's Ally's turn to spot lots of petty things only an artist is bothered about, like some of the sprite colours being wrong or the screen being full of total gibberish. No amount of cajoling, whimpering or throwing of tantrums will stop her noting them. What seems like hours later, but is in fact only about 120 minutes, it's my chance to get my own back. PROBLEMS ARISING is good fun — this is where I have a good whinge about anything I feel has hindered my coding during the week. The state of the nation and England's poor form in the World Cup Qualifiers are always safe bets but a short while reading the international news the previous evening can help bring about a form of balance — coffee production levels in Bolivia being one of my favoured topics. Next up is REQUIREMENTS and their turn to sweat again. I still haven't got a villa in the South of France and I'm a bit sick of asking for it so I asked for a chateaux in the South of France instead. hoping it would slip past their defences. They didn't phone an estate agent so maybe the ruse didn't work...

Series Links

Part 1 / Part 2 / Part 3

Post your comment

Comments

No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments

Any suggestions?

If you have any idea what should go in this box, please let me know! :)