Killer Gorilla for VideoNuLA (16 colours)

reminisce about bbc micro & electron games like chuckie egg, repton, elite & exile

Related forum: adventures


RobC
Posts: 1734
Joined: Sat Sep 01, 2007 9:41 pm

Killer Gorilla for VideoNuLA (16 colours)

Postby RobC » Wed Oct 04, 2017 12:57 pm

We always played this on rainy days on the Beebs at school - here it is in full 16 colour glory :)
Attachments
KillerGorilla-16cols.zip
(12.36 KiB) Downloaded 31 times

User avatar
bakoulis
Posts: 229
Joined: Wed Feb 08, 2012 9:45 pm
Location: Athens, Greece

Re: Killer Gorilla for VideoNuLA (16 colours)

Postby bakoulis » Wed Oct 04, 2017 5:33 pm

Keep up the good work, Rob.
=D>
2xElectron, 3xBBC B, BBC Master.
2xAcorn A310, A420/1, 2xA3000, 2xA3010, A3020, A4000, A5000.
2xRISC PC, Acorn Pocket Book, Acorn Pocket Book II.

User avatar
kieranhj
Posts: 489
Joined: Sat Sep 19, 2015 10:11 pm
Location: Farnham, Surrey, UK

Re: Killer Gorilla for VideoNuLA (16 colours)

Postby kieranhj » Wed Oct 04, 2017 6:36 pm

Hey Rob - you're on fire at the moment! I'm loving the shades of brown, what luxury. One thing I noticed on this version, in b-em at least, is that the barrels now EOR quite noticeably with the ladders as they roll past. Doesn't seem to happen with the original, guessing it was using the foreground / background palette setup maybe?

RobC
Posts: 1734
Joined: Sat Sep 01, 2007 9:41 pm

Re: Killer Gorilla for VideoNuLA (16 colours)

Postby RobC » Wed Oct 04, 2017 6:56 pm

kieranhj wrote:Hey Rob - you're on fire at the moment!

To be honest, it's pretty easy with my graphics ripper tool :)
kieranhj wrote:One thing I noticed on this version, in b-em at least, is that the barrels now EOR quite noticeably with the ladders as they roll past. Doesn't seem to happen with the original, guessing it was using the foreground / background palette setup maybe?

Yes - the original uses colour 8 for the ladders and then redefines the flashing colours to hide the XORing. I think the extra colours are worth it though and you can still see some EOR effects in the original.

I use the VideoNuLA's logical-mode palette mapping (?&FE22=&11) to bypass the standard palette at FE21 - it's a useful trick and I'm glad that you implemented it in B-Em! It means I can get around whatever setup the original is using or replicate it if necessary.

User avatar
trixster
Posts: 512
Joined: Wed May 06, 2015 11:45 am
Location: York

Re: Killer Gorilla for VideoNuLA (16 colours)

Postby trixster » Wed Oct 04, 2017 7:20 pm

Wowsers, superb!

Could you do 16 colour Exile?!?
A3020 | A3000 | BBC B + 128K RAM/ROM + 20K Shadow + Pi0 + VideoNuLA
BBC Master Turbo + DC | Atom | A1200 060 | A500 | Jaguar | A420/1
A4000/040 060 | Atari Falcon 060 | Saturn | PS1 | SNES | CPC6128 | C64 | 3DO | MD

RobC
Posts: 1734
Joined: Sat Sep 01, 2007 9:41 pm

Re: Killer Gorilla for VideoNuLA (16 colours)

Postby RobC » Wed Oct 04, 2017 8:44 pm

trixster wrote:Wowsers, superb! Could you do 16 colour Exile?!?

Thanks - as I've said elsewhere, I've wanted to have an upgrade like this for about 10 years!

I assume it would be possible to add more colours to Exile (and we have a good disassembly of the code) but, from the little I know about it, I believe that it does lots of clever things with its sprites (e.g. using a single sprite to represent multiple parts of different creatures). I also don't know if it uses the flashing colours to signify things like background objects. Perhaps someone who has looked at the code can comment?

Some games already use all 16 logical colours even if they aren't all obviously visible on screen. E.g. I believe Firetrack uses an extension of the EOR technique mentioned above by redefining all 16 colours to give 3 foreground colours (+ mask) and 4 background colours but no colour clash/artefacts.

User avatar
Rich Talbot-Watkins
Posts: 1090
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca

Re: Killer Gorilla for VideoNuLA (16 colours)

Postby Rich Talbot-Watkins » Thu Oct 05, 2017 7:02 am

Yeah Exile's a bit more complicated. For a start, it already uses all 16 colours: 0-7 are used for moving objects, and 8-15 for static scenery. The sprite routine uses the top bit of the colour to indicate whether a pixel is in the foreground (i.e. appears in front of objects).

The graphics themselves are stored in one big block, line by line, 2bpp. The sprites then get a logical colour assigned to sprite colours 1-3 when plotted (there's a table which contains the data for all sprites: their colours, the coordinates within the sprite definition, and the size).

So you'd already be starting with the limitation of not really being able to change the sprite definitions themselves, only the palette. Then you'd also be limited to choosing certain unique colours for the background scenery and different colours for the foreground. In a way, it makes the hack easier, as all you can really do is change the palette - I don't really see how code hacks can help with Exile.

RobC
Posts: 1734
Joined: Sat Sep 01, 2007 9:41 pm

Re: Killer Gorilla for VideoNuLA (16 colours)

Postby RobC » Thu Oct 05, 2017 8:23 am

Thanks Rich - I had read about this at some point in the past but had forgotten the details.

Sounds like playing around with the colours in the VideoNuLA palette utility is the best way forward. Something as simple as a darker set of colours for the background might work well.

sbadger
Posts: 203
Joined: Mon Mar 25, 2013 1:12 pm
Location: Farnham, Surrey

Re: Killer Gorilla for VideoNuLA (16 colours)

Postby sbadger » Thu Oct 05, 2017 9:09 am

I've been thinking about Exile also and had read Rich's writeup on how it does foreground and background in the 'best game' thread.
I think it could work quite well to be honest. It means the current red for spaceship and rock could become something like grey for ship and brown for rock
A3020 | BBC B x2 | Electrn | Master | RPi x3
A600 | C64 "breadbox"| C64 C | XB360 | GB | GBC | GBA | GBASP | DS | 3DS XL & new | MD | MS
Atari 7600 | PS1-2-3-4 | PSP | Vita | SNES | GC | N64 | Wii & U | Switch | Jamma Cab | Sony PVMx2

User avatar
Rich Talbot-Watkins
Posts: 1090
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca

Re: Killer Gorilla for VideoNuLA (16 colours)

Postby Rich Talbot-Watkins » Thu Oct 05, 2017 9:40 am

I personally wouldn't go for earthy colours so that it looked like the C64 version. I'd prefer to diversify the range of hues, and maybe slightly subdue the super-saturated colours that the Beeb has by default, but still make it a colourful, slightly psychedelic world (more like a CPC game).

But that's the beauty of the Video NuLA - we can customise these things to our own tastes :)

User avatar
kieranhj
Posts: 489
Joined: Sat Sep 19, 2015 10:11 pm
Location: Farnham, Surrey, UK

Re: Killer Gorilla for VideoNuLA (16 colours)

Postby kieranhj » Thu Oct 05, 2017 10:15 am

sbadger wrote:I've been thinking about Exile also and had read Rich's writeup on how it does foreground and background in the 'best game' thread.
I think it could work quite well to be honest. It means the current red for spaceship and rock could become something like grey for ship and brown for rock

Maybe, although you might find that the spaceship and rock are both classed the same. I've been wading through the Exile sprite routine recently for PoP, and without wanting to repeat what Rich has already said, the palette routine works approximately thusly:

Every sprite is stored as 2bpp with a unique palette of 3 colours (0 is always black.) A palette is defined as an 8 bit number XXXXYYYY with XXXX being logical colour 3 and YYYY being a 4-bit lookup into a table of MODE 2 pixel pairs for colours 1 & 2:

Code: Select all

; Each sprite is 2bpp. Each sprite pixel is an index into this
; per-sprite palette:
;
; 0 = background
; 1 = pair right
; 2 = pair left
; 3 = primary
;
; The background is fixed - it's always colour 0.
;
; The primary colour is chosen directly - it's the top four bits of
; the sprite's palette.
;
; The pair colours come from the `palette_value_to_pixel_lookup'
; table, indexed by the bottom four bits of the sprite's palette. Each
; entry is a Mode 2 pixel value; its left pixel is the colour of index
; 2, and its right pixel is the colour of index 1.

.palette_value_to_pixel_lookup
equb $CA                        ; yellow bg, black bg
equb $C9                        ; green bg, red bg
equb $E3                        ; magenta bg, red bg
equb $E9                        ; cyan bg, red bg
equb $EB                        ; white bg, red bg
equb $CE                        ; yellow bg, green bg
equb $F8                        ; cyan bg, blue bg
equb $E6                        ; magenta bg, green bg
equb $CC                        ; green bg, green bg
equb $EE                        ; white bg, green bg
equb $30                        ; blue fg, blue fg
equb $DE                        ; yellow bg, cyan bg
equb $EF                        ; white bg, yellow bg
equb $CB                        ; yellow bg, red bg
equb $FB                        ; white bg, magenta bg
equb $FE                        ; white bg, cyan bg

The ULA palette itself is setup in the usual BBC colour order without flashing so 0-7 is black-white and 8-15 is the same as 0-7. The top bit in the palette is used as a flag to place pixels on top of everything else (or rather avoid such pixels being written over.) Everything is plotted EOR but the foreground flag will avoid writing pixels where possible. It doesn't necessarily help distinguish between player sprites and background sprites, for instance, although I've not looked at the palette used for each object in detail.

The best place to see this in action is if you walk behind a solid pillar or the horizontal hatches in the spaceship - the player is nicely clipped as the sprite is not drawn over the existing foreground pixels. However if you walk behind the leg of the spaceship then you can clearly see the EOR'd pixels going funny colours. Exile doesn't actually do any sprite masking, which I need for PoP, because it relies on the background always being black (apart from water which is switching the ULA palette on IRQ.)

EDIT: I should add this doesn't mean that a NULA version won't work, just that it might take a bit of experimentation to get right!

User avatar
Rich Talbot-Watkins
Posts: 1090
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca

Re: Killer Gorilla for VideoNuLA (16 colours)

Postby Rich Talbot-Watkins » Thu Oct 05, 2017 10:44 am

kieranhj wrote:Everything is plotted EOR but the foreground flag will avoid writing pixels where possible. It doesn't necessarily help distinguish between player sprites and background sprites, for instance, although I've not looked at the palette used for each object in detail.

As far as I can see, moving objects have to be in colours 0-7 because otherwise the sprite routine would only EOR plot them where there is already background scenery, which would look ridiculous!

Code: Select all

&105c: DEX                                   # actually either DEX or INX from &0fbb
&105d: LDA &0100,X                           # read data from stack
&1060: DEX                                   # actually either DEX or INX from &0fbe
&1061: ORA &0100,X
&1064: EOR (&8f),Y ; screen_address          # read the current screen data
&1066: BMI &106a                             # actually either "EOR, BMI &106a" or "BMI &1068, EOR" from &10f0
&1068: STA (&8f),Y ; screen_address          # plot the sprite to screen depending on plotting mode

Elsewhere there's a routine which swaps the EOR/BMI when it's printing background scenery strips, so that they are plotted unconditionally. (As an extra example of how clever the Exile code is, it has the effect of skipping the EOR because of the new branch target, so that it just performs an overwrite!)

However if you walk behind the leg of the spaceship then you can clearly see the EOR'd pixels going funny colours. Exile doesn't actually do any sprite masking, which I need for PoP, because it relies on the background always being black (apart from water which is switching the ULA palette on IRQ.)

This is also due to a shortcut Exile takes for speed. Ideally, it would apply a mask based on which of the two pixels had their top bits set, and plot only the pixels that don't already have their top bit set in screen memory. But, instead it just looks at the top bit (the BMI in the snippet above, because it's quick to do so), and it's an all-or-nothing approach: if the leftmost pixel in a byte is colour 8-15, nothing gets plotted for that byte; otherwise the whole sprite byte is EORed over. This means that you'll get funny colours at the left edge of scenery if that edge occupies the rightmost pixel of a byte. Luckily it's barely noticeable (in fact, I had to look for it specially, the first time I read through the disassembly!).

User avatar
kieranhj
Posts: 489
Joined: Sat Sep 19, 2015 10:11 pm
Location: Farnham, Surrey, UK

Re: Killer Gorilla for VideoNuLA (16 colours)

Postby kieranhj » Thu Oct 05, 2017 11:22 am

Rich Talbot-Watkins wrote:As far as I can see, moving objects have to be in colours 0-7 because otherwise the sprite routine would only EOR plot them where there is already background scenery, which would look ridiculous!

Yes, you're right. Exile uses a mask to remove the top two bits of the pixel pairs when setting the palette for a moving object:

Code: Select all

.plot_object
{
LDA #%00111111                  ; objects are plotted and &3f
STA sprite_and
JSR plot_sprite
LDX current_object
LSR object_stack_flags,X
LDA skip_sprite_calculation_flags
AND #$05
CMP #$01
ROL object_stack_flags,X
LDA #%11111111
STA sprite_and                ; background is plotted and &ff
RTS
}

Later on when turning the palette entry into pixel data:

Code: Select all

    LDA palette_value_to_pixel_lookup,Y ; get pair
    AND sprite_and              ; 00111111 or 11111111

So it should be "easy" to redefine the lower 7 colours for moving objects and upper 7 colours for background sprites. Take it away someone! :)

User avatar
paulv
Posts: 3547
Joined: Tue Jan 25, 2011 6:37 pm
Location: Leicestershire
Contact:

Re: Killer Gorilla for VideoNuLA (16 colours)

Postby paulv » Thu Oct 05, 2017 10:12 pm

kieranhj wrote:Hey Rob - you're on fire at the moment! I'm loving the shades of brown, what luxury.


This. It's so strikingly amazing that a Beeb is doing brown. =D> =D> I'm giddy with the thought of the possibilities.

Paul


Return to “software: classic games”

Who is online

Users browsing this forum: No registered users and 3 guests