A downloadable game

Invisible Maze

==============

entry for PUR-120 category, Basic 10-liner 2026.

BBC Basic. Requires Acorn GXR (graphics ROM with additional plot commands that came out in 1985) because it needs such advanced features as...parallelograms. This also seems to work on BBC Master emulators (a later model of the Micro)

Program size

============

Line count and longest line character count.

; wc -lL maze/maze.bas

       9     117 maze/maze.bas

1MODE9+RND(-8):DIMC(16,16):FORI=1TO15:FORJ=1TO15:C(I,J)=INT(RND(1)+0.7):NEXT,
2VDU29,640;100;:I=1:J=1:W=0:PRINTTAB(0,6);"INVISIBLE EXIT ->"
3REPEAT:IFW=0:U=I:V=J:R=-40:S=0:L=0:M=46:N=40:O=-21:P=40:Q=23
4X=&71+2*(W MOD2):MOVE40*(U-V),23*(U+V):PLOT0,R,S:PLOT1,L,M:GCOL16,0:PLOTX,N,O:GCOL32,0:PLOTX,P,Q:GCOL48,0:PLOTX,-L,-M
5IFW=0Z=INKEY(1E4):A=(Z=79)-(Z=80):B=(Z=68)-(Z=69)
6W=W+1:IFW>3:W=0:IFC(I+A,J+B)=1:GCOL0,3:MOVE40*(I-J),23*(I+J):PLOT&99,4,0:I=I+A:J=J+B
7IFW=2ANDA<>0:U=I+A/2:R=-46:S=32:L=29:M=46:P=29:Q=-18
8IFW=2ANDB<>0:V=J+B/2:R=-40:S=35:L=22:M=32:N=22:O=-45
9UNTILI+J=30:PRINT"WIN!"

Description

===========

Last week Ron Gilbert (of Monkey Island fame) tooted:

"Quick! I need a game design idea for a 3D game idea that only uses a cube"

https://mastodon.gamedev.place/@grumpygamer/116206876497411786

That was still in my head when I read about the basic 10 liner competition last weekend. "Hmm," I thought, "I can maybe render a rotating cube, but there'd be no room to draw anything else...wait-what if everything else was *INVISIBLE*!!!" ... The idea was so silly I had to write it and now, you have to play it.

MODE9+RND(-8):DIMC(16,16):FORI=1TO15:FORJ=1TO15:C(I,J)=INT(RND(1)+0.7):NEXT,

The WORST maze generator IN THE WORLD. All this is is some biased noise; by biasing slightly towards corridors, I got a grid where there is a route from start to finish. We're only doing one level so FINE.

VDU29,640;100;:I=1:J=1:W=0:PRINTTAB(0,6);"INVISIBLE EXIT ->"

Set things up. The VDU command recenters to avoid ofsetting every time.

REPEAT:IFW=0:U=I:V=J:R=-40:S=0:L=0:M=46:N=40:O=-21:P=40:Q=23

Each time I draw the cube I have to draw it again in the background colour to remove it. I am using 2 frame animations, so I have 3 shapes I need to draw twice, that each consist of 3 parallelograms. To shave the code down, I make a little state machine; W=0 plots the upright cube; W=1 erases it. W=2 plots the cube rolled 45 degrees in the direction of motion. W=3 erases that. The rest of this is coordinates; I move to the bottom centre of the cube then draw from there.

X=&71+2*(W MOD2):MOVE40*(U-V),23*(U+V):PLOT0,R,S:PLOT1,L,M:GCOL16,0:PLOTX,N,O:GCOL32,0:PLOTX,P,Q:GCOL48,0:PLOTX,-L,-M

This is the actual cube drawing. Of course it's not real 3d!!! I just plot 3 parallelograms each time. I use the shading patterns (GCOL16/32/48) instead of the standard colours (GCOL0,0/1/2/3) because when the cube rotates it still looks right if its shaded, but if I'd coloured the faces I'd have to track which face was upright.

IFW=0Z=INKEY(1E4):A=(Z=79)-(Z=80):B=(Z=68)-(Z=69)

Keyboard control. Wait for a keypress, calculate the direction of motion.

W=W+1:IFW>3:W=0:IFC(I+A,J+B)=1:GCOL0,3:MOVE40*(I-J),23*(I+J):PLOT&99,4,0:I=I+A:J=J+B

I made a few variants that either showed you nothing about the maze, or showed walls if you hit them; this one, which shows a breadcrumb trail of where you've been, worked best. The cube only rolls if the square is empty.

IFW=2ANDA<>0:U=I+A/2:R=-46:S=32:L=29:M=46:P=29:Q=-18

IFW=2ANDB<>0:V=J+B/2:R=-40:S=35:L=22:M=32:N=22:O=-45

These 2 states show the 45 degree rotated cube

UNTILI+J=30:PRINT"WIN!"

And the win condition. I could make this better, but the game idea is just a joke, and I've made you suffer enough.

Download

Download
maze.bas 581 bytes
Download
maze.ssd 200 kB
Download
maze.txt 4.5 kB

Install instructions

Instructions

============

Emulator for example at https://bbc.xania.org

This program requires the Acorn GXR ROM; in jsbeeb you can get it to work by going to the top left menu and choosing the model: BBC Master 128 (DFS)

Then go to the Discs menu, choose From examples or local, upload the ssd.

Type:

LOAD "PROGRAM"

LIST

RUN

Use O,P,E,D to move.

To load the program in owlet (which has GXR enabled by default):

https://bbcmic.ro/#%7B%22v%22%3A1%2C%22program%22%3A%22MODE9%2BRND%28-8%29%3ADIM...

In owlet, you need to click the screen after pressing play for the keyboard to be captured.

Comments

Log in with itch.io to leave a comment.

very good