Race games - how is it done?

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
Bizzley
Microbot
Posts: 124
Joined: Thu Nov 16, 2017 10:47 am

Re: Race games - how is it done?

Post by Bizzley »

spectron wrote: Thu Jul 05, 2018 2:57 pm This is sort of how it was done for Gameboy road rash.
I coded a similar thing for a Gameboy version of Formula 1 for Psygnosis that never progressed past the proof of concept stage. They wanted to see a working 3D road so I used the HBLANK method to slide individual lines into curves etc. I've got a compiled version on a development cart somewhere as well as the source code and it is a really quick and easy way to get an into-the-screen road up and running. To save on in-game processing time I pre-calculated a selection of straights, curves, chicanes etc. at varying degress and built a complete track out of those sections held in tables.

I told Psygnosis that if they wanted to see more details like dips, hills, trackside objects, other cars etc. then they'd have to pay actual money but it never got any further - for "political" reasons it didn't get a green light - but it was a fun thing to code up I remember.
"He made eloquent speeches to an audience consisting of a few depressed daffodil roots, and sometimes the cat from next door."
spectron
Drutt
Posts: 25
Joined: Thu Mar 29, 2018 3:27 pm

Re: Race games - how is it done?

Post by spectron »

Bizzley wrote: Thu Jul 05, 2018 5:29 pm
I told Psygnosis that if they wanted to see more details like dips, hills, trackside objects, other cars etc. then they'd have to pay actual money but it never got any further - for "political" reasons it didn't get a green light - but it was a fun thing to code up I remember.
It was indeed fun and hills were just a case of taking that extra step of altering VBLANK as well as HBLANK to give the impression of going up and down. It's the sort of thing most of us would have stumbled upon back then given the freedom of experimenting; luckily we were given that time to mess.
Ralf
Rick Dangerous
Posts: 2279
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: Race games - how is it done?

Post by Ralf »

[mention]R-Tape[/mention] , did you made any progress with racing game engines? ;)
User avatar
Joefish
Rick Dangerous
Posts: 2041
Joined: Tue Nov 14, 2017 10:26 am

Re: Race games - how is it done?

Post by Joefish »

If you've ever seen Electraglide on an 8-bit Atari it looks absolutely stunning, with a colourful fast-running road leading to the horizon.
But really it's just a flat picture of a triangular road. The road moving is done by colour-swapping on alternate lines, and the curves are done by scroll-shifting individual pixel rows left and right. And that' all it can do. When objects appear you can see they're crude geometric shapes made of hugely upscaled sprite pixels; it's simply impossible to make it do a racing game with rival detailed vehicle graphics on the track with anything like that slick frame rate.

To do the same on the Spectrum means the hard graft and pre-shifted data to re-draw all the lines of the screen scrolled to different positions horizontally, and re-distributed vertically to make hills, but then you can draw it however you like and add whatever sprites you want. It would be neat to combine a racing game with a multicolour engine to do the roadside strips in colour, but it would take some very clever coding to use the processing time in the wait-periods productively.
User avatar
R-Tape
Site Admin
Posts: 6353
Joined: Thu Nov 09, 2017 11:46 am

Re: Race games - how is it done?

Post by R-Tape »

Ralf wrote: Tue Aug 07, 2018 11:05 am @R-Tape , did you made any progress with racing game engines? ;)
Not yet, I find this quite hard to understand but I just need to set a some time aside with a cold flannel on my head to think it through.

However, current priorities are a laptop free holiday and then finish Bean Brothers!
User avatar
Vampyre
Manic Miner
Posts: 833
Joined: Wed Nov 15, 2017 2:51 pm
Contact:

Re: Race games - how is it done?

Post by Vampyre »

Joefish wrote: Tue Aug 07, 2018 12:00 pm If you've ever seen Electraglide on an 8-bit Atari it looks absolutely stunning, with a colourful fast-running road leading to the horizon.
But really it's just a flat picture of a triangular road. The road moving is done by colour-swapping on alternate lines, and the curves are done by scroll-shifting individual pixel rows left and right. And that' all it can do. When objects appear you can see they're crude geometric shapes made of hugely upscaled sprite pixels; it's simply impossible to make it do a racing game with rival detailed vehicle graphics on the track with anything like that slick frame rate.

To do the same on the Spectrum means the hard graft and pre-shifted data to re-draw all the lines of the screen scrolled to different positions horizontally, and re-distributed vertically to make hills, but then you can draw it however you like and add whatever sprites you want. It would be neat to combine a racing game with a multicolour engine to do the roadside strips in colour, but it would take some very clever coding to use the processing time in the wait-periods productively.
I'd never heard of Electraglide before but just seen a vid on YT. That is superbly smooth for an 8-bit game.
ZX Spectrum Reviews REST API: http://zxspectrumreviews.co.uk/
Ralf
Rick Dangerous
Posts: 2279
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: Race games - how is it done?

Post by Ralf »

I've just had a look on Electraglide too.

Yes, very smooth movement but ultimately boring. No other cars, no hills, very sparse scenery.

Now, Chase H.Q. on Spectrum on the other hand... ;)
Dr beep
Manic Miner
Posts: 375
Joined: Mon Oct 01, 2018 8:53 pm

Re: Race games - how is it done?

Post by Dr beep »

Here is a pseudo 3D racing game coded for the ZX81 in just 1K and a hires way.

https://m.youtube.com/watch?v=uSPMIidgA18

The game is based on the same track coded for the ZX Spectrum in Grandpr1x, also just 1K of code, but on the ZX Spectrum you have more memory available.
Post Reply