"Buck Rogers"-style perspective scrolling

Basic and Machine Language

Moderator: Moderators

Post Reply
4mat/atebit
Vic 20 Newbie
Posts: 10
Joined: Fri Sep 25, 2009 6:40 am

"Buck Rogers"-style perspective scrolling

Post by 4mat/atebit »

Hi,

Here's some quick code to do the perspective raster effect. It's also the basis of a 'trailblazer' if you add some road gfx and alternate the multicolours. This is for PAL machines, though I imagine you only need to change the 'nops' in the display routine to get it working on NTSC.

Code: Select all


sei

loop 

;; Draw raster landscape from table at $1c00
;; Obviously the huge 'nop' delay can be replaced with something useful, it just moves the
;; raster splits off the screen for tidyness.

ldx #$48
ldy #$00
waitrast 
cpx $9004
bne waitrast
lda $1c00,y
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
sta $900f 
iny
inx
cpx #$90
bne waitrast
lda #$00
sta $900f

; Calculate perspective table

lda #$00
sta ploton+$01
lda #$04
sta trailts
trailround 
ldx trailts
lda trailadd,x
sta trailaddcode+$01
lda trailtime,x
sta trailtemp
lda #$18
sta trailtable+$02
lda #$00
sta trailtable+$01
ldx offset
rast0 
txa 
trailaddcode adc #$04
tax
trailtable lda $1800,x 
ploton sta $1c00
inc ploton+$01
dec trailtemp
lda trailtemp
cmp #$00
bne rast0
stx offset
dec trailts
bpl trailround

clc
lda offset2
; Speed to move through landscape (positive numbers go backwards)
sbc #$04 
sta offset2
sta offset
jmp loop

offset .byte $00
offset2 .byte $00
trailts .byte $00
trailtemp .byte $00

; Amount to skip through colour table to create perspective
trailadd .byte $01,$02,$04,$08,$10
; Duration for each stage of perspective.
trailtime .byte $33,$1f,$0f,$07,$03

; Colour table, alternating between red & yellow on 256 byte boundries.

* = $1800

.byte $2a,$2a,$2a,$2a,$2a,$2a,$2a,$2a,$2a,$2a,$2a,$2a,$2a,$2a,$2a,$2a      
.byte $2a,$2a,$2a,$2a,$2a,$2a,$2a,$2a,$2a,$2a,$2a,$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it »

oops, that should be '64 byte boundries' ^^^^^ :)
User avatar
Victragic
Frogger '07
Posts: 605
Joined: Tue Nov 14, 2006 5:56 pm
Location: South Australia

Post by Victragic »

Wow, thanks for the code..

I had been working on trying to do a Vic20 conversion of the C16 Trailblazer game for a while, but could not get the rolling motion right.

I gave up in frustration, because I couldn't work out the formula.. there were either too many steps visible, or too few, but mostly, the motion just plain sucked - too slow, too jerky, or a 'crawling' effect.

I should dig out my original abandoned code, when I have some more time.
3^4 is 81.0000001
User avatar
Victragic
Frogger '07
Posts: 605
Joined: Tue Nov 14, 2006 5:56 pm
Location: South Australia

Post by Victragic »

so I already have the road graphics, and I think they look pretty good, in case anyone is eager to try this out...

(may need some tweaking to match the raster lines)
3^4 is 81.0000001
User avatar
Kweepa
Vic 20 Scientist
Posts: 1315
Joined: Fri Jan 04, 2008 5:11 pm
Location: Austin, Texas
Occupation: Game maker

Post by Kweepa »

I would love to see a demo of this in action.
User avatar
Victragic
Frogger '07
Posts: 605
Joined: Tue Nov 14, 2006 5:56 pm
Location: South Australia

Post by Victragic »

Okay,

firstly excuse the fact it's just all over the shop - this was a 10-minute job.

It's a huge file, in reality it's not - all blank space. Try it it on a VICE PAL Vic + 8K (that's the target for the game)

I just realised when running it - the width of my lines is all wrong... centre line is too wide, lines next to it too narrow.

http://users.adam.com.au/grichards/blazer.prg

SYS8192
3^4 is 81.0000001
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

amazing
High Scores, Links, and Jeff's Basic Games page.
User avatar
Pedro Lambrini
Vic 20 Scientist
Posts: 1132
Joined: Mon Dec 01, 2008 11:36 am

Post by Pedro Lambrini »

Please make this happen! Trailblazer's a great game on other platforms but it would be nice to have a nice port on the wee Vic. :)
"...That of the Eastern tribe being like a multitude of colours as if a rainbow had settled upon its brow..." Daniels 1:3
4mat/atebit
Vic 20 Newbie
Posts: 10
Joined: Fri Sep 25, 2009 6:40 am

Post by 4mat/atebit »

Nice job!
User avatar
orion70
VICtalian
Posts: 4341
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Post by orion70 »

Image
Yes please, please, Trailblazer for the VIC!!!! (infantilization due to overexposure to this forum 8) )
User avatar
Mayhem
High Bidder
Posts: 3027
Joined: Mon May 24, 2004 7:03 am
Website: http://www.mayhem64.co.uk
Location: London

Post by Mayhem »

It's certainly a start in the right direction :D
Lie with passion and be forever damned...
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

Victragic wrote:firstly excuse the fact it's just all over the shop - this was a 10-minute job.
WOW :shock:

I must say that is a very good start point :wink:
Mega-Cart: the cartridge you plug in once and for all.
User avatar
Ivanhoe76
Vic 20 Devotee
Posts: 200
Joined: Fri Sep 28, 2007 11:17 am
Location: Italy

Post by Ivanhoe76 »

Oh my god!!!! That's the smoothest perspective raster effect I've ever seen since Trailblazer for the "big brother" (C64)!!! I cannot believe it's just a "poor" vic that make it work!!!! Excellent work victragic, go on this way!
No one should tolerate death and violence because tolerance will generate habit.
User avatar
Victragic
Frogger '07
Posts: 605
Joined: Tue Nov 14, 2006 5:56 pm
Location: South Australia

Post by Victragic »

Really at this stage it's just an effect thanks to 4mat's code..

I might start a WIP thread with this project as it's going..

this will be based on the original C16 game, one of the finest games I was fortunate to own for my Plus/4..

I reckon they could easily have released a version for Vic +8K.. but no-one was developing for Vic any more by the time this was put out by Gremlin..
3^4 is 81.0000001
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

So a Vic porting of a good C16 game, very nice project :wink:

I'm looking forward for your next WIP thread...
Mega-Cart: the cartridge you plug in once and for all.
Post Reply