New 1KB score-attack game for the Beeb

new games to be launched and discussed here
ebenupton
Posts: 6
Joined: Sun May 04, 2014 8:16 pm

New 1KB score-attack game for the Beeb

Postby ebenupton » Thu Dec 29, 2016 4:25 pm

I've been spending my spare time over the last couple of months writing, and then tuning, a little score-attack game for the Beeb. Quite a fun exercise in squeezing speed (to run at 50Hz) and size (to fit in 1KB) out of the old 6502.

Documentation, sources and a disk image are available to download here:

https://hackaday.io/project/19168-bbc-m ... ore-attack

User avatar
BigEd
Posts: 1392
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: New 1KB score-attack game for the Beeb

Postby BigEd » Thu Dec 29, 2016 4:37 pm

Nice! Is this a final release?

I think I just got the world record - 11 points. Perhaps others will do better soon... or perhaps that's no record. It was a personal best though.

    CH."GOFAT"
    shift - Z - X
    space to restart

I think with some little effort one could make a URL to play this directly in JSBeeb.

ebenupton
Posts: 6
Joined: Sun May 04, 2014 8:16 pm

Re: New 1KB score-attack game for the Beeb

Postby ebenupton » Thu Dec 29, 2016 4:47 pm

I hadn't seen JSBeeb. It's brilliant. Didn't realise I'd made a web app :)

User avatar
BigEd
Posts: 1392
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: New 1KB score-attack game for the Beeb

Postby BigEd » Thu Dec 29, 2016 4:52 pm

You did it before, also without realising!
2048 game by Eben Upton
Playable URL.


User avatar
BigEd
Posts: 1392
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: New 1KB score-attack game for the Beeb

Postby BigEd » Thu Dec 29, 2016 9:12 pm

(Thanks lurkio!)

ebenupton
Posts: 6
Joined: Sun May 04, 2014 8:16 pm

Re: New 1KB score-attack game for the Beeb

Postby ebenupton » Thu Dec 29, 2016 10:52 pm

Thanks. Think I'll update my Hackaday contest entry with this.

User avatar
BigEd
Posts: 1392
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: New 1KB score-attack game for the Beeb

Postby BigEd » Fri Dec 30, 2016 6:18 am

From the writeup, some interesting notes on optimising for size and speed:

6502 miscellany

We use only the base, official NMOS 6502 instructions: no 65C02 extensions or unofficial opcodes (though I would dearly have loved to resort to STZ on occasion). There's a fair bit of self-modifying code to:

    update address fields of load instructions to avoid zero-page setup
    implement cheap computed branches
    dynamically specialize the blend kernel to a store kernel
    We use the 1- and 2-byte BIT hacks in a couple of places to provide multiple entry points to functions.
A lot of effort went into flag propagation analysis to allow us to remove CLC and SEC instructions and substitute known-taken branches (in particular BVC) for jumps.

ebenupton
Posts: 6
Joined: Sun May 04, 2014 8:16 pm

Re: New 1KB score-attack game for the Beeb

Postby ebenupton » Fri Dec 30, 2016 12:31 pm

What was most interesting for me was how the savings kept coming long after I would have sworn they were done.

I really struggled to get the base game logic into 1024 bytes, using OS functions for vblank and keyboard, and the *640 ROM table in the sprite routine. But then I was able to add code to do all those bits (to meet the Hackaday contest rules), *and* to fit in hardware and data area initialisation (including tables), screen clearing, polling for space to continue etc, and end up at 1010 bytes. Magic.

Tom_Lindberg
Posts: 75
Joined: Sat Jun 18, 2016 11:33 pm
Location: Sola, Norway

Re: New 1KB score-attack game for the Beeb

Postby Tom_Lindberg » Sat Jan 07, 2017 11:14 pm

Well done! I really enjoyed this game. Simple and very addictive. My best score so far is 125 602.

ebenupton
Posts: 6
Joined: Sun May 04, 2014 8:16 pm

Re: New 1KB score-attack game for the Beeb

Postby ebenupton » Sat Jan 14, 2017 9:08 pm

Blimey. I've never got past 400 myself. Going to rig it up on the retro arcade cabinet at Pi Towers and see how people do.

Tom_Lindberg
Posts: 75
Joined: Sat Jun 18, 2016 11:33 pm
Location: Sola, Norway

Re: New 1KB score-attack game for the Beeb

Postby Tom_Lindberg » Sat Jan 14, 2017 10:31 pm

At the very beginning of the game where you drop from the top I got 10 coins before landing on the platform. Thats 512 points :) I believe the pattern of coins always is the same so it's just a matter of learning a route. Maybe even 11 coins is possible (1024 points).

ebenupton
Posts: 6
Joined: Sun May 04, 2014 8:16 pm

Re: New 1KB score-attack game for the Beeb

Postby ebenupton » Sat Jan 14, 2017 11:14 pm

I did wonder about starting the helicopter on the platform to avoid having that very "valuable" first flight. The sequence of coin positions is fixed, provided you collect them in the same order; if you collect in a different order then the logic that prevents more than one coin from appearing on a line will cause the sequence diverge. I avoided mixing in entropy from the user input specifically to make the game learnable.


Return to “software: new games”

Who is online

Users browsing this forum: No registered users and 1 guest