Possible new DigDug version for the BBC Micro

developing/porting a new game or gaming framework? post in here!
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by tricky »

Added the blowing up code, still some timing and tidying to do, like not firing through solid dirt!
Smart meter fitting stopped play this morning!
966 bytes free
Attachments
Trickycadegame.ssd
(12.75 KiB) Downloaded 22 times
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by tricky »

tweaked the pumping timing and added the popped sprite
still lots to add and all the rest of the sounds to sort out!
894 bytes free
Attachments
Trickycadegame.ssd
(12.75 KiB) Downloaded 30 times
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by tricky »

No one spotted the crash bug :(
Here is a fixed version, but last monster standing tune and bgm are wrong (Oh yes, should have last monster tune and bgm ;)!
873 bytes free
Attachments
Trickycadegame.ssd
(12.75 KiB) Downloaded 13 times
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by tricky »

Made the hurry up tune the BGM when you have one monster left
867 bytes left

Just let me know if these tiny updates are annoying, they do seem to be keeping me coming back though ;)
Attachments
Trickycadegame.ssd
(12.75 KiB) Downloaded 21 times
Colday
Posts: 899
Joined: Thu Jul 25, 2019 10:18 pm
Location: North Essex, UK
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by Colday »

I'm really enjoying the little updates Tricky.

It's fascinating to see the progression!

It's also somewhat nail biting as to the byte countdown. Better than most current soaps on TV!

:-)
BBC's... B's I now have 6 9 101113 10x full and 1x separate mainboard all working.
Includes 3x Masters all working 1x broken Master
Many floppy drives with a pile of 6 to test.
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by tricky »

Thanks, but in my experience that isn't saying much :lol:
Added a couple more "tunes" for rocks falling and food appearing and being collected but the logic needs tweaking as they get interrupted!
I think having dirt stop the "hose" should be next.
857 bytes free
Attachments
Trickycadegame.ssd
(12.75 KiB) Downloaded 20 times
Colday
Posts: 899
Joined: Thu Jul 25, 2019 10:18 pm
Location: North Essex, UK
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by Colday »

tricky wrote: Thu Jun 01, 2023 3:28 pm Thanks, but in my experience that isn't saying much :lol:
Yes, I guess that could definitely be seen as somewhat passive aggressive and a veiled compliment.

Haha. :-)

Certainly not meant that way.

I cannot actually remember the last time I turned the TV on in the house.
BBC's... B's I now have 6 9 101113 10x full and 1x separate mainboard all working.
Includes 3x Masters all working 1x broken Master
Many floppy drives with a pile of 6 to test.
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by tricky »

Added dirt blocking the "hose" but hasn't had much testing!
800 bytes free
Attachments
Trickycadegame.ssd
(13 KiB) Downloaded 27 times
User avatar
fizgog
Posts: 618
Joined: Thu Jun 17, 2021 3:18 pm
Location: Nottinghamshire
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by fizgog »

FYI With version, once I completed level 2, it didn't finish the level and I then couldn't go onto level 3
Pitfall, Gridrunner, Matrix: Gridrunner 2, LaserZone, AcornViewer, AcornPad
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by tricky »

That tells you how far I check it!
If it completes one level it must complete them all!
User avatar
fizgog
Posts: 618
Joined: Thu Jun 17, 2021 3:18 pm
Location: Nottinghamshire
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by fizgog »

Weird as tried it again a few times and it was working fine, not sure what I did to get it to go wrong - worst kind of bugs :(

I did take a screenshot though when it did go wrong at the time, in case I couldn't reproduce

Screenshot 2023-06-02 at 11.23.27.png
Pitfall, Gridrunner, Matrix: Gridrunner 2, LaserZone, AcornViewer, AcornPad
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by tricky »

Did you pop a monster that was caught by a rock as you were inflating it?
Actually, that would count the same monster twice but I should still handle it!
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by tricky »

Fixed pumping up monsters I hope!
There are lots of cases to consider, including dropping a rock on an inflated monster.
751 bytes free
TrickycadeDigDug.ssd
(13 KiB) Downloaded 30 times
PS Sorry for the break, but I've not felt like it and have been playing a bit of golf to try to get a bit of fitness back.
User avatar
lovebug
Posts: 1740
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by lovebug »

@Tricky looking great

I was wondering would it be easy to store the current play position of the music so it can continue from where it was after pausing (like the arcade) instead of restarting from the beginning ?
Image Image Image Image
User avatar
FourthStone
Posts: 1527
Joined: Thu Nov 17, 2016 2:29 am
Location: Brisbane, Australia
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by FourthStone »

Looking great Tricky, played through to level 10 without much drama, apart from not being able to die and the dropping rock bonus doesn't apply, it's probably mentioned further up the thread but I haven't read through all the posts as yetl, I just wanted to take a quick peek at how the game is looking. I dropped a rock on a few baddies with the biggest bonus being 4000 (not applied) I'm sure I can gather more of them for an even bigger bonus =D>
Tricky_DigDug_2023.PNG
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by tricky »

Thanks guys.
Rich, how did you know I wear red trousers while playing? (I don't, but I did used to wear red braces while playing in the 90s)
The tune should continue if another hasn't started.
If there is space for sound and SN state and the code to do it it should be simple, but I'll see what space is left at the end.
The bonus was working, thanks for spotting it as I hadn't noticed.
I'm going to reorder the palette choices to put something hopefully more like the game at least on the first screen but am generally OK with the selection that I have; but I'm always open to other options.
You can currently only die by dropping a rock on yourself, I was leaving the rest to make it easier to complete levels ;)

I seem to have misplaced my TODO list, I usually keep it at the end of the code!
Fix bonus for dropping rocks on monsters.
Monster "AI" has a couple of issues and need to have runaway mode as well as ghosting through dirt.
Fygars need to breathe fire and telegraph that they are going to do it - just a couple more animations and sprite placing.
I think I have all the tunes that I think I can fit from the game in, but have some white noise effects to add for flames etc.
A basic attract mode if there is room, otherwise it will be the start of level and then sit there to be eaten!
If there is room Resuming BGM from where it left off, currently it silences the sound and doesn't update the tune for a second after stopping moving.

9 bytes of zero page free.
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by tricky »

Add monster crushing bonus.
725 bytes free
Attachments
TrickycadeDigDug.ssd
(13 KiB) Downloaded 25 times
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by tricky »

I'm permanently displaying the fire sprites so that I can tune the timing to keep the flicker to a minimum.
I'm trying to decide whether to allow flicker (seem to only be on the fire and or the pumping target) or just wait for a few monsters to die!
It shouldn't flicker until there are a few more monsters on screen and you drop a rock!
675 bytes left
I seemed to have introduced a hang bug at the end of level, but I haven't worked out when I introduced it or what combination of events causes it!
Oh, I also clear the food if it is left displayed at the end of round.
Attachments
TrickycadeDigDug.ssd
(13 KiB) Downloaded 17 times
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by tricky »

Minor fix for incorrect dirt bit set when moving up on the bottom row, means monsters don't turn back when they should follow now.
Swapped some maths around and managed to remove a DEY.
I also like to solve a bug by removing code :)
676 bytes free
TrickycadeDigDug.ssd
(13 KiB) Downloaded 18 times
PS Can you tell I have run out of steam on this one?
gfoot
Posts: 987
Joined: Tue Apr 14, 2020 9:05 pm
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by gfoot »

tricky wrote: Sat Jul 01, 2023 8:59 am9 bytes of zero page free.
Do you only put things in page zero if they really need to be there, or are there some that could move? I tend to put everything in zero page until I run out, then move things out of they're not used much.

I guess by this point you're tight on normal memory too, and anything you move out of zero page costs an extra byte to reference in the code!
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by tricky »

I put anything that I think will be accessed frequently, but yes, most variables.
I don't usually put look-up tables in ZP unless i need to preserve the accumulator when accessing data so I can do ldx ZP,y and ldy ZP,x or get near the end and find I have some ZP spare.
If I run out, then I move what is easiest to move without a lot of register swapping. Sometimes I even find things that are only accessed ,Y so they don't gain anything by being in ZP for anything other than straight load and sta.

As DigDug is using a sort of generic sprites masked over background, restoring the background, there are 14 * X, Y and Z (sprite) for current sprite position and image and the same again for old so that it can be erased after the sprites have moved!
...
Why do you need the old sprite I hear you ask, good question, you don't so that's 14 byte more ZP free and saves 4 bytes in the code where they were copied!
I started this sprite routive by copying one for EOR sprites where you need to know what the old one was to erase it and never thought to remove it!

You could imagine an assembler + emulator pair that do some profiling to decide which variables and tables would be best off in ZP for speed or code size.
User avatar
fizgog
Posts: 618
Joined: Thu Jun 17, 2021 3:18 pm
Location: Nottinghamshire
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by fizgog »

tricky wrote: Sat Jul 22, 2023 9:27 am You could imagine an assembler + emulator pair that do some profiling to decide which variables and tables would be best off in ZP for speed or code size.
Would be amazing if that existed for the Beeb

Would also be nice to let you know if you actually needed a CLC or SEC as well
Pitfall, Gridrunner, Matrix: Gridrunner 2, LaserZone, AcornViewer, AcornPad
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by tricky »

I did start writing an editor that would highlight them and then strip them when saving to a file to assemble, but never finished it because, self modifying code, jump tables and jumps by pushing addresses and RTSing. Coincidentally the reasons I stopped working on my optimiser ;)
SteveF
Posts: 1663
Joined: Fri Aug 28, 2015 9:34 pm
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by SteveF »

fizgog wrote: Sat Jul 22, 2023 9:51 am
tricky wrote: Sat Jul 22, 2023 9:27 am You could imagine an assembler + emulator pair that do some profiling to decide which variables and tables would be best off in ZP for speed or code size.
Would be amazing if that existed for the Beeb

Would also be nice to let you know if you actually needed a CLC or SEC as well
I had a go at hacking something like this up a while ago while trying to optimise Ozmoo's use of zero page. The following Python code tries to analyse an acme listing file to identify the most promising variables at non-zp addresses to promote to zp to save code size. It wouldn't surprise me if it is buggy, and it only does half the job, but it's here FWIW. I would love to see someone do this properly (actually correct analysis :-), accept output from multiple assemblers, accept profiling output from an emulator for size-instead-of-speed optimisation and to partly avoid the "no hex dump of macro expansions" problem, etc etc etc)...

Code: Select all

#!/usr/bin/env python

from __future__ import print_function
import sys
from collections import defaultdict

# TODO: Assumes acme listing format, we can probably auto-detect or be more generic
# TODO: Since acme doesn't show full hex dump of macro expansions, this isn't great for code using lots of macros

candidates = defaultdict(list)

# TODO: Double check this list is complete and correct
# TODO: Add CMOS instructions
abs_variant_with_zp_variant = {
    0x0d: "ora abs",
    0x0e: "asl abs",
    0x1d: "ora abs,x",
    0x1e: "asl abs,x",
    0x2c: "bit abs",
    0x2d: "and abs",
    0x2e: "rol abs",
    0x3d: "and abs,x",
    0x3e: "rol abs,x",
    0x4d: "eor abs",
    0x4e: "lsr abs",
    0x5d: "eor abs,x",
    0x5e: "lsr abs,x",
    0x6d: "adc abs",
    0x6e: "ror abs",
    0x7d: "adc abs,x",
    0x7e: "ror abs,x",
    0x8c: "sty abs",
    0x8d: "sta abs",
    0x8e: "stx abs",
    0x9d: "sta abs,x",
    0xac: "ldy abs",
    0xad: "lda abs",
    0xb6: "lda abs,y",
    0xbd: "lda abs,x",
    0xbc: "ldy abs,x",
    0xbe: "ldx abs,y",
    0xcc: "cpy abs",
    0xcd: "cmp abs",
    0xce: "dec abs",
    0xdd: "cmp abs,x",
    0xde: "dec abs,x",
    0xec: "cpx abs",
    0xed: "sbc abs",
    0xee: "inc abs",
    0xfd: "sbc abs,x",
    0xfe: "inc abs,x",
}

with open(sys.argv[1], "r") as f:
    for line in f:
        line = line[:-1]
        hexbytes = line[13:].lower()
        if len(hexbytes) > 0 and hexbytes[0] in "0123456789abcdef":
            hexbytes = hexbytes.split()[0]
            #mnemonic = line.split()[3]
            #print(mnemonic, line)
            #assert len(mnemonic) >= 3
            #mnemonic = line[48:51].lower()
            opcode = int(hexbytes[0:2], 16)
            # We check against mnemonic as a sanity check in case our ad-hoc parsing is getting confused. NO WE DON'T, IT WAS TOO HARD!
            # if len(hexbytes) == 6: and abs_variant_with_zp_variant.get(opcode, "").startswith(mnemonic):
            if len(hexbytes) == 6 and opcode in abs_variant_with_zp_variant:
                #print("XXX", hex(opcode), line)
                #print("YYY", abs_variant_with_zp_variant.get(opcode, ""), mnemonic)
                candidates[hexbytes[2:]].append(line)

for addr, lines in sorted(candidates.items(), key=lambda x: len(x[1]), reverse=True):
    print("%s%s: %4d" % (addr[2:], addr[0:2], len(lines)))
    for line in lines:
        print("    : %s" % line)
Running this on a random acme listing file, I get:

Code: Select all

3051:   12
    :    559  31dc 8d5130                 sta .ram_pages
    :    586  31f3 8d5130                 sta .ram_pages
[...]
3052:   12
    :    560  31df 8d5230                 sta .ram_pages + 1
    :    585  31f0 2e5230                 rol .ram_pages + 1
16  3566 ad5230                 lda .ram_pages + 1
[...]...
0541:   11
    :    533  199b bd4105                 lda vmap_z_l,x
    :    602  19c1 bd4105               lda vmap_z_l,x ; start block
[...]
This indicates that address $3051, which we can see from the source lines quoted below is the ".ram_pages" label, is referenced 12 times and thus we'd save 12 bytes of code by moving it into zero page. Similarly for .ram_pages+1. The third entry is "true" but not so helpful, as it shows there are 11 references to vmap_z_l, but as this is holding a table rather than a single value it's less likely to be practical to move it into zero page.

(Apologies for derailing tricky's thread, maybe we should move this off to the dev tools forum?)
User avatar
Arcadian
Site Admin
Posts: 4223
Joined: Fri Nov 24, 2000 12:16 pm
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by Arcadian »

tricky wrote: Sat Jul 22, 2023 8:49 am PS Can you tell I have run out of steam on this one?
Keep going Tricky! Can't be much left to do now surely?

A spot of player death is the main thing!

What are your plans for those remaining 692 bytes? Is there anything you think you'll need to omit?

Btw after you've trapped/killed a meanie, it seems very hard to avoid shooting an extra 'bubble' - could that be looked at?
Please subscribe to the ABug YouTube channel!
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by tricky »

Fixing the bubble should be just change the start condition from fire key down to fire key just pressed. May cost a few bytes but may be free.

I'm happy to have my thread hijacked, I did post to it myself, but it would probably be easier to find in a new thread.
User avatar
tricky
Posts: 7695
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by tricky »

Added food collected history on the left, each item only shows once.
649 bytes left, needed another table and a bit more code!
Attachments
TrickycadeDigDug.ssd
(13 KiB) Downloaded 25 times
bteamfox
Posts: 21
Joined: Tue Sep 28, 2021 3:49 pm
Contact:

Re: Possible new DigDug version for the BBC Micro

Post by bteamfox »

Dig Dug! This is a most excellent game and important retro gaming. I'm hoping you are still working on this game as I would love to see it on the BBC.
Post Reply

Return to “new projects in development: games”