'Dixel' scrolling... Ghosts 'n' Goblins

General software. From trouble with the Banyan Tree to OCP Art Studio, post any general software chat here. Could include game challenges...
User avatar
Lethargeek
Manic Miner
Posts: 743
Joined: Wed Dec 11, 2019 6:47 am

Re: 'Dixel' scrolling... Ghosts 'n' Goblins

Post by Lethargeek »

Ralf wrote: Sun Jan 05, 2020 4:21 pm But would it work with graphics like Stormlord? Or Zynaps? Or Robocop?
It would be slower, yes, to push instead of just skipping the solid space. But typical Stormlord screen usually has much more empty space to skip. Zynaps - maybe, with careful level design. Definitely not Robocop.
Ralf
Rick Dangerous
Posts: 2287
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: 'Dixel' scrolling... Ghosts 'n' Goblins

Post by Ralf »

But typical Stormlord screen usually has much more empty space to skip
Maybe you missed it from the earlier discussion but Stormlord actually skips empty space.

At address 36132 you have CALL NZ, 36226. Which means draw a tile only if tile nr<>0. And tile nr=0 is empty space.

It works more or less the same way that you are talking about, I believe. Tiles are stored with some empty space at the edges
and when game area scrolls new tiles clear everything behind them.

Raf Cecco was really a clever guy.
User avatar
Lethargeek
Manic Miner
Posts: 743
Joined: Wed Dec 11, 2019 6:47 am

Re: 'Dixel' scrolling... Ghosts 'n' Goblins

Post by Lethargeek »

Ralf wrote: Sun Jan 05, 2020 6:22 pm Maybe you missed it from the earlier discussion but Stormlord actually skips empty space.
No, i missed nothing. My point was it has more empty space to skip than my example.
Ralf wrote: Sun Jan 05, 2020 6:22 pm It works more or less the same way that you are talking about, I believe. Tiles are stored with some empty space at the edges
and when game area scrolls new tiles clear everything behind them.
Absolutely not the same way. Doesn't scroll anything on-screen and is wasting memory for pre-shifted tiles.

In my example, tiles are stored only once (and rotated 90 degrees to appear at the edge pixel-by-pixel) and later are actually scrolled on-screen.
catmeows
Manic Miner
Posts: 718
Joined: Tue May 28, 2019 12:02 pm
Location: Prague

Re: 'Dixel' scrolling... Ghosts 'n' Goblins

Post by catmeows »

Seven.FFF wrote: Thu Dec 07, 2017 8:19 pm This is things in the foreground moving horizontally, rather than the entire background - but you can get pretty fast and furious, and deal with different speeds, when you scroll preshifted stuff. As long as you have the space to store all the different versions. I've gone 128K-only here for that reason!

Image
Eeeee. Does this thing really exist ? On Zx ?
Proud owner of Didaktik M
User avatar
Vampyre
Manic Miner
Posts: 839
Joined: Wed Nov 15, 2017 2:51 pm
Contact:

Re: 'Dixel' scrolling... Ghosts 'n' Goblins

Post by Vampyre »

Edit: Doh! I can see that the "dixel" term had already been found way earlier in this thread!
ZX Spectrum Reviews REST API: http://zxspectrumreviews.co.uk/
wizbob
Drutt
Posts: 4
Joined: Mon May 20, 2019 12:24 pm

Re: 'Dixel' scrolling... Ghosts 'n' Goblins

Post by wizbob »

catmeows
Manic Miner
Posts: 718
Joined: Tue May 28, 2019 12:02 pm
Location: Prague

Re: 'Dixel' scrolling... Ghosts 'n' Goblins

Post by catmeows »

wizbob wrote: Tue Sep 01, 2020 12:47 pm I don't know if you guys have seen this beautifully illustrated review of the dixel scrolling in Ghosts'n'Goblins.
Thanks.
Proud owner of Didaktik M
Nienn Heskil
Microbot
Posts: 134
Joined: Tue Jun 09, 2020 6:14 am
Contact:

Re: 'Dixel' scrolling... Ghosts 'n' Goblins

Post by Nienn Heskil »

Spends waaay too much time on obvious things like the sprite method, but it was interesting to learn about the scrolling of attributes at least (I've used a similar approach in Mint). Perhaps this is one of the reasons there's no color on levels with vertical scrolling added.

I think the most interesting thing about GnG is definitely the crazy way the backgrounds are put together from different elements. This and Marauder, also maybe Zynaps... I've always wondered what sort of tools they've used to make the level maps (assuming it's not all hardcoded).
User avatar
Einar Saukas
Bugaboo
Posts: 3131
Joined: Wed Nov 15, 2017 2:48 pm

Re: 'Dixel' scrolling... Ghosts 'n' Goblins

Post by Einar Saukas »

C.Born wrote: Sat Dec 09, 2017 5:28 pm

Code: Select all

; your sinclair issue 19 page 74
; it stll needs a full loop

org 32000
        di
        ld bc,6144
        ld hl,22527
loop:   srl (hl)
        call c,sub1
        srl (hl)
        call c,sub2
        dec hl
        dec bc
        ld a,b
        or c
        jr nz,loop
        ei
        ret
sub1    inc hl
        set 6,(hl)
        dec hl
        ret
sub2    inc hl
        set 7,(hl)
        dec hl
        ret
Ouch!

Here's my version of dixel scrolling:

Code: Select all

    ld hl,16384
    ld bc,24
loop:
    rr (hl)
    ex af,af'
    rr (hl)
    ex af,af'
    inc l
    djnz loop
    inc h
    dec c
    jp nz,loop
The same routine using unrolled loop:

Code: Select all

    ld hl,16384
    ld b,192
loop:
REPT 31
    rr (hl)
    ex af,af'
    rr (hl)
    ex af,af'
    inc l
ENDR
    rr (hl)
    ex af,af'
    rr (hl)
    ex af,af'
    inc hl
    dec b
    jp nz,loop
presh
Manic Miner
Posts: 237
Joined: Tue Feb 25, 2020 8:52 pm
Location: York, UK

Re: 'Dixel' scrolling... Ghosts 'n' Goblins

Post by presh »

Einar Saukas wrote: Tue Sep 01, 2020 6:53 pm Here's my version of dixel scrolling:

Code: Select all

    ld hl,16384
    ld bc,24
loop:
    rr (hl)
    ex af,af'
    rr (hl)
    ex af,af'
    inc l
    djnz loop
    inc h
    dec c
    jp nz,loop
The same routine using unrolled loop:

Code: Select all

    ld hl,16384
    ld b,192
loop:
REPT 31
    rr (hl)
    ex af,af'
    rr (hl)
    ex af,af'
    inc l
ENDR
    rr (hl)
    ex af,af'
    rr (hl)
    ex af,af'
    inc hl
    dec b
    jp nz,loop
Came here after spotting this in the Common machine code sequences thread, and was curious to see how it compares to the version posted in YS which I remembered being mentioned here.

Loving the use of EX AF, AF' to preserve the carry bits. Genius! :ugeek:
User avatar
Einar Saukas
Bugaboo
Posts: 3131
Joined: Wed Nov 15, 2017 2:48 pm

Re: 'Dixel' scrolling... Ghosts 'n' Goblins

Post by Einar Saukas »

Not really. :)

Dixel scrolling is not a great idea. If you have enough free memory for the unrolled loop implementation, then running a single pixel scroll twice is actually faster than a single dixel scroll without screen memory contention (although dixel scrolling performs better during memory contention while running the raster scan, if my calculations are correct... I don't have an emulator right now to validate it).
User avatar
Joefish
Rick Dangerous
Posts: 2058
Joined: Tue Nov 14, 2017 10:26 am

Re: 'Dixel' scrolling... Ghosts 'n' Goblins

Post by Joefish »

In this case, isn't it more efficient to fetch a byte from memory, scroll it, then write it back, rather than do two in-place rotates?
Though it's only quick if you're shifting in A, which means you can't do EX AF,AF'... So maybe not...
Nienn Heskil
Microbot
Posts: 134
Joined: Tue Jun 09, 2020 6:14 am
Contact:

Re: 'Dixel' scrolling... Ghosts 'n' Goblins

Post by Nienn Heskil »

For 2px scrolling, try POP: RL: RL: PUSH. I have one such routine that scrolls some 30x192 area, the resulting speed is about 31T/byte (uncontended), which is close to RL (HL) x2 with nothing in between.
catmeows
Manic Miner
Posts: 718
Joined: Tue May 28, 2019 12:02 pm
Location: Prague

Re: 'Dixel' scrolling... Ghosts 'n' Goblins

Post by catmeows »

Nienn Heskil wrote: Tue Oct 06, 2020 4:53 pm For 2px scrolling, try POP: RL: RL: PUSH. I have one such routine that scrolls some 30x192 area, the resulting speed is about 31T/byte (uncontended), which is close to RL (HL) x2 with nothing in between.
I don't see how this could work. Could you share your code ?
Proud owner of Didaktik M
Nienn Heskil
Microbot
Posts: 134
Joined: Tue Jun 09, 2020 6:14 am
Contact:

Re: 'Dixel' scrolling... Ghosts 'n' Goblins

Post by Nienn Heskil »

catmeows wrote: Tue Oct 06, 2020 6:05 pm
Nienn Heskil wrote: Tue Oct 06, 2020 4:53 pm For 2px scrolling, try POP: RL: RL: PUSH. I have one such routine that scrolls some 30x192 area, the resulting speed is about 31T/byte (uncontended), which is close to RL (HL) x2 with nothing in between.
I don't see how this could work. Could you share your code ?
Here
User avatar
Einar Saukas
Bugaboo
Posts: 3131
Joined: Wed Nov 15, 2017 2:48 pm

Re: 'Dixel' scrolling... Ghosts 'n' Goblins

Post by Einar Saukas »

Nice :)
catmeows
Manic Miner
Posts: 718
Joined: Tue May 28, 2019 12:02 pm
Location: Prague

Re: 'Dixel' scrolling... Ghosts 'n' Goblins

Post by catmeows »

Nienn Heskil wrote: Tue Oct 06, 2020 6:17 pm
catmeows wrote: Tue Oct 06, 2020 6:05 pm I don't see how this could work. Could you share your code ?
Here
Thanks. That bidirectional shift of A to store 2 bits was the missing part.
Proud owner of Didaktik M
User avatar
arjun
Microbot
Posts: 151
Joined: Sat Sep 19, 2020 7:34 am
Location: India
Contact:

Re: 'Dixel' scrolling... Ghosts 'n' Goblins

Post by arjun »

Einar Saukas wrote: Tue Oct 06, 2020 3:51 pm if my calculations are correct... I don't have an emulator right now to validate it).
Einar I'm concerned. This is the second post I've seen from you with the above words. Are you okay? Are you being held against your will, somewhere? This is your secret code for "Help. Rescue me!", right?

Please post again with the words "emulation is for n00bs" to confirm. We will immediately create a ticket for this rescue task. You can track the progress being made towards your rescue in the ticket. Please take the time to rate this support on a scale of 1 to 10. Thank you!
User avatar
Einar Saukas
Bugaboo
Posts: 3131
Joined: Wed Nov 15, 2017 2:48 pm

Re: 'Dixel' scrolling... Ghosts 'n' Goblins

Post by Einar Saukas »

arjun wrote: Wed Oct 07, 2020 9:01 amEinar I'm concerned. This is the second post I've seen from you with the above words. Are you okay?
I'm not used to more than a few hours without access to an emulator... but now I'm back home so everything's fine!
Post Reply