what should i write next?

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

Related forum: adventures


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

Re: what should i write next?

Postby Dethmunk » Tue Jul 05, 2016 1:06 pm

:D :lol: WHAT HE SAID /\/\/\/\/\/\
Image

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

Re: what should i write next?

Postby tricky » Mon Feb 27, 2017 6:03 pm

OK, so I have got sidetracked on my sidetrack (nearing stack limit)!
I wrote a BASIC decoder for the vector unit in Asteroids and there isn't much to the decoder.
I did a search around and there is actually a very playable version for the Plus4, which seems to be doing some level of emulation.
So, does anyone have a fast line drawing routine for the beeb before I go off to write another?
The proof of concept is in mode 0, but mode 4 is probably more practical.
Attachments
DebugScreen.png
game.zip
(3.43 KiB) Downloaded 15 times

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

Re: what should i write next?

Postby kieranhj » Tue Feb 28, 2017 10:18 am

tricky wrote:So, does anyone have a fast line drawing routine for the beeb before I go off to write another?
The proof of concept is in mode 0, but mode 4 is probably more practical.

Actually we do, although not technically ours. Simon.M spent some time making the crazy fast 3D stuff we discovered compatible with BeebAsm for easy re-use. https://github.com/simondotm/bbc-micro-3d/. I believe there is a fully unrolled MODE 4 line draw in there somewhere.

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

Re: what should i write next?

Postby oss003 » Tue Feb 28, 2017 11:03 am

This is the line draw routine from Elite for the Electron.
I wasn't 100% sure how it worked so the comment is my best guess.

PS Isn't this a nice project for a coprocessor?

Greetings
Kees
Attachments
Linedraw Elite.txt
(10.04 KiB) Downloaded 48 times

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

Re: what should i write next?

Postby sbadger » Tue Feb 28, 2017 11:57 am

The original NES has a 6502 (albeit with sprite hardware). Anything on that platform float your boat?
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
tricky
Posts: 1811
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: what should i write next?

Postby tricky » Tue Feb 28, 2017 12:50 pm

I did look at the NES, but I either didn't enjoy them very much, or they need horizontal scrolling at less than one byte. Half byte horizontal scrolling takes a lot of CPU cycles and doesn't work on modern TVs (see my really-x demo) or takes a lot of CPU cycles and too much memory in mode 1 (see my smb demo) or is just to slow (see jelton).
With the new enhanced ula and it's horizontal scrolling in hardware and extended palette, there are many new possibilities.

User avatar
sirmorris
Posts: 701
Joined: Wed Feb 11, 2009 12:18 pm
Location: oxfordshire uk
Contact:

Re: what should i write next?

Postby sirmorris » Tue Feb 28, 2017 1:31 pm

Sea Dragon!

Source is available. I've extracted the level and enemy data. It's character mapped with a few sprites on top. Horizontal scroller. Awesome game.

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

Re: what should i write next?

Postby tricky » Tue Feb 28, 2017 6:13 pm

The line drawing just worked, well once I declared the variables and filled in ?scrstrt = &58.

Code: Select all

; line rendering coordinates, start and end
x0=&70:y0=&71
x1=&72:y1=&73

; logic vars
scr=&74
err=&76
errs=&77
cnt=&78
ls=&79
dx=&FF
dy=&7A
scrstrt=&7B

?scrstrt = &58

then just set ?x0, ?y0, ?x1, ?y1 and CALL linedraw4.
The drawing is to the centre of a full mode 4 screen, so you can't draw right to the sides.
I'll have a look at what could be saved if the screen was 256x256 instead of 320x256.

The Asteroids vector generator assumes 1024x1024 screen, so need to divide by 4 and flip vertically as it is the same as DRAW, 0,0 bottom left.

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

Re: what should i write next?

Postby Rich Talbot-Watkins » Tue Feb 28, 2017 9:09 pm

There's some real magic in that 3d code Kieran linked to. Still haven't had a chance to dissect the Bresenham routines to see what they're doing, but they're really clever. With a 256 byte wide screen, they could be even quicker!

One thing I would add for games use is for them to omit the last point (at endx, endy) and use EOR, so you can use them to plot and unplot line strips. Some Bresenham routines require x (or y) to increment, and swap the start and end points if that's not the case - but if you're omitting the end point you can't easily do that. Still, just a small thing.

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

Re: what should i write next?

Postby sbadger » Wed Mar 01, 2017 1:39 pm

so what about a wireframe version of Zarch?
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
fwibbler
Posts: 180
Joined: Thu Jan 13, 2005 10:37 pm
Location: Essex
Contact:

Re: what should i write next?

Postby fwibbler » Wed Mar 01, 2017 5:21 pm

Slightly different subject, (mainly for Tricky)...
Why should games be running at 50fps instead of 25fps?
I know the obvious answer would be for smoothness, but movies generally run at 24fps (25fps in PAL format) and these seem to run quite smoothly (to me anyway) so I dont understand the need to strive for 50fps when 25 would allow time for err, other things...
Just wondering.
Cheers!
P.S. Bearing in mind the title of this thread, I'm building a huge list :D

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

Re: what should i write next?

Postby tricky » Wed Mar 01, 2017 11:31 pm

For me, after 15 years in computer games, I am very attuned to any imperfections or anomolies in what is displayed or how it is displayed.
For me, the difference is like driving a car seat smoothly, verses kangarooing down the street.
I can hardly watch 24fps and usually don't go to the cinema for that reason. I bought the TV that did the best frame rate conversion. I also have a big problem with the blockiness of standard Def TV!
The 50/25 FPS thing is also much more noticeable on a CRT, which is what I prefer to use my beebs with.
There is also the extra challenge of in my opinion "doing it properly". I do appreciate that some games like blurp or even jelton cannot be done at 50fps and I definitely want them.
If I go ahead with asteroids, it probably can't be done at 50fps, but I think that will be OK!

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

Re: what should i write next?

Postby Lardo Boffin » Thu Mar 02, 2017 7:36 pm

Ok so I have a daft question - what exactly do you mean by 50fps for games on a Beeb?

Obviously I understand that conceptually 50fps means the screen updates 50 times a second but I assume that the Beeb lacks the power to completely redraw the whole screen 50 times a second - by which I mean that the contents of RAM that drive the screen output can't be updated 50 times?

Hopefully my question makes some sort of sense!

And hopefully I am not completely under estimating the power of the awesome Beeb... :shock:

Lardo
BBC model B 32k issue 4, 16k sideways RAM, Watford 12 ROM board, Retroclinic Datacentre + HDD, matchbox co-proc, Viglen twin 40/80 5.25" discs, acorn cassette
BBC model B 32k issue 7, turboMMC, Opus Challenger 3 512k, Pi 3 coproc, Acorn 6502 coproc

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

Re: what should i write next?

Postby danielj » Thu Mar 02, 2017 7:42 pm

50 times a second is 50hz, and the screen is updated that frequently... The processor runs at 2000hz. Totally doable. Tricky will no doubt fill in the technical detail!

d.

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

Re: what should i write next?

Postby RobC » Thu Mar 02, 2017 8:17 pm

danielj wrote:50 times a second is 50hz, and the screen is updated that frequently... The processor runs at 2000hz. Totally doable. Tricky will no doubt fill in the technical detail!

Umm...

The Beeb's CPU is fast for an 8-bit machine and runs at 2MHz (2,000,000Hz!) but the graphics screen modes consume a lot of memory (for an 8-bit machine and there's no graphics processor to help out). Modes 0,1 and 2 take 20KB and modes 4 and 5 use half that.

So, even in mode 4, at 50 frames per second, you 'd have to update 10 * 1024 * 50 = 512,000 bytes/second to redraw the entire screen.

The CPU is running at 2 million cycles per second but even the simplest "store accumulator to a single byte of screen memory" operation is going to cost 4 cycles. So, it's not quite possible to redraw a full screen at 50fps. And this is before you even do something remotely as complicated as moving a sprite in a game!

There are bits of hardware that help to do things like scroll the whole screen with relatively few operations but they only get you so far. That's why most games have relatively few moving objects and/or reduce the actual playing area.

It makes games that do run at 50fps and have lots of moving sprites (with no flicker) all the more impressive.

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

Re: what should i write next?

Postby danielj » Thu Mar 02, 2017 8:42 pm

Ergh. K, M, #-o

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

Re: what should i write next?

Postby oss003 » Thu Mar 02, 2017 9:10 pm

Hi guys,

Not the complete screen is refreshed, only the drawn objects on the screen have to be redrawn at 50 Hz.

Greetings
Kees

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

Re: what should i write next?

Postby RobC » Thu Mar 02, 2017 9:40 pm

oss003 wrote:Not the complete screen is refreshed, only the drawn objects on the screen have to be redrawn at 50 Hz.

Yes, although the question was (my emphasis):
Lardo Boffin wrote:I assume that the Beeb lacks the power to completely redraw the whole screen 50 times a second - by which I mean that the contents of RAM that drive the screen output can't be updated 50 times?

If we're talking about a full size graphics screen (i.e. modes 0,1,2,4 & 5), it's not possible to redraw the whole screen at 50fps on a Beeb.

One thing I'd love to try is getting a really fast second processor (ARMTDMI, matchbox, Pi) to do the screen rendering and then copy the screen data over the TUBE to the I/O processor's screen memory. It's apparently possible to do this at 220KB/s which, using a reduced screen size and double buffering, could give amazing animated graphics at 25fps.

User avatar
FourthStone
Posts: 385
Joined: Thu Nov 17, 2016 2:29 am
Location: Melbourne, Australia

Re: what should i write next?

Postby FourthStone » Thu Mar 02, 2017 10:40 pm

My 2 cents, the whole screen is rasterized to the screen 50 times a second, meaning the video chip has to read the screen memory (up to 20k) in its entirety and send this data to the screen to be drawn as pixels 50 times a second.

What is not possible for the beeb is to have the 6502 update the entire contents of screen memory in one cycle, not sure what the upper limit of how much screen memory can be updated in one frame but when talking about moving sprites there are many cpu cycles used to read, mask and write information into screen ram that limits how many pixels can be redrawn every frame.

If I am writing a game engine that I want to run at 50fps then I need make sure that all data is sent to video ram in less than one frame and also use careful timing to make sure the raster beam doesn't update the screen while the program is updating ram, otherwise shearing will occur.

I'm sure someone can explain it better, there is good technical information here: http://beebwiki.mdfs.net/Video_ULA

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

Re: what should i write next?

Postby tricky » Thu Mar 02, 2017 11:51 pm

I think that covers most of it ;)
To me, a game is only really 50fps if everything that is moving is redrawn 50 times a second with no flickering and no trearing.
I would say that my frogger game comes very close to the maximum that can be usefully drawn at 50fps in mode 1, although AstroBlaster also redraws everything every frame, whether it moves or not although because everything animates in sync, it does it in under a 1/4 of a frame.
It's not all about pixels, but as with the new bad apple demo, they do help;)
I think that the best use of a second processor for games is to run the game and tell the been what to draw in as few bytes as possible.

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

Re: what should i write next?

Postby Lardo Boffin » Fri Mar 03, 2017 12:30 am

tricky wrote:I think that covers most of it ;)
To me, a game is only really 50fps if everything that is moving is redrawn 50 times a second with no flickering and no trearing.


Thanks all and Tricky! I thought it must be something along these lines as cycle counting suggested that a high resolution screen would have too much RAM to update that quickly.
BBC model B 32k issue 4, 16k sideways RAM, Watford 12 ROM board, Retroclinic Datacentre + HDD, matchbox co-proc, Viglen twin 40/80 5.25" discs, acorn cassette
BBC model B 32k issue 7, turboMMC, Opus Challenger 3 512k, Pi 3 coproc, Acorn 6502 coproc

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

Re: what should i write next?

Postby kieranhj » Fri Mar 03, 2017 1:25 am

RobC wrote:One thing I'd love to try is getting a really fast second processor (ARMTDMI, matchbox, Pi) to do the screen rendering and then copy the screen data over the TUBE to the I/O processor's screen memory. It's apparently possible to do this at 220KB/s which, using a reduced screen size and double buffering, could give amazing animated graphics at 25fps.

Unfortunately, at least based on my investigations, having a fast copro is not going to help. Because only the host machine, fixed at 2MHz, can write to the screen it's a bit like having a half-decent CPU attached to the world's slowest GPU. I,e, completely the wrong way around. Sending data across the Tube using standard protocols ala Elite incurs a 24us wait per byte which limits to ~750 bytes/50Hz frame to do anything useful. Using the 256 byte protocol might be better but this is broken in B-em :( so I haven't had time to play further. In general you end up being limited by doing a calc, storing a value, transferring the data, reading the data, writing to screen rather than just doing a calc, writing to screen as you would all on the host.

My summary, perhaps unsurprsingly, is that the second processor system wasn't designed for parallelism but intended to enable another processor to utilise the IO capabilities of the plastic box that the rest of the machine inhabits. This makes sense when you think about the economics of the day.

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

Re: what should i write next?

Postby 1024MAK » Fri Mar 03, 2017 2:01 am

But it's a lot quicker if you use your own code on both the CPUs instead of using the Acorn protocols.

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

User avatar
ash73
Posts: 35
Joined: Wed Feb 03, 2016 10:51 pm
Location: Cheshire, UK

Re: what should i write next?

Postby ash73 » Fri Mar 03, 2017 4:29 am

How about Starship Command 2 with a procedural galaxy of star systems, FTL jumps, trading and a career ladder... like a 2D version of Elite?

Other suggestion would be a port of OutRun!

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

Re: what should i write next?

Postby RobC » Fri Mar 03, 2017 9:13 am

1024MAK wrote:But it's a lot quicker if you use your own code on both the CPUs instead of using the Acorn protocols.

Yes - that's my understanding too.

The GoSDC manual claims that the ARM7TDMI co-pro (and others) can get to over 200KB/s. We had a brief diussion about this on the BBC Micro Mailing list a few years back.

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

Re: what should i write next?

Postby kieranhj » Fri Mar 03, 2017 9:05 pm

RobC wrote:One thing I'd love to try is getting a really fast second processor (ARMTDMI, matchbox, Pi) to do the screen rendering and then copy the screen data over the TUBE to the I/O processor's screen memory. It's apparently possible to do this at 220KB/s which, using a reduced screen size and double buffering, could give amazing animated graphics at 25fps.

Ah OK, I was misunderstanding your intention the first time around just copying the screen over. There's 10us wait required per byte over the Tube so could get ~200,000 bytes/sec in theory which is ~8k / 25Hz frame. So you could fill a square version of MODE4/5 with some very careful timing (still have to process keyboard, sound, disc etc. on host.)

Could be possible to achieve some interesting effects but I still suspect it would be a lot of trouble and you'd end up being limited by the host CPU. The copro would have to be substantially faster (like ARM, as you say) as 4MHz 6502 e.g. isn't a big enough bump to make it worthwhile from my current explorations.

paulb
Posts: 761
Joined: Mon Jan 20, 2014 9:02 pm

Re: what should i write next?

Postby paulb » Fri Mar 03, 2017 9:22 pm

kieranhj wrote:Could be possible to achieve some interesting effects but I still suspect it would be a lot of trouble and you'd end up being limited by the host CPU.


I still want to try direct memory access with the RDY# signal, but it looks like I have to go beyond the cartridge interface and straight to the Electron's expansion bus for that. Do any of the Beeb's interfaces provide access to RDY#, RnW, all address lines, all data lines, and PHI OUT?

DMA would allow very efficient access to screen memory, certainly several times that of anything involving the host CPU.

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

Re: what should i write next?

Postby 1024MAK » Fri Mar 03, 2017 10:18 pm

paulb wrote:Do any of the Beeb's interfaces provide access to RDY#, RnW, all address lines, all data lines, and PHI OUT?

DMA would allow very efficient access to screen memory, certainly several times that of anything involving the host CPU.
None of the external ports on a BBC B provide access to the signals that you want. Your best bet is to use a CPU shim PCB that plugs into the CPU socket, the CPU then plugs into a socket on the shim. On the shim PCB you have a connector that can then provide the signals that you want.

Any access to the IO CPU memory can only occur at the same 2MHz slots in the 4MHz system cycle. The benefit of DMA is that a block of memory can be copied or written in one go without having to keep reading machine language instructions.

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

paulb
Posts: 761
Joined: Mon Jan 20, 2014 9:02 pm

Re: what should i write next?

Postby paulb » Fri Mar 03, 2017 10:26 pm

1024MAK wrote:
paulb wrote:Do any of the Beeb's interfaces provide access to RDY#, RnW, all address lines, all data lines, and PHI OUT?

DMA would allow very efficient access to screen memory, certainly several times that of anything involving the host CPU.
None of the external ports on a BBC B provide access to the signals that you want. Your best bet is to use a CPU shim PCB that plugs into the CPU socket, the CPU then plugs into a socket on the shim. On the shim PCB you have a connector that can then provide the signals that you want.


That's really inconvenient! Good thing I don't really care about the Beeb, then. :wink:

If Acorn had just made two more address lines available via the cartridge port, it would have been a lot easier to experiment with this on the Electron. For the Master 128, they'd have needed to preserve the RDY# line and not requisition it for RnW (having requisitioned the RnW line with some kind of clever I/O memory signal).

This year could really be the year of the expander, at least on the Electron.

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

Re: what should i write next?

Postby kieranhj » Sat Mar 04, 2017 9:29 am

@Tricky

Having read this month's Retro Gamer mag this morning I was going to suggest Prince of Persia as it originated on Apple II, but I see you've discounted that already!! http://stardot.org.uk/forums/viewtopic.php?f=1&t=9279&p=106923&hilit=Prince+of+Persia#p106923

It would be quite an epic technical challenge to squeeze it all in but seems feasible on a Master. Perhaps when I run out of demo fx to develop I'll take a look!

Otherwise my suggestion would be something like Worms (horizontal scroll) or a nice colourful pinball game (vertical scroll).


Return to “software: classic games”

Who is online

Users browsing this forum: MrZeroPage and 3 guests