Author Topic: Rasters in CPC  (Read 1270 times)

0 Members and 1 Guest are viewing this topic.

Offline sigh

  • 6128 Plus
  • ******
  • Posts: 1.150
  • Liked: 452
  • Likes Given: 41
Rasters in CPC
« on: 19:15, 18 April 11 »
I'm not to sure whether this question should be in the games or programming section of the forum, but I've only recently been looking at rasters while researching on mode 1 and mode 2.

What I would like to know is how many times can the CPC split the screen comfortably with out slowdown within the game area (not the hud). Striker in the Crypts of Trogan seems to have 2 splits in the game area:

Sky
Foreground area with the sprite.

For instance - is it possible to have 3 or 4 splits which would enable 8 colours in mode 1 or 4 mode 2? Are there any other examples apart from Stryker, Thundercats and The living daylights? I can't help feel that there is so much more that can be done graphically with this technique.

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.335
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2260
  • Likes Given: 3478
Re: Rasters in CPC
« Reply #1 on: 19:43, 18 April 11 »
I'm not to sure whether this question should be in the games or programming section of the forum, but I've only recently been looking at rasters while researching on mode 1 and mode 2.

What I would like to know is how many times can the CPC split the screen comfortably with out slowdown within the game area (not the hud). Striker in the Crypts of Trogan seems to have 2 splits in the game area:

Sky
Foreground area with the sprite.

For instance - is it possible to have 3 or 4 splits which would enable 8 colours in mode 1 or 4 mode 2? Are there any other examples apart from Stryker, Thundercats and The living daylights? I can't help feel that there is so much more that can be done graphically with this technique.


Remember my test program that showed where the interrupts were?
Well there is the potential to change the palette at each point (when each interrupt is triggered), so you could change all 4 colours each interrupt.

This will take a little bit of time but not a lot.

EDIT: If you want it at other times, you have to use cpu time to wait to that point, then this takes away from the time for a game.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline sigh

  • 6128 Plus
  • ******
  • Posts: 1.150
  • Liked: 452
  • Likes Given: 41
Re: Rasters in CPC
« Reply #2 on: 20:28, 18 April 11 »
So you can change the palette colours as well as add colours. Adding colours doesn't have any waiting time, but changing colours does.

I think I'll draw an example pic and to see if what I have in mind is possible or not.

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 783
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 391
  • Likes Given: 60
Re: Rasters in CPC
« Reply #3 on: 06:21, 19 April 11 »
EDIT: If you want it at other times, you have to use cpu time to wait to that point, then this takes away from the time for a game.

That depends on whether the waiting is just waiting and not doing something that takes a set amount of time like drawing a scrolled section or the score characters or sprites or other calculations.

Offline sigh

  • 6128 Plus
  • ******
  • Posts: 1.150
  • Liked: 452
  • Likes Given: 41
Re: Rasters in CPC
« Reply #4 on: 12:25, 19 April 11 »
As a test I plan to have a 320 x 200 mode 1 screen, split into 4 sections. The top will have a skyline with unique colours (4 dithered blues). The section below that will have a three colour sprite and one of the blues from the sky. The next section will have the three colour sprite and a colour for the ground. The last section will have the colour from the ground plus 3 new colours.

Offline sigh

  • 6128 Plus
  • ******
  • Posts: 1.150
  • Liked: 452
  • Likes Given: 41
Re: Rasters in CPC
« Reply #5 on: Today at 00:54 »
Well- this is a rather old thread! I got round to doing that test :P



This test shows a Mode 1 screen with a 3 colour sprite travelling through 4 sets of colours, with one of the background colours being the same as the sprite (black).
When the sprite travels through the blue to the green - what would happen in this situation? Would the top of the sprite turn green as it enters?

Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 711
  • Country: fr
    • urban exploration
  • Liked: 985
  • Likes Given: 620
Re: Rasters in CPC
« Reply #6 on: Today at 09:15 »
Well- this is a rather old thread! I got round to doing that test :P



This test shows a Mode 1 screen with a 3 colour sprite travelling through 4 sets of colours, with one of the background colours being the same as the sprite (black).
When the sprite travels through the blue to the green - what would happen in this situation? Would the top of the sprite turn green as it enters?
Mode 1 has 4 color right?
Assuming background is color index 0 and your sprite color indexes 1,2,3, you may change the background color anytime without changing the colors of the sprite :)
In this case there will be two black inks at the bottom of the screen (idx 0 and one idx of the sprite)
use RASM, the best assembler ever made :p

I will survive

Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 711
  • Country: fr
    • urban exploration
  • Liked: 985
  • Likes Given: 620
Re: Rasters in CPC
« Reply #7 on: Today at 09:19 »
I suggest you to test this software https://www.cpc-power.com/index.php?page=detail&num=5389
There is some RSX to change colors in basic, the screen is splitted in 4 zones

; set color changes index 0 four times on the screen

Code: [Select]
|INK,1,0,1 : |INK,2,0,2 : |INK,3,0,11 : |INK,4,0,23Then you may try to move a sprite using index 1,2,3 on the screen :)


use RASM, the best assembler ever made :p

I will survive

Offline andycadley

  • Supporter
  • 6128 Plus
  • *
  • Posts: 858
  • Liked: 410
  • Likes Given: 72
Re: Rasters in CPC
« Reply #8 on: Today at 09:30 »
It's better to think in terms of palette entries rather than actual colours. At any one time, you can always have multiple palette entries reference the same colour.


Since the stripes in the background never share the same scan line, they can all be using the same palette entry (which is traditionally 0, but doesn't have to be). That leaves the three other palette entries free for use on the sprite. Since those colours aren't changed anywhere on the screen, the sprite will appear unaffected by the palette swap.


It only becomes an issue if you change palette entries that are used by your sprite, at which point the colour will depend upon where the sprite is. Sometimes you can design out this issue, the most obvious example being changing the palette entries by a status panel your sprite will never be displayed over but some games can be zoned off in cunning ways too.

Offline sigh

  • 6128 Plus
  • ******
  • Posts: 1.150
  • Liked: 452
  • Likes Given: 41
Re: Rasters in CPC
« Reply #9 on: Today at 15:30 »
Mode 1 has 4 color right?
Assuming background is color index 0 and your sprite color indexes 1,2,3, you may change the background color anytime without changing the colors of the sprite :)
In this case there will be two black inks at the bottom of the screen (idx 0 and one idx of the sprite)
Yes - mode 1 has 4 colours. (320x200). I have another test/exampple:



Since the stripes in the background never share the same scan line, they can all be using the same palette entry (which is traditionally 0, but doesn't have to be). That leaves the three other palette entries free for use on the sprite. Since those colours aren't changed anywhere on the screen, the sprite will appear unaffected by the palette swap.

It only becomes an issue if you change palette entries that are used by your sprite, at which point the colour will depend upon where the sprite is.
With the example shown above, I have divided the screen into 3 sections that each have a different background colour. The sprites have 3 colours and share the same palette and those colours appear in the background too. Please bare in my mind that the picture isn't finished yet as I still have a few more bits to draw:D

Would this pass the test? Or would it be a programming nightmare? I also have this simple verion that is 4 colours all the way through (unfinished):



The reason I'm doing this is that I'm back working on the beat em up again which is quite complicated graphically, so I usually have another CPC related project on the side to take a break with. That originally was the football game, but I have drawn and animated everything for that, apart from the menu and title screen. So I'm creating a simple "VS" fighting game that only uses "1" button to control the character. There are no joystick controls - just 1 button (fire button).

A nice short, easy and gentle project - art and animation wise :D

Offline roudoudou

  • 6128 Plus
  • ******
  • Posts: 711
  • Country: fr
    • urban exploration
  • Liked: 985
  • Likes Given: 620
Re: Rasters in CPC
« Reply #10 on: Today at 16:47 »
waaaah, very nice!
i confirm it would be easy to program the raster in the sky
use RASM, the best assembler ever made :p

I will survive