what should i write next?

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

Related forum: adventures


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

Re: what should i write next?

Postby FourthStone » Sat Mar 04, 2017 9:42 am

I had a little look at POP, would be an epic challenge, here are a mode 0 bitmap of sprites converted from some I found around the web...

CHAIN"LOAD"

POP01.zip
(4.57 KiB) Downloaded 38 times

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

Re: what should i write next?

Postby tricky » Sat Mar 04, 2017 10:49 pm

Sideways RAM + lots of disc loading, still at least the original runs at a low frame rate.
I've been playing with line drawing and found an early incomplete version of what I did BITD, the unrolled version is about 10% faster that the one from the 3D code, but also 50% more memory, but you can skip the last pixel.

EDIT: On longer lines, the 3D code is slightly faster, so I suspect it is just down to it storing the dx/dy with self modding code taking longer to startup, but then saving per pixel!

I'll complete my code and see where I get to.

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

Re: what should i write next?

Postby daveejhitchins » Sun Mar 05, 2017 8:13 am

kieranhj wrote:Otherwise my suggestion would be something like Worms (horizontal scroll)
Isn't Jason (jbnbeeb) in the middle of a similar write?

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
kieranhj
Posts: 530
Joined: Sat Sep 19, 2015 10:11 pm
Location: Farnham, Surrey, UK

Re: what should i write next?

Postby kieranhj » Sun Mar 05, 2017 10:59 am

daveejhitchins wrote:Isn't Jason (jbnbeeb) in the middle of a similar write?

Dave H :D

Jason is doing some interesting double buffered horizontal scrolling with a worm character, last time I saw him at ABUG, but I was more thinking of this: https://en.m.wikipedia.org/wiki/Worms_(1995_video_game).
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/

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

Re: what should i write next?

Postby tricky » Mon Mar 06, 2017 7:53 pm

I finished off the other directions for my code from BITD and on lines of 128 pixels between 128 and 180, it is slower than linedraw4 from the 3D code, attached is a comparison pair of .ssd files, the one missing the horizontal and vertical lines is mine.

They both take up about the same amount of space.
Mine uses 256x256 mode, where as linedraw4 is handicapped by using 320 bytes wide.

Mine is written to wrap horizontally, as Asteroids uses a vector from your current point, rather than end points (although the two are easily converted).
Mine doesn't draw the last pixel, hopefully making it more useful for asteroids (polylines).

I have an idea to speed mine up and to save at least 1K of the current 2+K while keeping the ability to skip the last pixel (I have 8 routines and only need 4, and will keep the faster 4 ;) ).

I haven't checked whether the speed difference is down to the self modding or not (I expect it is), nor have I checked what the relative speeds are for the line lengths that are used in asteroids.

I love the EOR colour fill from the 3D code =D>
Last edited by tricky on Tue Mar 07, 2017 1:00 pm, edited 1 time in total.

sirbod
Posts: 742
Joined: Mon Apr 09, 2012 8:44 am
Location: Essex
Contact:

Re: what should i write next?

Postby sirbod » Tue Mar 07, 2017 9:30 am

What's the longest line length you need to draw? Could you avoid division and speed up your line draw by storing line details in a table?

If your longest line is 15 pixels for example, you'd want a 16x16 table (512 bytes) containing:
nibble <start step length>
nibble <mid step length>
nibble <no of steps>
nibble <end step length>

Code: Select all

Example 15x4 line:

***
   ****
       ****
           ****
           
^start step length=3
    ^ mid step length=4, no of steps=2
           ^end step length=4

The entry at offset &78 (15x4 x2) in the table: 3,4,2,4 or &3424

Your table lookup would be ABS(x1-x2)*2+ABS(y1-y2)*32 and the line plot would contain four line draw routines that plot the sub-lines in the relevant direction, ie +X,+Y / +X,-Y / -X,+Y / -X,-Y

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

Re: what should i write next?

Postby kieranhj » Tue Mar 07, 2017 12:09 pm

tricky wrote:I love the EOR colour fill from the 3D code =D>

Yes, this was a revelation to us. Apparently it's a technique known as "vertical XOR" and was used in the Amiga scene and even in some GFX chips but doesn't seem to be well documented anywhere. Very clever post-processing effect to produce solid filled objects in fixed time (proportional to the screen area.) It also has the advantage that you don't need to do full Bresenham either, just plot one pixel per column, no need for vertical spans.
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/

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

Re: what should i write next?

Postby Rich Talbot-Watkins » Tue Mar 07, 2017 12:37 pm

sirbod wrote:What's the longest line length you need to draw? Could you avoid division and speed up your line draw by storing line details in a table?

Nice idea, but it wouldn't work for every case as the 'middle' portion rarely breaks up into equal sized runs.

e.g. a line with (dx, dy) = (16, 11) ends up looking like this:

Code: Select all

*
 **
   *
    **
      *
       *
        **
          *
           **
             *
              **

You can only really arrive at that by Bresenham style iteration.

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

Re: what should i write next?

Postby tricky » Tue Mar 07, 2017 12:58 pm

The "line details" are dx, dy and direction (combinations of sign and major axis), no division required, it just falls out of adding one axis Delta until you exceed the other, then subtracting the other.

The fastest way to do this in 6502 is to start at half the major axis Delta and subtract the minor axis Delta as you move each pixel in the major axis until you go negative and then move one pixel in the minor axis direction, adding the major axis Delta.

I'm sure there is a good description of this on the web, which would have saved my teenage self from reinventing another wheel!

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

Re: what should i write next?

Postby tricky » Tue Mar 07, 2017 9:49 pm

I think this was already discussed, but as I am still slower than the linedraw4, I thought I would have a look and it tracks which horizontal pixel a byte is going to start on and then when it is about to leave the byte, ands with how far across the byte it is and does all the pixels in one go.
For the example above, it is only updating the display twice for every three pixels.
So probably the fastest routine is to convert it to a 256 wide screen and just simplify the vertical character line changes.

My only consolation is that my code is 1.3K vs 2.3K for linedraw4 :lol:

EDIT: Just found a typo and a minor optimisation that I knew should be possible, now faster on steep lines (probably because of 256 vs 320 byte lines), but the remembering which pixels to fill method is very fast on near horizontal lines.
Still need to check on shorter lines, but I don't think linedraw4 can be bettered for near horizontal lines without extreme unrolling.
Attachments
faster.zip
(2.75 KiB) Downloaded 23 times

finisterre
Posts: 17
Joined: Thu Feb 23, 2017 1:07 pm

Re: what should i write next?

Postby finisterre » Mon Mar 27, 2017 2:17 pm

Tricky, do you have links to all your Beeb games/demos in once place somewhere? So far, I've read about Frogger and Phoenix, and I'm wondering what else I've missed that I'd like to try.

Thanks.

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

Re: what should i write next?

Postby tricky » Mon Mar 27, 2017 4:56 pm

There is a bit about my history with the beeb here, http://stardot.org.uk/forums/viewtopic.php?f=1&t=10684&p=133673&hilit=carnival#p133673, which has a few more links.

Most recently I have been distracted tweaking b-em and beebem to allow joysticks to be mapped to keys inside the emulator, so that they can easily be added to a "MAME cabinet" and only require joystick support including quitting the emulators to change game. I have also written a launcher http://stardot.org.uk/forums/viewtopic.php?f=4&t=12735&p=163861#p163721.

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

Re: what should i write next?

Postby Rich Talbot-Watkins » Tue Apr 04, 2017 12:07 pm

Today I came across a line drawing algorithm I hadn't seen before, and thought I'd share it: it should perform 2-4 times faster than Bresenham! (although given the bottleneck on the Beeb is possibly just the actual pixel plotting, we might not see such dramatic improvements).

It's an algorithm developed by Xiaolin Wu which works by noting that, for a run of three pixels on a line, there are only a few possibilities.

Image

There's a bit of info here on it (on Wikipedia, but only in German!), and an implementation in C, here (in the section titled "Life After Bresenham").

Here's what Graphics Gems 1 says about it:

Brian Wyvill in Graphics Gems 1 wrote:Double Speed Bresenham's

A few years ago one of my students, Xialon Wu, approached me with an exciting new line drawing algorithm. At the time his English was bad, his claims outrageous, and I was busy. Eventually Wu developed his double step algorithm with Prof. Jon Rokne and I realized what a good idea he had had (see Wu and Rokne, 1987). Like all good ideas it is very simple: instead of using a discriminator to choose the next pixel, Wu chooses the next pattern of two pixels (see Fig. 1).

Image

Since there are four distinct patterns, how does the algorithm reduce to a simple binary decision? Let us for the moment call patterns 2 and 3 one pattern, 2(3). This could be the case on a multilevel display since both patterns could be shown as one with the center pixels at half intensity to achieve a degree of anti-aliasing. It can be shown that for lines whose slope is less than 1/2 that pattern 4 does not occur; the choice is then between pattern 1 and 2(3). Similarly, for lines with slope greater than or equal to 1/2, the choice is between pattern 2(3) and pattern 4 (pattern 1 cannot occur). Simply by testing the slope outside the plotting loop the algorithm reduces to a single discriminator. To distinguish between patterns 2 and 3 also turns out to be easy, requiring one more test but using the same discriminator. In this way the algorithm does only slightly more work to produce two pixels instead of one per step, virtually doubling the speed of Bresenham’s original. (A similar, but much more complex algorithm also exists for quadruple step patterns (Bao and Rokne, 1990).

Using Symmetry

So impressed was I with this breakthrough that I coded the algorithm and added a small change of my own. Since lines are symmetric about the
center, it makes sense to use this symmetry to plot from both ends simultaneously using half the number of steps. Wu was not pleased to see that I had doubled the speed of his algorithm overnight! It turns out that using the symmetry was not a new idea; probably Bresenham himself thought of it originally. The symmetric double step algorithm is between three and four times faster than the original Bresenham’s (see Rokne et al., 1990). The hardware manufacturers were not particularly interested in Wu’s idea. The bottleneck (currently) in line drawing is not choosing the pixels, but getting the information to the display, the pixel write operations. Wu went on to develop a similar idea for drawing conics and Jon Rokne and Paul Bao continued with the pattern idea to produce a quadruple step version of the line algorithm. Pseudo code for lines with slopes from 0 to 1/2 is set out in Fig. 2. C code for lines of any slope is given in the appendix.


Not sure if that could yield a speedup on the Beeb (I suspect possibly not, particularly compared to the optimized Bresenham code above), but I thought it was an interesting technique all the same.

User avatar
sbadger
Posts: 233
Joined: Mon Mar 25, 2013 1:12 pm
Location: Farnham, Surrey

Re: what should i write next?

Postby sbadger » Tue Apr 04, 2017 3:15 pm

tricky wrote:Most recently I have been distracted tweaking b-em and beebem to allow joysticks to be mapped to keys inside the emulator, so that they can easily be added to a "MAME cabinet" and only require joystick support including quitting the emulators to change game. I have also written a launcher http://stardot.org.uk/forums/viewtopic.php?f=4&t=12735&p=163861#p163721.


Nice work. I've been setting up a RetroPie on a pi3 recently and while spectrum and amiga is supported, BBC is not (not nativley anyway). The real gap is exactly as you hint at, mapping of keys to joypad. It's a fair amount of work I feel to get a lot of things supported.
A3020| A3000x3| BBCBx3 | Electrn | Masterx3 |RiscPC| RPix3
A600 | C64 bbin x2|C64C | Toastrack |QL | XB360&1X |GB |GBC |GBA |GBASP | DS | 3DS XL x2| MD | MS
Atari 7600 | PS1-2-3-4| PSP |Vita |SNES |GC |N64 |Wii & U |Switch |JammaCab |Sony PVMx2

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

Re: what should i write next?

Postby tricky » Tue Apr 04, 2017 9:18 pm

The line drawing algorythm could help if it means that drawing could effectivity be unrolled in both directions.

For the key mapping, as most cabs have many keys, lots of games can be supported with zx.. on the joystick and return, shift, space etc on the buttons, although as you say, doing it correctly requires quite a bit of work.

Zarchos
Posts: 2355
Joined: Sun May 19, 2013 8:19 am
Location: FRANCE

Re: what should i write next?

Postby Zarchos » Wed Apr 05, 2017 8:22 am

What about writing a 'Mister Driller' game ?
Using hardware scrolling.

It's a fun little and cute game, very entertaining (and not too violent).

Not too complex and fun to play : a conversion of the Spectrum Xeno game.
I've spent hours playing it : simple idea, great result, very addictive.
https://youtu.be/EBldiH7GnEc

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

Re: what should i write next?

Postby tricky » Fri Apr 14, 2017 11:37 am

With the space Invaders http://stardot.org.uk/forums/viewtopic.php?f=1&t=12474 digression nearly done, I've been thinking about a platformer framework as take-up of my sprites http://stardot.org.uk/forums/viewtopic.php?f=53&t=12565&hilit=sprites+framework#p161873 wasn't stellar​.

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

Re: what should i write next?

Postby trixster » Mon Apr 17, 2017 7:12 pm

sbadger wrote:
tricky wrote:Most recently I have been distracted tweaking b-em and beebem to allow joysticks to be mapped to keys inside the emulator, so that they can easily be added to a "MAME cabinet" and only require joystick support including quitting the emulators to change game. I have also written a launcher http://stardot.org.uk/forums/viewtopic.php?f=4&t=12735&p=163861#p163721.


Nice work. I've been setting up a RetroPie on a pi3 recently and while spectrum and amiga is supported, BBC is not (not nativley anyway). The real gap is exactly as you hint at, mapping of keys to joypad. It's a fair amount of work I feel to get a lot of things supported.


Are you sure? I added beebem to my Retropie setup manually but I think it's available through the experimental options?

Iirc the issue with beebem on Retropie is the file selector crashes the emulation if you run beebem from the Retropie front end (i.e. not in xwindows). It needs to be recompiled. B-em works ok but again only from within the desktop.
A3020 | A3000 | BBC B + 128K RAM/ROM + 20K Shadow + Pi0 + VideoNuLA
BBC Master Turbo + DC | Atom | A1200 060 | A500 | Jaguar | A420/1
A4000/040 060 | Atari Falcon 060 | Saturn | PS1 | SNES | CPC6128 | C64 | 3DO | MD

User avatar
sbadger
Posts: 233
Joined: Mon Mar 25, 2013 1:12 pm
Location: Farnham, Surrey

Re: what should i write next?

Postby sbadger » Wed Apr 19, 2017 7:39 am

trixster wrote:
sbadger wrote:
tricky wrote:Most recently I have been distracted tweaking b-em and beebem to allow joysticks to be mapped to keys inside the emulator, so that they can easily be added to a "MAME cabinet" and only require joystick support including quitting the emulators to change game. I have also written a launcher http://stardot.org.uk/forums/viewtopic.php?f=4&t=12735&p=163861#p163721.


Nice work. I've been setting up a RetroPie on a pi3 recently and while spectrum and amiga is supported, BBC is not (not nativley anyway). The real gap is exactly as you hint at, mapping of keys to joypad. It's a fair amount of work I feel to get a lot of things supported.


Are you sure? I added beebem to my Retropie setup manually but I think it's available through the experimental options?

Iirc the issue with beebem on Retropie is the file selector crashes the emulation if you run beebem from the Retropie front end (i.e. not in xwindows). It needs to be recompiled. B-em works ok but again only from within the desktop.


hmm, i had a look last night at optional packages and experimental packages but couldn't see anything. Is it called something subtle, other than b-em?
A3020| A3000x3| BBCBx3 | Electrn | Masterx3 |RiscPC| RPix3
A600 | C64 bbin x2|C64C | Toastrack |QL | XB360&1X |GB |GBC |GBA |GBASP | DS | 3DS XL x2| MD | MS
Atari 7600 | PS1-2-3-4| PSP |Vita |SNES |GC |N64 |Wii & U |Switch |JammaCab |Sony PVMx2

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

Re: what should i write next?

Postby trixster » Wed Apr 19, 2017 5:26 pm

Not sure either! I'm away from home at the moment so I can't check. It might have been removed from the later versions of Retropie. It's definitely beebem, not b-em. You have to install that through the desktop, not Retropie.
A3020 | A3000 | BBC B + 128K RAM/ROM + 20K Shadow + Pi0 + VideoNuLA
BBC Master Turbo + DC | Atom | A1200 060 | A500 | Jaguar | A420/1
A4000/040 060 | Atari Falcon 060 | Saturn | PS1 | SNES | CPC6128 | C64 | 3DO | MD

User avatar
sbadger
Posts: 233
Joined: Mon Mar 25, 2013 1:12 pm
Location: Farnham, Surrey

Re: what should i write next?

Postby sbadger » Wed Apr 26, 2017 8:27 am

another option I came across for an apple ii /6502 remake is conan halls of volta.

https://en.wikipedia.org/wiki/Conan:_Hall_of_Volta

It already looks like a beeb game and has single level screens and lovely animation.
A3020| A3000x3| BBCBx3 | Electrn | Masterx3 |RiscPC| RPix3
A600 | C64 bbin x2|C64C | Toastrack |QL | XB360&1X |GB |GBC |GBA |GBASP | DS | 3DS XL x2| MD | MS
Atari 7600 | PS1-2-3-4| PSP |Vita |SNES |GC |N64 |Wii & U |Switch |JammaCab |Sony PVMx2

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

Re: what should i write next?

Postby FourthStone » Wed Apr 26, 2017 11:33 am

sbadger wrote:another option I came across for an apple ii /6502 remake is conan halls of volta.

https://en.wikipedia.org/wiki/Conan:_Hall_of_Volta

It already looks like a beeb game and has single level screens and lovely animation.


Good choice, I love this game and have made a small start on the intro screen which I hope to advance one day, have a look and let me know what you think. Have to scroll towards the end of the thread to find the latest update/download.

http://stardot.org.uk/forums/viewtopic.php?f=53&t=12264

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

Re: what should i write next?

Postby marcusjambler » Sat Jul 01, 2017 12:04 pm

'Orbitron' looks like a possibility

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

Re: what should i write next?

Postby Dave Footitt » Fri Jul 07, 2017 9:08 pm

For no particular reason I have made a list of my top 5 arcade games I'd like to see on the BBC Micro. AFAIK they all made it to at least one 8 bit machine in some form or another. Food for thought :D

    Congo Bongo (AKA Tip Top)
    Kung Fu Master
    Xybots
    Rolling Thunder
    Gauntlet

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

Re: what should i write next?

Postby tricky » Fri Jul 07, 2017 10:12 pm

I did look at lungfoo master and I think there is already a gauntlet, but I'll have to revisit the others.

User avatar
grobda
Posts: 102
Joined: Tue Apr 23, 2013 1:46 pm
Location: Glasgow

Re: what should i write next?

Postby grobda » Wed Jul 12, 2017 11:01 pm

Bit late to this thread and skimmed it a bit.

Mention of Asteroids made me think of the emulator for the atari 800 - http://members.aon.at/nkehrer/ast800xl.html - he's also done sprint for the 800 so you already have a conversion in common :D

Found out about that when I was thinking of the possibility of running elite using a vector monitor - the Asteroids arcade PCB has a 6502 which runs the program, then the drawing is done by a logic vector generator, tube elite has a 6502 for the program and copro for the graphics, so both machines seemed to consist of two halves that could be used for 'emulation' either way. All vague daydreaming for me as I have little understading of the hardware and I'm just dabbling in basic at the moment.

The other thing I thought of was a 2600 emulator, which would unlock a huge library of games to play on the beeb.

As an aside, I was amazed someone had done a conversion of thrust for the 2600;

https://www.youtube.com/watch?v=mceujFUjdDE

Managed to get a copy and its my second favourite after the beeb version, prefer it to the Atari ST version where the inertia is all wrong. The Vectrex version is also worth a look but iirc the view distance is poor due to the scaling.

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

Re: what should i write next?

Postby tricky » Thu Jul 13, 2017 11:49 am

The 2600 is very hard to emulate on the beeb.
Drawing stuff at the correct position involves seeing a couple of counters and a couple of registers and clearing them is just not drawing them next time!
I think each game could probably be done as individual simulators, but a generic Tia simulator on the beeb is afaict impossible :O

Michael Brown
Posts: 1898
Joined: Sat Apr 03, 2010 12:54 pm
Location: Nottingham

Re: what should i write next?

Postby Michael Brown » Fri Jul 14, 2017 10:05 am

Hi Tricky

How are Basic Space Invaders and Pheenix coming?

Last I saw was that correct sound was required when pressing fire on Space Invaders.

any new posts?

regards,
Mick.

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

Re: what should i write next?

Postby tricky » Fri Jul 14, 2017 12:32 pm

The latest versions are in the thread.
Space Invaders still needs a better sound effect, but the one that I put in is as close as I could get to the analogue original.
I did update phoenix to rc2, I don't know if it will ever get any further; it is all their and playable though.

Michael Brown
Posts: 1898
Joined: Sat Apr 03, 2010 12:54 pm
Location: Nottingham

Re: what should i write next?

Postby Michael Brown » Fri Jul 14, 2017 2:31 pm

Excellent!

Keep up the good work.

BTW - what are the keyboard controls (if any) for Rip Cord?

Mick.


Return to “software: classic games”

Who is online

Users browsing this forum: No registered users and 10 guests