Defender

Game


Persona


Chris Pile


1998

SAM Defender was programmed back in the summer of 1998. The project took about four months from start to finish. The initial goal was to write an accurate version of the Williams classic for the SAM.

The SAM version contains faithful reproductions of the original arcade machine graphics, even down to the planet surface which is almost a pixel-by-pixel reproduction of the original. The original arcade machine has a slightly taller vertical screen resolution, so the SAM landscape is ‘squashed’ a little. However, the contours remain exact.

The font used in the SAM version is an exact reproduction of the original, as are the pulsing palette colours. However, some colour resolution was lost due to the original having a palette of 256 colours opposed to the SAM’s 128.

The movement and actions of the various enemies are also faithful to the original, as is the overall game speed.

Perhaps the most disappointing part of the SAM version is the sound effects. The original arcade machine had a 6809 CPU for the game program and a separate 6808 CPU (with its own ROM/RAM) for the sound effects. This separate sound board also had a DAC to produce some amazing sounds. Sadly, the SAM’s old SAA just doesn’t cut it. It is possible to get the SAA to play samples, so the original arcade machine sounds could have been reproduced. However, the poor old Z80B would have been seriously overloaded trying to cope with the game AND the samples! I’ve tried to get the main sound effects as close to the original as I could, the player laser is almost exact. However, some of the more exotic sounds have been improvised. I’ve tried to keep the actions and priorities of the sounds the same as the original. The original could only play one sound at a time, sounds having priorities. I’ve tried to simulate this.

Performance wise the SAM version is on par with the original, which isn’t bad when you consider the original doesn’t have to worry about generating sound effects!

Chris writes:

SAM DEFENDER was due to be published be Persona. This is why the game still contains its Persona references.

Sadly, Malcolm Mackenzie (the boss of Persona) died back in February 1999. At the time, the software business and the SAM Coupé would have been far from his families mind. Persona was left in limbo and the enthusiastic David Ledbury left out on a limb. David was the person who encouraged me to get back into Z80 programming after an absence of some years. He even bought a SAM for me to develop on. David’s enthusiasm for the SAM Coupé remained strong until very recently.

I never had any written contract with Persona, so SAM DEFENDER’S rights have always remained mine. However, even though I was all for releasing the game as freeware I felt it morally wrong to do so until I knew where Persona was heading.

David Ledbury’s sudden leaving of the SAM scene left me in limbo! I e-mailed David telling him about my intentions with regards to releasing SAM DEFENDER and he didn’t object. It’s very sad that someone with David’s enthusiasm towards a dead machine has felt it necessary to leave the scene. However, it’s his decision and I’m not one for politics!

So, here it is. Apologies to anyone who actually bought a copy and now feel cheated, but you did get Astroball and Dyzonium too!

Update 20/03/07

Hi SAMsters,

I’ve updated SAM Defender!

Why?

Well, basically I did all of the things I should have done back in ‘98. Things that have been annoying me for years!

Below are a list of the things changed, plus any new features and also a link to where you can get this - finally (probably!) final - version!

List of things changed to match the arcade coin-op:

  • Hyperspace is now a 25% chance of death on re-entry - was 50% before.
  • Homing enemies do not home to the hyperspace re-entry position - they did before!
  • Landers appear in groups of five, as they always have. When you shoot the last Lander in the current world state, the next available group is warped in immediately. Before, you could have an empty world while the counters for the next group timed-out. So, now its never an empty world! :-)
  • Climbing Landers that once carried a humanoid (which you’ve now shot!) that reach the top of the screen will now warp in at a random world X position. Before, they would warp in at the same world X position they disappeared at.
  • Hunting Landers will now pick a new humanoid target if their current target gets captured or destroyed. Before, if their target vanished they would hunt blindly over potential victims and never pick them up… Total pants!
  • Humanoids are now scattered randomly over the planet surface. Before, they were put at a uniformed distance apart - depending on the number of humanoids in the world.
  • Enemy shots now have a little randomness to their ultimate destination. Before, every shot was deadly accurate to the player’s ship.
  • Swarmers - their logic has received a major overhaul. Before, they fired in any direction using the same shot-logic as the rest of the enemies. They also flew around the player like a swarm of bees. This was bollocks - nowhere near the same as the coin-op original, and something that’s annoyed me for years! The coin-op Swarmers will only fire when they are flying toward the player - they also use a different shot style and sound. This means you can let Swarmers fly past you, quickly turn and chase them in the knowledge that they won’t fire at you - providing you keep close to them. They only change direction when they go beyond a certain distance from the player. In SAM Defender it wasn’t possible to use this chasing “trick”… But it is now - as Swarmers now mimic the coin-op. :-)
  • Upon player death all screen contents are preserved - including any warping enemies and explosion fragments. Before, all fragments and warpers were erased due to the way their engines worked. Not good - and not like the coin-op! Fixed! :-)
  • Baiters and Mutants now mimic the coin-op more closely - slight changes to their logic.
  • Background stars now twinkle faster - a closer match to the coin-op’s twinkle speed.
  • Some sound priorities rearranged, to closer match the coin-op. Even though the sound is still shite! ;-)

List of (internal) things changed from the last version:

  • Faster and more random random number generator.
  • Faster processing of the linked-list used to handle the world entities.
  • Optimisations of the sprite engines and scanner dots engine.
  • Cleaner final stage to the merging “Defender” logo on the attract mode. No empty block!
  • Coin-op timing for the appearance/disappearance of the “500” sprite during attract mode.
  • General removal of redundant code - such as…
  • Removal of light-pen detection code. I doubt this was needed - how many had a light pen!
  • High-score table is now 8-slots, and contains the same initials and scores as the coin-op.

List of things removed from the last version:

As both of these were seen once only - at initial game boot-up - their code and data have been removed, saving around 8k on the final program size!

List of things added to this version:

  • Coin-op style “rug” test-pattern during initial game boot-up! As per coin-op power on!
  • Coin-op style “INITIAL TESTS INDICATE UNIT OK” message! As per coin-op power on!
  • An “ALL TIME GREATEST” high-score table! As per coin-op.
  • Saving of the “ALL TIME GREATEST” scores to non-volatile RAM if you have Edwin Blink’s Dallas real-time clock interface. The coin-op saved the “ALL TIME” scores to NVRAM.
  • Saving of your control key choices to NVRAM too.

See the “readme.txt” file in the Defender .ZIP for information about SAM Defender’s NVRAM saving capabilities.

So, there you go! Some improvements and changes I’ve been meaning to do for years!

Here’s a quick way to tell which version you have:

  • Rotating RED “Digital Reality” logo = the original 1998 release, complete with bugs!
  • Rotating GREEN “Digital Reality” logo = improved version, released around 2001.
  • No “Persona” or “Digital Reality” logos - instead, replaced by a coin-op style “rug” test is the very latest version. Much improved, optimised and closer to the coin-op.

As ever, with major changes, there could be bugs! :-O So, please let me know if anyone finds anything they think shouldn’t be happening!

Finally, have fun!

Chris.


GAME CONTROLS:
———————

Anytime during the front-end/attract screens the following keys apply:

1 … Starts a ONE player game.
2 … Starts a TWO player game.

K … Allows you to re-define the main game controls.

DEFAULT GAME CONTROLS:
———————————

Q ……. UP
A ……. DOWN

O ……. THRUST
P ……. REVERSE

K ……. FIRE LASER

H ……. HYPERSPACE (Zap to a random point in the world)

SPACE … SMARTBOMB (Kills all enemies on-screen)

ESC ….. ABORT GAME

F9 …… PAUSE GAME

There’s a 25% chance of death on re-entry from hyperspace, so only use it if you have to!

You start the game with 3 lives and 3 smartbombs. An extra life and smartbomb are awarded every 10,000 points.

GAME OBJECTIVE:
———————-

Basically shoot everything that moves! Except for the humanoids walking along the planet surface, it’s your job to protect them!

If a Lander captures a humanoid you can release its victim by shooting the Lander.

On shooting the Lander the humanoid begins its fall to the planet surface. Don’t let it fall too far - or it will die on impact!

You catch falling humanoid’s by flying into them. 500 points are given for each catch, a further 500 points are awarded for each humanoid you place back on the planet surface. Falling humanoids will survive impact providing they don’t fall too far. A 250 point bonus is awarded for surviving fallers. Beware, you can also shoot your humanoids - this isn’t generally a good idea!

There are no limits to the amount of humanoids you can carry at a given time.

If all the humanoids die the planet explodes, throwing you out into space. Don’t worry, the planet and its population regenerate every five waves… Assuming you survive that long!



Please replace the current .ZIP

with the copy found here:

ftp://ftp.nvg.ntnu.no/pub/sam-coupe/disks/games/Non-Commercial/DefenderArcadeConversion.zip

As this copy contains Chris Pile’s original readme.txt file, which contains important information - like the game control keys!

Done.

Done.

mulator?

is mulation or he is klone?

Clone, probably.

Clone, probably. It’s difficult to say, since I haven’t read the code, but I imagine the arcade version would have addressed the screen in a different way and had other things like sprite hardware to rely on. It’s much more likely that the author of this version would have rewritten the code from scratch, rather than try to reproduce hardware behaviours.

It's a clone...

The author did carry the source-code on his site at around the same time the first version of the game was released - this source was only available for a very short time. Subsequent versions didn’t have their source released as far as I remember.

The author’s original website has long since vanished, and the email address found in the game’s readme simply bounces these days. So I don’t know the author’s thoughts on a source code release. As he removed the source I assume he only wanted the binary to be freeware?

Having read the sources I can safely say the game is a clone and not an emulator. You don’t need the arcade ROM to run the SAM version. The original had a 6809 CPU as opposed to the SAM’s Z80. The SAM version keeps up a respectable 50-fps, which I imagine would be pretty much impossible if it were emulating the 6809.

As already pointed out - the arcade machine would have different address mapping, screen layout, sound hardware and so on…

6502 cpus - 1 for game, 1

6502 cpus - 1 for game, 1 for sound

The Defender aracade game

The Defender aracade game used one M6809 for the game and one M6808 for the as isdescribed in the article and confirmed here.

Was Defender reviewed?

I can’t find any 3rd party reviews for this game. Was the game actually released, and was it ever reviewed?

Defender was never reviewed...

Defender was initially published by Persona around Xmas 1998. However, the sad death of SAM stalwart Malcolm Mackenzie, and the subsequent demise of Persona, meant the game had a very short production run. The game later became available via the Internet.

As far as I am aware the game never received any sort of write-up or review by any of the many SAM Diskzines or Fanzines. It probably arrived too late in the SAM’s life to be reviewed by any of the Spectrum magazines in their SAM pages. I’m not sure, but it’s possible most (all?) of the Speccy magazines had died by early 1999?

Worse than that, even

most (all?) of the Speccy magazines had died by early 1999?

British glossy newsstand Spectrum magazines were dead by the end of 1993!

Why so difficult?

This game is too bloody difficult to play! Why was it made this way?

Other Digital Reality games like Astroball and Dyzonium are bloody tricky too. Were Digital Reality sadists or something?

Both Astroball and Dyzonium had a cheat mode which could be activated, does anyone know if Defender has a cheat mode?

IMHO

Defender itself has always been rock hard to play so the Sam conversion is most definatly faithfull to the original.

No cheats, and it was

No cheats, and it was originally designed so it would only work on real SAM hardware, not under emulation :)

Hard? Nah - this is how the real machine was… and the only difference between this and the original (except for the slightly smaller screensize) was that the original machine has a co-processor to handle the sound … so Chris wasn’t able to use many cycles for this purpose.

Not quite...

… wrote:
it was originally designed so it would only work on real SAM hardware, not under emulation

Not quite… Defender runs with interrupts permanently disabled, relying on the HPEN tracking to determine whether he was ahead or behind the current frame. This tracking was extremely timing sensitive, and on older (less accurate) versions of SimCoupe the speed was very variable, spoiling the gameplay experience. This was enough for Chris to add a timing test, which measured the interrupt-to-interrupt cycle time. The result of this was used to form an execution address for the start of the game, and any difference would cause the game to crash instead of start.

Once the SimCoupe timing had been fixed the game ran fine, and Chris was quite happy for it to run in the emulator. So he wasn’t anti-emulator, just anti-inaccurate-emulator!

Simon Owen wrote:…This

Simon Owen wrote:
…This was enough for Chris to add a timing test, which measured the interrupt-to-interrupt cycle time. The result of this was used to form an execution address for the start of the game, and any difference would cause the game to crash instead of start…

Seems like an awful lot of trouble to prevent its use under emulation? I imagine it would have been quite trivial to patch the Defender code to circumvent this forced crash?

It was easy to patch

It was easy to patch, but bypassing it just exposed the stuttery gameplay that Chris didn’t want people to see. Instead we worked to solve the cause of the problem in the emulator, which improved the accuracy with everything else too.

I’ve just looked up the timing check in the Defender source code, and it IS actually referred to as “anti-emulator code”, but I know from speaking to Chris that he was just making sure people see it as it was supposed to play. The check is only 43 bytes long too, so not much extra work to add.

Why wasn't it well protected?

Simon Owen Wrote:
…It was easy to patch, but bypassing it just exposed the stuttery gameplay that Chris didn’t want people to see…

If he was so worried people would see it under emulation why didn’t he protect the “anti” emulator code better? Perhaps he wasn’t able to do this style of coding, and should have got someone like Cookie to write code protection?

Real protection wasn't needed

Chris was only protecting against poor emulation, and is happy now Defender runs as he intended.

There’s no such thing as true anti-emulator protection, as a good emulation is completely transparent to the software running under it. You can only hope to pick on known emulator deficiencies, which can be fixed if they’re exploited. The current emulation accuracy is extremely good, but there are still a few relatively obscure areas where you could detect a difference. They’ll be added at some point but with no existing software likely to notice they’re not high on the ToDo list.

If you’ve seen ProDos -

If you’ve seen ProDos - you’d see that Chris could right very crypric protection if required… :)

Chris rules OK

Agreed that Chris did the best of the protections on the SAM. Pro-Dos does have many decryption loops, which would be tedious to work through manually. The disk format is interesting but nothing too extreme - I’ve got a working disk image with the protection intact.

Bringing it back on topic, the Defender disk he did for Persona has the best SAM protection I’ve seen so far. It’s the only disk that needed some manual processing to create a disk image, due to him hiding data in a sector without an ID header. It requires a 1772 raw track read to see it, and it must be present for the disk to boot.

Why so difficult

Defender might be faithful to the original in the rock-hard stakes, but I’m not on my own here, near enough every Sam owner I know (3!!) finds the majority of Sam games on the brink of impossible. Even the childrens games like Boing and Vegetable Vacation are virtualy unplayable coz of the impossibilty factor (okay Boing isnt TOO bad I suppose…) - Me thinks this is a big shame coz theres nothing more I like to do than plug my infamous retro machine into the box on a fri night but once you get past the second levels on most games they are too darn hard. Way 2 hard.

It’s only as difficult as

It’s only as difficult as the original machine. :)


blast from the past

I just have to say: THANK YOU. your port of ,what i consider THE all time greatest arcade game EVER:DEFENDER is just sublime.

I ploughed 10 penny coins into this machine all day long in my youth.

I would be eternally grateful for any heads-up on source code and/or algorithms for the laser fire trail, enemy seeking/movment/projectiles and not to mention the implosion/explosion effects. Im currently writing a game (retro style) and although I’ve managed to code some decent effects, i would like to take a peek at the terrific defender code.
any source code and/or algorithms will be greatly appreciated. Especially from my all time greatest game - EVER - Defender.

Keep up the great work -

i will be happy to give you a free version of my iPhone game once completed in return.

Mark

Contact

Have you tried contacting the author? According to the readme.txt file found in the updated Defender .ZIP he says he subscribes to the SAM Users mailing list, so it might be worth registering and asking on there?

DEFENDER tips

Great tip, I will try contacting the author. much appreciated for your reply.
Mark

tutu is not working

what is the solution for tutu helper is not working on my iPhone. Please help me - http://tutuhelperappdownload.com/tutu-helper-not-working-installing/

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.