2k adventure

Discussion about ZX80 / ZX81 Software
Crayon21
Posts: 31
Joined: Sun Nov 04, 2018 2:33 am

Re: 2k adventure

Post by Crayon21 » Thu Nov 22, 2018 9:10 pm

I'll check the download later good sir, having thanksgiving in a bit. Enjoy your day :D

User avatar
siggi
Posts: 875
Joined: Thu May 08, 2008 9:30 am
Location: Dauernheim, Germany
Contact:

Re: 2k adventure

Post by siggi » Fri Nov 23, 2018 9:10 am

TMAOne wrote:
Thu Nov 22, 2018 8:03 pm
I started my program on a "Sinclair Diet", but I don't think I'm going to make the 2K finish line without some major loss of functionality,
Without losing functionality a lot of bytes can be lost ;)
Replace
if condition1 then PRINT string1
if condition2 then PRINT string2
by
print string1 AND condtion1; string 2 AND condition2

Replace
GOTO 140
by
GOTO VAL "140"
Yes, the destination of a GOTO/GOSUB may be a numeric expression. You could also GOTO SIN PI ;)

And for the final version (keep a "full" version" as backup): delete the variable initialization inside the BASIC program an hold only the initialized variables in ram:
- delete line 20
- GOTO 1000 (initialize variables)
- delete lines 1000 ff
- GOTO 0 (save the program and initialized variables in RAM)

Later, if you want to restart OR MODIFY the final version: never use CLEAR or RUN (to keep the variables valid).
If you forget that: go back to the full version (backup)

Siggi
My ZX81 web-server: online since 2007
http://zx81-siggi.endoftheinternet.org/index.html

User avatar
TMAOne
Posts: 157
Joined: Thu Aug 16, 2012 6:56 pm
Location: Waterloo, Ontario, Canada

Re: 2k adventure

Post by TMAOne » Fri Nov 23, 2018 9:37 pm

Thank-you Siggi. That helped a lot!

Success. It took some more crash dieting, but it now fits in an un-expanded Timex-Sinclair 1000 with the core game intact.

Code: Select all

  10 SAVE "ADV2k"
  60 PRINT "YOU ARE IN ";R$(R),"THERE IS ";O$(R),,,"YOU CAN GO:",,(N$ AND R<V3),,(S$ AND R<V4),,(E$ AND R=V4),,(W$ AND R=V2)
 100 INPUT A$
 110 CLS
 120 IF R<>V1 OR L=V1 OR A$<>"LAMP" THEN GOTO VAL "160"
 130 PRINT "YOU HAVE ";O$(R),"AND CAN BARELY SEE ";O$(V2);"TO THE ";N$,,,,
 140 LET L=V1
 150 LET O$(R)=Z$
 160 IF R<>V2 OR S=V1 OR A$<>"SWORD" THEN GOTO VAL "200"
 170 PRINT "YOU CLUTCH ";O$(R),,,
 180 LET S=V1
 190 LET O$(R)=Z$
 200 IF R<>V3 OR T=V1 OR A$<>"TREASURE" THEN GOTO VAL "240"
 210 PRINT "YOU TAKE ";O$(R),,,
 220 LET T=V1
 230 LET O$(V3)=Z$
 240 IF R<>V2 OR A$<>W$ OR P=V1 OR L=V1 THEN GOTO VAL "270"
 250 PRINT "IN THE DARK YOU CANT SEE ",O$(V4),," AND YOU ARE INJURED",,,
 260 LET P=V1
 270 IF A$=S$ AND R=V1 THEN GOTO VAL "330"
 280 IF A$=N$ AND R<V3 THEN LET R=R+V1
 290 IF A$=S$ AND R<V4 THEN LET R=R-V1
 300 IF A$=W$ AND R=V2 THEN LET R=V4
 310 IF A$=E$ AND R=V4 THEN LET R=V2
 320 GOTO VAL "30"
 330 PRINT "YOU ESCAPE THE CAVE",,,
 350 PRINT "YOU HAVE THE TREASURE" AND T=V1;AT V3,V0;"YOU WIELD THE MAGIC SWORD" AND S=V1;AT VAL "5",V0;"BUT YOU ARE INJURED" AND P=V1
ADV2K.p
(1.91 KiB) Downloaded 10 times

Another trick I found useful is to use the BASIC keyword within strings whenever possible. I'm sure you guys know this,... but for those that don't, the keyword AND for instance, takes up only 1 byte and gives you " AND " (space, AND, space) within your string, saving 4 bytes.

And thank-you Crayon21 for the initial idea to try to fit in 2K. I hope I haven't stolen your thunder. It's not a great game, but 2K is 2K.

Ian

Crayon21
Posts: 31
Joined: Sun Nov 04, 2018 2:33 am

Re: 2k adventure

Post by Crayon21 » Sun Nov 25, 2018 6:35 pm

it's cool. feel free to expand on it, my work on it is done :D but make sure to give me proper credit, k?

User avatar
TMAOne
Posts: 157
Joined: Thu Aug 16, 2012 6:56 pm
Location: Waterloo, Ontario, Canada

Re: 2k adventure

Post by TMAOne » Sun Nov 25, 2018 7:38 pm

I won't be expanding it. As a 2K Adventure game it was a development novelty only--a fun exercise in coding.

A full-RAM version with more rooms and features would require a redesign of some of the compromises to make to fit into 2K, and Adventure games abound in the wilds. (I think the one I posted in this thread is particularly nice, but I'm biased.)

I do credit you Crayon21 with coming up with the challenge of fitting a BASIC Adventure style game into an un-expanded TS1000. That was key for me. It was a neat idea that started me thinking in Sinclair BASIC again.

No one however, is ever going to beat that kid, (I think he was 16?) who created 1KCHESS. Just incredible,...

Keep coding Crayon21. Arrays and loops are your friends. Your game would do better with more RAM available. Cheers.

Ian

Moggy
Posts: 1704
Joined: Wed Jun 18, 2008 2:00 pm

Re: 2k adventure

Post by Moggy » Sun Nov 25, 2018 10:56 pm

TMAOne wrote:
Sun Nov 25, 2018 7:38 pm
I won't be expanding it. As a 2K Adventure game it was a development novelty only--a fun exercise in coding.

A full-RAM version with more rooms and features would require a redesign of some of the compromises to make to fit into 2K, and Adventure games abound in the wilds. (I think the one I posted in this thread is particularly nice, but I'm biased.)

I do credit you Crayon21 with coming up with the challenge of fitting a BASIC Adventure style game into an un-expanded TS1000. That was key for me. It was a neat idea that started me thinking in Sinclair BASIC again.

No one however, is ever going to beat that kid, (I think he was 16?) who created 1KCHESS. Just incredible,...

Keep coding Crayon21. Arrays and loops are your friends. Your game would do better with more RAM available. Cheers.

Ian
I'm sure David Horne was a lot older than 16 when he wrote 1k chess.

You might want to have a look at this thread about a full FIDE(castling, en passent and under-promotion) 1k chess for the 80 and 81 which is far superior to the original, innovative though it was at the time.

viewtopic.php?f=6&t=1841&p=18959&hilit= ... x81#p18959

Post Reply