'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
5MinuteRetro
Dizzy
Posts: 92
Joined: Mon Nov 13, 2017 12:21 pm
Location: UK
Contact:

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

Post by 5MinuteRetro » Thu Dec 07, 2017 5:23 pm

Joefish wrote:
Thu Dec 07, 2017 2:55 pm
Cobra scrolls two pixels at a time as well. That's done by re-drawing the screen every time from pre-shifted blocks, rather than rotating the pixels that make up the screen.
The trick there is having a small number of scenery blocks, and further limiting which block you can place next to another block, because what you're really pre-shifting is the transitions from one block to another, and the number of those can get out of hand if you're not careful.
I really have no idea what any of that means. Good games both, though! :shock:
0 x
Retro stuff, real quick
YouTube: http://bit.ly/5MinuteRetro
Twitter: https://twitter.com/5MinuteRetro

User avatar
ZXDunny
Berk
Posts: 23
Joined: Tue Nov 14, 2017 3:45 pm

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

Post by ZXDunny » Thu Dec 07, 2017 6:17 pm

Pre-shifting offloads much of the work in a scrolling game to outside of the game loop. For example:

You are scrolling from right to left. You draw a column of blocks at the right hand edge of the screen, and then you literally process every single byte in the display - rotating the bits in each byte to the right by one place, copying the leftmost bit into the next block to the left etc. After you've done this 8 times (6144 bytes each time for a full screen) you draw another column of blocks to the right. Rinse, repeat - you're scrolling the screen.

It's damned slow. How to speed it up? Well, your screen is likely to be mostly full of empty space. No need to scroll those. And it's made of blocks that you're drawing at the right hand edge, yeah? Well, if you store 8 copies of each block, each rotated one place, then instead of wasting time rotating the screen bytes, you instead just draw the blocks you want at the positions you want, choosing an already-scrolled version instead.

bingo, a much faster scroll. Downside is 8x the memory usage (at best, more if blocks can sit next to one another) as those pre-rotated blocks have to be stored somewhere. But with careful and clever planning, you're good.
0 x

Joefish
Berk
Posts: 49
Joined: Tue Nov 14, 2017 10:26 am

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

Post by Joefish » Thu Dec 07, 2017 6:25 pm

Not quite. First split your scenery map up into 16x16 pixel blocks.

Now, imagine the Speccy screen was just one tiny 16x16 pixel window view of the level. At any one moment you'd only be able to see one scenery block scrolling out to the left as another scrolls in from the right. You'd be watching a sort of animation as one block slides out to be replaced by another. By pre-drawing a series of these animations you could display any part of the level going past at any time (within that one-block-sized window). There'd be various different versions of this animation as different blocks scroll out to be replaced by others. But by careful level design, you could keep the different combinations down to a minimum.

Now imagine the Speccy screen as a 16x12 fixed grid of 16x16 pixel blocks. By displaying one of these animations in each block, you could create the look that the whole level is scrolling past.
0 x

User avatar
Seven.FFF
Berk
Posts: 36
Joined: Sat Nov 25, 2017 10:50 pm

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

Post by Seven.FFF » 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
1 x
Robin Verhagen-Guest
colonel32
seven-fff.com
threetwosevensixseven.com

Ralf
Microbot
Posts: 123
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

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

Post by Ralf » Thu Dec 07, 2017 8:41 pm

A good example of game with efficient scroll engine is Stormlord. It's better engine than Ghosts'n'Goblins or Cobra as it allows much more variety of graphics.

I made a post about it on old WOS but i may repeat it here.

So the scroll is by 2 pixels and framerate is 25 fps. you have 16x16 pixel tiles, each in 4 versions, shifted by 0,2,4 and 6 pixels.

The trick is assuming that some tiles may touch only selected another tiles so you have for example

- brick wall touching another brick wall
- edge of brick wall touching empty space
- left part of mushroom touching middle part of mushroom and so on

In shifted tiles we have a part of original tile and a part of neigbour tile. You don't have to combine them by OR, XOR or whatever. You just copy it directly from memory to screen.

A bonus to such approach is that you don't have to draw empty tiles. While everything moves "edge tiles" (edges of walls and other objects) which include some empty space effectively clear everything behind them. Maybe one day I'll make a screen about it as it may be hard to imagine from verbal description but it works (if there is enough empty space as scrolling totally filled screen would be too much for 25 fps).

-----------------------------
On the other hand we have Ghosts'n'Goblins. I'm probably in minority but I consider it to be a bad port :twisted: It''s smooth but that's all. It's very simplistic, with few tiles, ugly graphics, tiny sprites, few levels compared to arcade and crazy difficulty.

I respect the author (Keith Burkill) of course. He wrote Commando as well which is simply splendid without discussion.

As for the Ghosts'n'Goblins engine, I inspected the game code a bit once and would say there isn't any :lol: Really. For me engine is something reusable that you can use for another game. Here everything is hardcoded, data mixed with code all the time. There aren't any tiles or maybe there are tiles of different width and height. There is different code to scroll graves, different to scroll ground, different to scroll trees, platforms and so on. Totally crazy code that devil himself wouldn't understand. :)
2 x

User avatar
R-Tape
Site Admin
Posts: 247
Joined: Thu Nov 09, 2017 11:46 am

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

Post by R-Tape » Thu Dec 07, 2017 8:42 pm

Robin, please remember this is a Spectrum forum. We'd appreciate it if you post your Atari 2600 vids elsewhere.

Thankyou.
1 x

User avatar
Seven.FFF
Berk
Posts: 36
Joined: Sat Nov 25, 2017 10:50 pm

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

Post by Seven.FFF » Thu Dec 07, 2017 8:51 pm

R-Tape wrote:
Thu Dec 07, 2017 8:42 pm
Robin, please remember this is a Spectrum forum. We'd appreciate it if you post your Atari 2600 vids elsewhere.

Thankyou.
LOL!

The really, really annoying thing is that Mark Turmell did it all on the woody with 128 bytes of RAM and 4 KB of ROM :((((
0 x
Robin Verhagen-Guest
colonel32
seven-fff.com
threetwosevensixseven.com

User avatar
R-Tape
Site Admin
Posts: 247
Joined: Thu Nov 09, 2017 11:46 am

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

Post by R-Tape » Thu Dec 07, 2017 9:27 pm

Ralf wrote:
Thu Dec 07, 2017 8:41 pm
As for the Ghosts'n'Goblins engine, I inspected the game code a bit once and would say there isn't any :lol: Really. For me engine is something reusable that you can use for another game. Here everything is hardcoded, data mixed with code all the time. There aren't any tiles or maybe there are tiles of different width and height. There is different code to scroll graves, different to scroll ground, different to scroll trees, platforms and so on. Totally crazy code that devil himself wouldn't understand. :)
I never investigated the code but I was impressed by the GnG scroller, it does a lot of ~detailed graphics quickly and smoothly over a large area. I guess ^that^ would explain it, lots of designed for purpose routines that are horrible to unravel but do one job well.
0 x

User avatar
5MinuteRetro
Dizzy
Posts: 92
Joined: Mon Nov 13, 2017 12:21 pm
Location: UK
Contact:

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

Post by 5MinuteRetro » Thu Dec 07, 2017 10:02 pm

Ralf wrote:
Thu Dec 07, 2017 8:41 pm
A good example of game with efficient scroll engine is Stormlord. It's better engine than Ghosts'n'Goblins or Cobra as it allows much more variety of graphics.

I made a post about it on old WOS but i may repeat it here.

So the scroll is by 2 pixels and framerate is 25 fps. you have 16x16 pixel tiles, each in 4 versions, shifted by 0,2,4 and 6 pixels.

The trick is assuming that some tiles may touch only selected another tiles so you have for example

- brick wall touching another brick wall
- edge of brick wall touching empty space
- left part of mushroom touching middle part of mushroom and so on

In shifted tiles we have a part of original tile and a part of neigbour tile. You don't have to combine them by OR, XOR or whatever. You just copy it directly from memory to screen.

A bonus to such approach is that you don't have to draw empty tiles. While everything moves "edge tiles" (edges of walls and other objects) which include some empty space effectively clear everything behind them. Maybe one day I'll make a screen about it as it may be hard to imagine from verbal description but it works (if there is enough empty space as scrolling totally filled screen would be too much for 25 fps).

-----------------------------
On the other hand we have Ghosts'n'Goblins. I'm probably in minority but I consider it to be a bad port :twisted: It''s smooth but that's all. It's very simplistic, with few tiles, ugly graphics, tiny sprites, few levels compared to arcade and crazy difficulty.

I respect the author (Keith Burkill) of course. He wrote Commando as well which is simply splendid without discussion.

As for the Ghosts'n'Goblins engine, I inspected the game code a bit once and would say there isn't any :lol: Really. For me engine is something reusable that you can use for another game. Here everything is hardcoded, data mixed with code all the time. There aren't any tiles or maybe there are tiles of different width and height. There is different code to scroll graves, different to scroll ground, different to scroll trees, platforms and so on. Totally crazy code that devil himself wouldn't understand. :)
I read it. Read it again. And read it again. And I still don't really geddit. I really appreciate all the effort here but I suspect the only way I'd ever understand all this stuff is with an animation of some sort. Either way, all this shifting sounds like immensely hard, complicated work!
0 x
Retro stuff, real quick
YouTube: http://bit.ly/5MinuteRetro
Twitter: https://twitter.com/5MinuteRetro

User avatar
5MinuteRetro
Dizzy
Posts: 92
Joined: Mon Nov 13, 2017 12:21 pm
Location: UK
Contact:

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

Post by 5MinuteRetro » Thu Dec 07, 2017 10:10 pm

Joefish wrote:
Thu Dec 07, 2017 6:25 pm
Not quite. First split your scenery map up into 16x16 pixel blocks.

Now, imagine the Speccy screen was just one tiny 16x16 pixel window view of the level. At any one moment you'd only be able to see one scenery block scrolling out to the left as another scrolls in from the right. You'd be watching a sort of animation as one block slides out to be replaced by another. By pre-drawing a series of these animations you could display any part of the level going past at any time (within that one-block-sized window). There'd be various different versions of this animation as different blocks scroll out to be replaced by others. But by careful level design, you could keep the different combinations down to a minimum.

Now imagine the Speccy screen as a 16x12 fixed grid of 16x16 pixel blocks. By displaying one of these animations in each block, you could create the look that the whole level is scrolling past.
Actually, I suppose I *do* kind of get this. But it sounds enormously labour-intensive to have to draw all the possible background/tile combinations. In fact, having just watched a Stormlord video on YouTube, I simply cannot imagine how all that is feasible in 48K.
0 x
Retro stuff, real quick
YouTube: http://bit.ly/5MinuteRetro
Twitter: https://twitter.com/5MinuteRetro

Post Reply