New game - tube type thingy

Got a programming project in mind? Tell everyone about it!
hexwab
Posts: 26
Joined: Wed Jul 08, 2015 8:27 pm
Contact:

Re: New game - tube type thingy

Postby hexwab » Mon Jan 22, 2018 1:43 am

How about checking to see if the 4 pixels you're about to write are the same as what's already there? Currently you have constant 20 cycles for 4*STA abs,X. Doing

Code: Select all

CMP abs,X ; 4/5
BEQ skip ; 2/3
4*STA abs,X ; 20
.skip

and assuming you're crossing a page boundary half the time works out to 26.5 cycles if different and 7.5 if the same. That's a net win if only 35% of your pixels are the same. Cursory inspection of the video makes me think it's more than that. You'd need to do extra work to force plotting over sprites, of course.

I suspect this would be particularly effective over the Tube, if the parasite is indeed the bottleneck. You'd need a Tube-side copy of the current frame for reference, and hopefully you can arrange it such that you can use zero or bit 7 as a "no need to plot" sentinel:

Code: Select all

LDA $fee1
BMI skip
4*STA abs,X
.skip


Other ideas include a Thrust-style scanlines effect by plotting only alternate lines.

Keep up the good work!

User avatar
1024MAK
Posts: 7191
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: New game - tube type thingy

Postby 1024MAK » Mon Jan 22, 2018 10:07 am

Wow! =D> If this does become a playable game, I'm gonna have to be careful that I don't get motion sickness!

Mark
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk NOW!
BeebWiki‬ - for answers to many questions...

User avatar
SarahWalker
Posts: 1059
Joined: Fri Jan 14, 2005 3:56 pm
Contact:

Re: New game - tube type thingy

Postby SarahWalker » Mon Jan 22, 2018 9:52 pm

hexwab wrote:How about checking to see if the 4 pixels you're about to write are the same as what's already there?

Ooh, good catch! Just implemented this on the single processor version. While it doesn't quite fit into 3 frames with sprites onscreen, it does keep a nice stable 4 frames now. Overplotting the sprites wasn't too difficult - I'm now setting bit 7 in every byte the sprites touch, which will be seen as 'changed' by the tube plotter. It does need to do some cleanup when the top of a sprite isn't aligned with a tube pixel, but that's not too difficult.

Not sure how much use this will be over the Tube - I think you meant to say 'if the _host_ is indeed the bottleneck'? If the parasite is the bottleneck then this will surely just make it worse! I still need to play with it a bit.

hexwab
Posts: 26
Joined: Wed Jul 08, 2015 8:27 pm
Contact:

Re: New game - tube type thingy

Postby hexwab » Mon Jan 22, 2018 11:42 pm

SarahWalker wrote:
hexwab wrote:How about checking to see if the 4 pixels you're about to write are the same as what's already there?
Not sure how much use this will be over the Tube - I think you meant to say 'if the _host_ is indeed the bottleneck'? If the parasite is the bottleneck then this will surely just make it worse! I still need to play with it a bit.

You are correct, I did. (Isn't the official terminology "coprocessor" or "application processor" and "I/O processor"? Anyway, I misread.) I think I was assuming that because the parasite is ~always faster than the host, and it has less to do (it's relieved of plotting duties), that the host would always be the bottleneck.

User avatar
SarahWalker
Posts: 1059
Joined: Fri Jan 14, 2005 3:56 pm
Contact:

Re: New game - tube type thingy

Postby SarahWalker » Tue Jan 23, 2018 9:06 pm

hexwab wrote:
SarahWalker wrote:
hexwab wrote:How about checking to see if the 4 pixels you're about to write are the same as what's already there?
Not sure how much use this will be over the Tube - I think you meant to say 'if the _host_ is indeed the bottleneck'? If the parasite is the bottleneck then this will surely just make it worse! I still need to play with it a bit.

You are correct, I did. (Isn't the official terminology "coprocessor" or "application processor" and "I/O processor"? Anyway, I misread.) I think I was assuming that because the parasite is ~always faster than the host, and it has less to do (it's relieved of plotting duties), that the host would always be the bottleneck.

It depends on the copro - from my testing, at 3 MHz the copro is the bottleneck, at 4 MHz the host is. I've implemented the comparison check on the host side now, and the speedup isn't subtle - it can now hit 25 fps much of the time! Obviously having sprites on screen will slow that down, but a solid 3 frames seems good.

I've had a look at implementing it on the copro side, and it looks complex - not least because I need to account for double buffering! I'll probably come back to it later.

crj
Posts: 830
Joined: Thu May 02, 2013 4:58 pm
Contact:

Re: New game - tube type thingy

Postby crj » Wed Jan 24, 2018 3:06 am

hexwab wrote:(Isn't the official terminology "coprocessor" or "application processor" and "I/O processor"? Anyway, I misread.)
I thought Acorn used "host" and "parasite"?

User avatar
daveejhitchins
Posts: 4018
Joined: Wed Jun 13, 2012 5:23 pm
Location: Newton Aycliffe, County Durham
Contact:

Re: New game - tube type thingy

Postby daveejhitchins » Wed Jan 24, 2018 8:14 am

@SarahWalker . . . . Love the new avatar =D>

Dave H :D
Parts: UM6502CE, GAL22V10D, GAL16V8D, AS6C62256A, TC514400AZ, WD1772, R6522, TMS27C512, AT28C256
Products: ARA II, ABR, ATI, AP6, MGC, AP5 . . .
For a price list, contact me at: Retro Hardware AT dave ej hitchins DOT plus DOT com

User avatar
SarahWalker
Posts: 1059
Joined: Fri Jan 14, 2005 3:56 pm
Contact:

Re: New game - tube type thingy

Postby SarahWalker » Wed Feb 21, 2018 9:15 pm

Haven't posted an update for a bit! I've put the optimisation stuff aside, and started trying to make an actual game out of this. I put together a level editor - after the headache of writing the While Light editor in Win32, I wrote this one in C#, and made as much progress in a couple of hours as I had for WL in a couple of days.
toob_editor.png

Designing 4x4 tiles is pretty rubbish so I've doubled up to 4x8. Which looks slightly better, particularly when running in high res mode.
toob_ingame.png

I've also changed the player physics. Previously there was just a hack where moving left/right simply shifted the tube left/right. Now left/right now actually rotates the player, and the velocity is then applied via sin/cos tables. Braking drops the velocity, friction drops it less. I need to add an acceleration curve, and possibly also some momentum. Lots of trial and error here!

User avatar
Arcadian
Posts: 2922
Joined: Fri Nov 24, 2000 12:16 pm
Contact:

Re: New game - tube type thingy

Postby Arcadian » Thu Feb 22, 2018 7:59 am

Ah cool glad to see another update! Would love to see a new vid (preferably with a screen chock full of those 4x8 designs, which I suspect will look breathtaking!!).
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk

Image
ABug NORTH (Manchester) (19-21 January 2018)
ABug SOUTH (Hampshire) (1-3 June 2018)

User avatar
SarahWalker
Posts: 1059
Joined: Fri Jan 14, 2005 3:56 pm
Contact:

Re: New game - tube type thingy

Postby SarahWalker » Sun Feb 25, 2018 3:58 pm

Oh go on then - https://www.youtube.com/watch?v=3miRyeavh7w&feature=youtu.be.

A couple of other changes I didn't mention - I added a fog effect, as otherwise I found it a little difficult to differentiate between the limited draw distance and the track running out. Also I moved to a fixed game speed, using the basic technique of incrementing a counter on interrupt, then in the main loop plotting when the counter is zero, otherwise run the game logic and decrement the counter.

User avatar
leenew
Posts: 3548
Joined: Wed Jul 04, 2012 3:27 pm
Location: Doncaster, Yorkshire
Contact:

Re: New game - tube type thingy

Postby leenew » Sun Feb 25, 2018 4:08 pm

Very, very clever =D>

Lee.

Mekon
Posts: 14
Joined: Mon Jun 21, 2010 12:33 pm
Contact:

Re: New game - tube type thingy

Postby Mekon » Thu Mar 01, 2018 4:27 pm

Wow! This is looking amazing. I'm starting to regret getting rid of my Master :(

User avatar
danielj
Posts: 5861
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Re: New game - tube type thingy

Postby danielj » Thu Mar 01, 2018 5:28 pm

Holy cow, Sarah!

minwah
Posts: 36
Joined: Tue Jul 21, 2015 12:12 pm
Contact:

Re: New game - tube type thingy

Postby minwah » Fri Mar 02, 2018 11:33 am

Looks brilliant! I'm not familiar with the original Tube game, but it reminds me of Yoomp! on the Atari 8 bits:

http://yoomp.atari.pl/
BBC Master | IFEL Switchable MOS | Sundby PiTubeDirect (Pi 3) | RetroClinic DataCentre | Deltronics Control It

User avatar
Arcadian
Posts: 2922
Joined: Fri Nov 24, 2000 12:16 pm
Contact:

Re: New game - tube type thingy

Postby Arcadian » Fri Mar 02, 2018 10:32 pm

Wow, thanks for posting the new clip Sarah, it's staggeringly impressive! Fog effect seems to work really well also!!
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk

Image
ABug NORTH (Manchester) (19-21 January 2018)
ABug SOUTH (Hampshire) (1-3 June 2018)

tom_seddon
Posts: 110
Joined: Mon Aug 29, 2005 11:42 pm
Contact:

Re: New game - tube type thingy

Postby tom_seddon » Sat Mar 03, 2018 2:17 am

minwah wrote:Looks brilliant! I'm not familiar with the original Tube game, but it reminds me of Yoomp! on the Atari 8 bits:

http://yoomp.atari.pl/


https://www.youtube.com/watch?v=0uzSt4TOtA0 :)

From memory, Tube had a lookup table that mapped each pixel of a flat 320x200 (or whatever) bitmap to a tubeified position on the 320x200 mode 13h VGA screen. Watch the video and you'll be able to see this sort of thing in action: it's just ordinary 2D stuff drawn as if wrapped round a tube.

--Tom

P.S. when I say "just", what I mean is that because of the way the 486 works - assuming my 25 year old memories are valid? - the main bottleneck ends up being graphics memory write speed. Getting this working on the BBC is a different matter! Let alone making it run at a playable speed ;)