 |
Behind the
Hack
by
Jeff Kulczycki
For starters, I
spent about 6 months going over the disassembled code line by
line. I followed and
studied every routine and commented over 10,000 lines of code.
Because I used a lot of the routines for the new level I
needed to understand precisely how they all worked.
Once I understood and documented every aspect of the game,
I was ready to create the new level.
I wanted the new level to have a unique "look"
and "theme" but I only had so much to work with.
I wanted something that was a little more challenging then
the current levels. To me the hardest level was the Elevators because it required
some precisely timed jumps. I
tried several different ideas but most weren't really fun to play.
Then I decided to bring back the Elevators.
I gave them a different twist by making them move
back-and-forth instead of up-and-down.
After several weeks and lots of changes the layout was
complete. Then I had
to code it. It only
took about 4 months to add all the code for the new level.
And you can't just add stuff without taking something out.
The final cut of the ROMs including the Foundry was about
1000 bytes larger than what would fit in the 4 ROMs, so I rewrote
a majority of the original DK routines more efficiently so that I
could create space. For
example the point award table originally used 3 bytes for each
possible point award like this:
L3529: .BYTE
$00,$00,$00 ; 0 points
.BYTE
$00,$01,$00 ; 100 points
.BYTE
$00,$02,$00 ; 200 points
.BYTE
$00,$03,$00 ; 300 points
.BYTE
$00,$04,$00 ; 400 points
.BYTE
$00,$05,$00 ; 500 points
.BYTE
$00,$06,$00 ; 600 points
.BYTE
$00,$07,$00 ; 700 points
.BYTE
$00,$08,$00 ; 800 points
.BYTE
$00,$09,$00 ; 900 points
.BYTE
$00,$00,$00 ; 0 points
.BYTE
$00,$10,$00 ; 1,000 points
.BYTE
$00,$20,$00 ; 2,000 points
.BYTE
$00,$30,$00 ; 3,000 points
.BYTE
$00,$40,$00 ; 4,000 points
.BYTE
$00,$50,$00 ; 5,000 points
.BYTE
$00,$60,$00 ; 6,000 points
.BYTE
$00,$70,$00 ; 7,000 points
.BYTE
$00,$80,$00 ; 8,000 points
.BYTE
$00,$90,$00 ; 9,000 points
Can you spot the wasted bytes? All those $00's! So
I rewrote the scoring routine so that it wouldn't add zeros (cause
that's just silly) and the new table looked like this:
L3529: .BYTE
$00 ; 0 points
.BYTE
$01 ; 100 points
.BYTE
$02 ; 200 points
.BYTE
$03 ; 300 points
.BYTE
$04 ; 400 points
.BYTE
$05 ; 500 points
.BYTE
$06 ; 600 points
.BYTE
$07 ; 700 points
.BYTE
$08 ; 800 points
.BYTE
$09 ; 900 points
.BYTE
$00 ; 0 points
.BYTE
$10 ; 1,000 points
.BYTE
$20 ; 2,000 points
.BYTE
$30 ; 3,000 points
.BYTE
$40 ; 4,000 points
.BYTE
$50 ; 5,000 points
.BYTE
$60 ; 6,000 points
.BYTE
$70 ; 7,000 points
.BYTE
$80 ; 8,000 points
.BYTE
$90 ; 9,000 points
That saved about 20 bytes (only 980 more to go!).
I kept rewriting and trying different things.
I'd save 10 bytes here, 2 bytes here, and so on.
It took another 3 months to create enough space to fit the
new level in.
Play testing all levels again took several weeks because often
times changing one thing causes glitches elsewhere, and there were
plenty of glitches. There
were several more iterations of the new level before I got just
what I was looking for. Then
I had some beta testers play and I fixed a few more bugs, like
when the fireballs would scroll off the bottom of the screen and
briefly flash at the top of the screen.
|