Starting a port of Stunt Car Racer...

Got a programming project in mind? Tell everyone about it!
User avatar
kieranhj
Posts: 807
Joined: Sat Sep 19, 2015 10:11 pm
Location: Farnham, Surrey, UK
Contact:

Starting a port of Stunt Car Racer...

Post by kieranhj » Sun Dec 02, 2018 12:34 am

trixster wrote:
Thu Jun 14, 2018 10:08 pm
If you port Stunt Car Racer to the Beeb I will write you into my Will.
It's a bit early for trixster to start drawing up new paperwork (but if you're at it, put me down for your Atari Falcon CT60e/060 :D) but I've been hacking away at the original C64 disassembly for Stunt Car Racer for the last month and finally have something very early but promising to share with you all.

The first track of the game 'Little Ramp' is playable on a BBC Master in MODE 4 (SWRAM banks 4 & 5 must be available.) Try the ssd attached or check it out on jsbeeb: https://bitshifters.github.io/jsbeeb/?d ... del=Master

Keep hitting Return to step through the menu screens (you can't navigate them.) The in-game controls are S/D/Return/:/Space for left/right/boost/brake/reverse. The game is glitchy as heck (as you can see from the screenshots below) but is playable and surprisingly fast compared to the original C64 version. Oh, it'll almost certainly crash when you finish the track, either by completing three laps or damaging the car to destruction by crashing too much.

First step was to get the disassembly assembling to the C64's memory map under BeebAsm. Unfortunately pretty much every single byte of memory is used from $0000-$FFFF so there was quite a bit of work to rearrange everything. Firstly all of the data had to be moved to addresses that are always accessible, so below screen memory or in HAZEL. Secondly, most of the code had to be split into two SWRAM banks with a POP-style 'DLL' jump table interface added (by hand) so that function calls are intercepted and page in the necessary RAM bank and page the calling bank back in afterwards.

Of course I don't have the actual source, just the C64 disassembly (supplied thanks to Fandal, who ported the game to the Atari XE) so there were lots of memory addresses embedded either in the data blocks or as immediate values in the code itself. These were quite painful to track down and figure out so massive thanks to Tom Seddon who supplied me with his previous attempts to reverse engineer / document various SCR sources from a few years ago. These were immensely helpful and Tom continues to help me understand how the code works.

On C64 the game runs at a 160x200x4 resolution, so very close to MODE 5. Much to my delight, the C64 pixel bit pattern is more straight forward so the existing line drawing routines mapped very nicely to MODE 4 without any changes!

Obviously there is still a lot of work to do, not least tidy up all the glitchy crap, remove any writes to C64 VIC registers etc., get the front end working properly and think about sound. The biggest decision point is going to be around colour and attempting to recreate the pseudo 'solid fill' look of the original game. On C64 this is achieved by poking the VIC Color RAM, which is character mapped and therefore fairly cheap to update (you can see the vertical stripes around the horizon.) For Beeb this would have to be filled directly in screen memory, so 8x more writes and undoubtedly additional complexity. Alternatively it could be left in MODE 4 and do something similar to the ZX Spectrum version for hatching the ground vs sky. Any thoughts here folks?

Lastly, the way the game is structured gives a tantalising possibility of creating a Tube Enhanced version down the line that might run on a Model B at considerable speed, ala Elite. Because of the amount of sprite data, I'd imagine at least one bank of SWRAM would still be required but seems like most people would have such a set up. This is definitely a stretch goal for this project, and not something I'm going to be looking at any time soon, but certainly interesting. For now it'll be Master only due to the amount of available RAM needed at all times (56K.)

As ever, let me know what you think!
scr-beeb-10.png
Menu screen
scr-beeb-11.png
Track preview
scr-beeb-12.png
Start of the race
scr-beeb-13.png
Approaching a corner
Attachments
scr-beeb-wip-1.ssd
Very early WIP
(50.5 KiB) Downloaded 27 times
Last edited by kieranhj on Mon Jan 14, 2019 10:50 am, edited 2 times in total.
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/

User avatar
ctr
Posts: 226
Joined: Wed Jul 16, 2014 2:53 pm
Contact:

Re: Starting a port of Stunt Car Racer...

Post by ctr » Sun Dec 02, 2018 1:22 am

:shock: When I saw that comment back in June I laughed and I thought no chance. But here it is! It plays really well with a good frame rate. Obviously there's loads more to do but it looks like you've broken the back of it. Congratulations!

User avatar
tricky
Posts: 3600
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Starting a port of Stunt Car Racer...

Post by tricky » Sun Dec 02, 2018 8:33 am

Looking great, but I get IO Error when trying the jsbeeb link.
It is very playable, I never managed a lap before.
Maybe save colour for the tube version, unless it can be made EOR fill compatible.
Last edited by tricky on Sun Dec 02, 2018 8:39 am, edited 1 time in total.

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

Re: Starting a port of Stunt Car Racer...

Post by trixster » Sun Dec 02, 2018 9:34 am

FLABBERGASTED
A3020 | A3000 | A420/1 | BBC B | Master Turbo | ZX48K | NeoGeo
Atom | Amiga A4000 | A3000 | A1200 | A500 | PC Engine | Enterprise
Falcon | Saturn | PS1 | SNES | CPC6128 | C64 | 3DO | MD | Jaguar | X68000 | CD32

User avatar
marcusjambler
Posts: 636
Joined: Mon May 22, 2017 11:20 am
Location: Bradford
Contact:

Re: Starting a port of Stunt Car Racer...

Post by marcusjambler » Sun Dec 02, 2018 10:03 am

:shock: This is brilliant !! :lol: =D> =D>

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

Re: Starting a port of Stunt Car Racer...

Post by trixster » Sun Dec 02, 2018 11:05 am

I would say this is at least as fast and smooth as the amiga version. What an incredible achievement :o
A3020 | A3000 | A420/1 | BBC B | Master Turbo | ZX48K | NeoGeo
Atom | Amiga A4000 | A3000 | A1200 | A500 | PC Engine | Enterprise
Falcon | Saturn | PS1 | SNES | CPC6128 | C64 | 3DO | MD | Jaguar | X68000 | CD32

User avatar
jms2
Posts: 2251
Joined: Mon Jan 08, 2007 6:38 am
Location: Derby, UK
Contact:

Re: Starting a port of Stunt Car Racer...

Post by jms2 » Sun Dec 02, 2018 12:21 pm

This is really, really impressive - well done! :D

I agree with Trixster, from my recollection of the Amiga version, I think this is at least as good. I can't believe how playable it is even in its current state.

Regarding colours, I'd say Mode 4 with a different palette top & bottom would be great. Or maybe a mode change to Mode 5 at the top and bottom to give an Elite-style colourful control panel would be even better.

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

Re: Starting a port of Stunt Car Racer...

Post by trixster » Sun Dec 02, 2018 12:26 pm

A3020 | A3000 | A420/1 | BBC B | Master Turbo | ZX48K | NeoGeo
Atom | Amiga A4000 | A3000 | A1200 | A500 | PC Engine | Enterprise
Falcon | Saturn | PS1 | SNES | CPC6128 | C64 | 3DO | MD | Jaguar | X68000 | CD32

steve3000
Posts: 2020
Joined: Sun Nov 25, 2012 12:43 am
Contact:

Re: Starting a port of Stunt Car Racer...

Post by steve3000 » Sun Dec 02, 2018 1:02 pm

Wow! That's wonderful to see on the beeb! =D>

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

Re: Starting a port of Stunt Car Racer...

Post by kieranhj » Sun Dec 02, 2018 6:31 pm

Thanks all! It's not vsync'd at the moment and probably too fast. I guess that's what you get when moving from 1.023MHz to a whopping 2MHz. :)

Obviously any kind of fill will slow it down. There is also a known C64 hack that draws more of the track in front of the player (just increases the number of iterations of the track section drawing loop.) I haven't tried it yet but seems like something that might be possible to just turn on all the time for Beeb.

I'm away for work at the moment but will start pondering next steps and the various options for colour / fill soon.
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/

mysteriouswiggler
Posts: 24
Joined: Tue Nov 27, 2018 8:59 am
Contact:

Re: Starting a port of Stunt Car Racer...

Post by mysteriouswiggler » Sun Dec 02, 2018 9:54 pm

Wow, just getting to this stage seems to have been a lot of graft. While its early days its great to see. Looking forward to seeing the finished game. I get the feeling this is going to have a lot of interesting twists and turns in getting to that state :lol:

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

Re: Starting a port of Stunt Car Racer...

Post by Rich Talbot-Watkins » Mon Dec 03, 2018 11:44 am

What a stunning effort Kieran! Amazing to see that running on a Beeb that smoothly! I'd definitely go with a bigger draw distance than try to get filled areas working, as I don't really think it adds that much, and I think it'd probably look better in MODE 4 than MODE 5. The hatched sky approach of the Speccy version is great though (if it can be done quickly enough), although the problem there is you don't have the source code for that!

Top work! =D>

User avatar
vanpeebles
Posts: 580
Joined: Wed Nov 28, 2012 10:01 am
Location: UK
Contact:

Re: Starting a port of Stunt Car Racer...

Post by vanpeebles » Mon Dec 03, 2018 1:50 pm

Wow looks great, I love this game!

User avatar
oss003
Posts: 3054
Joined: Tue Jul 14, 2009 11:57 am
Location: Netherlands
Contact:

Re: Starting a port of Stunt Car Racer...

Post by oss003 » Mon Dec 03, 2018 1:55 pm

Nice job Kieran ..... =D>
Looks like a good candidate for a second processor version.

Greetings
Kees

User avatar
Dave Footitt
Posts: 800
Joined: Thu Jun 22, 2006 9:31 am
Location: Abandoned Uranium Workings
Contact:

Re: Starting a port of Stunt Car Racer...

Post by Dave Footitt » Mon Dec 03, 2018 7:56 pm

Haha fantastic job so far! Amazed how quick it goes!

Great work Kieran =D>

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

Re: Starting a port of Stunt Car Racer...

Post by kieranhj » Sat Jan 12, 2019 8:04 pm

Development has been continuing in the background (well, on the train commute as per usual) and I'm quite happy with where things currently are, so I made a video of The Little Ramp as it looks now:

https://www.youtube.com/watch?v=N_rj2TJDz8c
scr-beeb-15.png
SCR WIP - bit less glitchy!
There are still quite a few bugs but all of the tracks are playable in practice mode at least. Obviously there still some significant things missing like sprites, sound and, err, colour! If anyone's at ABUG next weekend then I'll be happy for you to come and have a play.

One question that's perhaps worth asking - there is an outside chance that I might be able to getting working on a Model B but it would require 3x 16K banks of SWRAM available - is that a configuration that many people would be interested in?

The game doesn't use SHADOW RAM (for now at least, it may change when it comes to colour) but there is an awful lot of data that is required at all times so I'm currently maxed out using HAZEL ($C000-$DFFF). It may be possible to localise the code accessing that data into another SWRAM bank but could also be a lot of work, so thought I'd gauge interest.
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/

User avatar
oss003
Posts: 3054
Joined: Tue Jul 14, 2009 11:57 am
Location: Netherlands
Contact:

Re: Starting a port of Stunt Car Racer...

Post by oss003 » Sat Jan 12, 2019 8:46 pm

Great job Kieran ..... looks nice and the speed is also ok. Didn't think it was possible on the Beeb .... =D>

Greetings
KC
Last edited by oss003 on Sat Jan 12, 2019 8:47 pm, edited 2 times in total.

User avatar
tricky
Posts: 3600
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Starting a port of Stunt Car Racer...

Post by tricky » Sat Jan 12, 2019 9:33 pm

Excellent work as ever =D>
oss003 wrote:
Sat Jan 12, 2019 8:46 pm
Great job Kieran ..... looks nice and the speed is also ok. Didn't think it was possible on the Beeb .... =D>

Greetings
KC
Which bit didn't you think was possible?

Looks like nearly double the frame rate of the C64 =D>

Personally, you know me, I would love a "B" port, but all my beebs have 32K SWRAM except a couple that only have 16K so I think I will be playing it on the Master or Compact.
Last edited by tricky on Sat Jan 12, 2019 9:34 pm, edited 1 time in total.

User avatar
sydney
Posts: 2430
Joined: Wed May 18, 2005 9:09 am
Location: Newcastle upon Tyne
Contact:

Re: Starting a port of Stunt Car Racer...

Post by sydney » Sat Jan 12, 2019 9:48 pm

kieranhj wrote:
Sat Jan 12, 2019 8:04 pm
One question that's perhaps worth asking - there is an outside chance that I might be able to getting working on a Model B but it would require 3x 16K banks of SWRAM available - is that a configuration that many people would be interested in?
I reckon 16k will be common, 32k about half that and 48k very rare. I did a poll a few years back but only asked if people had sideways ram and not how much.

EDIT: Wow! More than 4 years ago!
viewtopic.php?f=3&t=8692&hilit=Sideways
Last edited by sydney on Sat Jan 12, 2019 9:51 pm, edited 1 time in total.

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

Re: Starting a port of Stunt Car Racer...

Post by trixster » Sun Jan 13, 2019 7:23 am

It’s coming along brilliantly!

I’d love a version for the B. I’ve got one of the IFEl ram/Rom boards which I think gives 4 banks of swr. My beeb’s also got shadow ram in case you do decide to utilise that too :)
A3020 | A3000 | A420/1 | BBC B | Master Turbo | ZX48K | NeoGeo
Atom | Amiga A4000 | A3000 | A1200 | A500 | PC Engine | Enterprise
Falcon | Saturn | PS1 | SNES | CPC6128 | C64 | 3DO | MD | Jaguar | X68000 | CD32

User avatar
Lardo Boffin
Posts: 1612
Joined: Thu Aug 06, 2015 6:47 am
Contact:

Re: Starting a port of Stunt Car Racer...

Post by Lardo Boffin » Sun Jan 13, 2019 8:27 am

Wow! I would splash out in a couple of boobips sideways RAMs for this! Up until now I have had nothing to justify the money. Although they are in the list...
Atom, issue 5
BBC model B 32k issue 4, 16k sideways RAM, Watford 12 ROM board, Acorn 6502 coproc
BBC model B 32k issue 7, turboMMC, Opus Challenger 3 512k, Pi 3 coproc
USA Model B
BBC Master, Datacentre + HDD, pi co-proc, econet, NULA

User avatar
marcusjambler
Posts: 636
Joined: Mon May 22, 2017 11:20 am
Location: Bradford
Contact:

Re: Starting a port of Stunt Car Racer...

Post by marcusjambler » Sun Jan 13, 2019 10:41 am

Fantastic game and port this... =D>

I'll be running it on a master.... my gaming beeb has 32k SWRAM

Marcus


User avatar
Dethmunk
Posts: 214
Joined: Fri Jul 01, 2016 12:29 pm
Location: Guildford
Contact:

Re: Starting a port of Stunt Car Racer...

Post by Dethmunk » Sat Feb 16, 2019 7:05 pm

:D From what I've been shown so far its looking great Kieran. You're in for a treat again guys.
FYI Acorners I'm in doing the graphics again...... :wink:

Image
Last edited by Dethmunk on Sat Feb 16, 2019 7:06 pm, edited 1 time in total.
Image

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

Re: Starting a port of Stunt Car Racer...

Post by paulv » Sat Feb 16, 2019 7:08 pm

:shock: =D> =D>

So excited about this. I played it to death on my Amiga 500 BITD.

Paul

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

Re: Starting a port of Stunt Car Racer...

Post by kieranhj » Sun Feb 17, 2019 4:53 pm

Some folks got a sneak peak at ABUG South in January but we’re aiming to get finished and released by end of February if possible. RL notwithstanding of course. Stay tuned... :D
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/

User avatar
marcusjambler
Posts: 636
Joined: Mon May 22, 2017 11:20 am
Location: Bradford
Contact:

Re: Starting a port of Stunt Car Racer...

Post by marcusjambler » Tue Feb 26, 2019 7:05 pm

This is like waiting for second Christmas :lol:

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

Re: Starting a port of Stunt Car Racer...

Post by kieranhj » Thu Mar 07, 2019 7:24 pm

It's been a long journey (although not as long as POP!) but we finally released v1.0: viewtopic.php?f=57&t=16655

Feel free to continue to ask technical questions in this thread!

Unfortunately the game has ended up being BBC Master only due to the use of HAZEL to make 7K of extra data available during gameplay to code running in SWRAM. We're also utilising all 4x banks of SWRAM for code, data, graphics and music. Finally we decided to utilise SHADOW RAM as well to enable the frontend menu to move from MODE 4/5 to MODE 1.

If only the Master had been a commercially viable games machine BITD...
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/

jregel
Posts: 131
Joined: Fri Dec 20, 2013 6:39 pm
Location: Gloucestershire
Contact:

Re: Starting a port of Stunt Car Racer...

Post by jregel » Thu Mar 07, 2019 7:40 pm

I've already commented on the YouTube page, but it's worth repeating and adding to. Along with the Prince of Persia port, and other titles like Planet Nubium, it feels like we're finally starting to see what was the Master was capable of.
BBC Master Turbo
Retroclinic External Datacentre
VideoNuLA
PiTubeDirect with Pi Zero

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

Re: Starting a port of Stunt Car Racer...

Post by trixster » Thu Mar 07, 2019 10:13 pm

So, how about network play over serial, like the Amiga version!?!!?
A3020 | A3000 | A420/1 | BBC B | Master Turbo | ZX48K | NeoGeo
Atom | Amiga A4000 | A3000 | A1200 | A500 | PC Engine | Enterprise
Falcon | Saturn | PS1 | SNES | CPC6128 | C64 | 3DO | MD | Jaguar | X68000 | CD32

Post Reply