Jump to content

Photo

Demolish - v1.1 release w/bug (can you help find it?)


33 replies to this topic

#26 matthew180 OFFLINE  

matthew180

    River Patroller

  • 2,441 posts
  • Location:Castaic, California

Posted Sun Oct 22, 2017 5:23 PM

 

I was able to score above zero after a couple of tries.  In general I like the game, but have a couple suggestions for improvement.
 
1 - The keyboard response is not great.  Sometimes it misses keystrokes; sometimes I overshoot the square where I intend to stop.  I suspect the reason for this is the use of a delay loop or CALL LINK("DELAY") to slow the response down to a playable level.  One side effect of this is missed keystrokes because the program is pausing instead of constantly scanning the keyboard. Something like the bit of code below should fix this:
 
10 FOR I=1 TO 50
20 CALL KEY(0,K,S)
30 IF S=0 THEN 20 :: IF S=1 THEN 50
40 NEXT I
50 PRINT "KEY" :: GOTO 10
 
2 - I have a hard time seeing the cursor in the playing field.  Maybe it would be more visible if you made it hollow or with an X in the middle.
 
Other than that, great game!
 
The 50 in line 10 is a guesstimate of a good value for the compiler.  Try 5 for testing in XB.

 

 

Delay loops in general are a bad idea, especially in games, and cause all kinds of undesirable side effects.  Does the BASIC Compiler expose the VDP interrupt or a timer to the programmer?  If not, it would not be that hard to write a simple assembly routine to load via CALL LINK that will wait for the interrupt.  Then you could set up a proper game-loop and get a good handle on the user input (which would be useful for any game and worth the effort IMO).



#27 InfernalKeith OFFLINE  

InfernalKeith

    Dragonstomper

  • Topic Starter
  • 699 posts
  • Location:Toledo, OH

Posted Tue Dec 19, 2017 2:30 PM

10 REM  LAST COMPILE 12-19-17     
15 REM  LAST CODE EDIT 12-19-17   
50 RANDOMIZE
55 HIGHN$="KEITH"
56 HIGH=1
60 CALL SCREEN(4)
62 LEVEL=1
65 SCORE=0
67 BLEFT=0
68 FLIPFLAG=100
69 FLIP=0
70 GOSUB 22000
80 GOSUB 1000
85 LEV$=""
90 IF LEVEL>9 THEN 94
92 LEV$="0"
94 LEV$=LEV$&STR$(LEVEL)
95 PRINT "LEV ";LEV$;"    DEMOLISH    FLIP N"
100 FOR X=1 TO 22
110 FOR Y=1 TO 32
120 CALL HCHAR(X,Y,96+(INT(RND*6)*8))
130 NEXT Y
140 NEXT X
150 CALL SOUND(99,1047,0,1109,5)
155 CALL SOUND(1,1047,30)
160 CALL SOUND(500,1047,0,1109,2)
170 CURX=1
180 CURY=1
183 TIME=30001
184 TICK=30000
185 LOCK=0
187 GOSUB 20200
190 CALL GCHAR(CURX,CURY,Z)
200 CALL HCHAR(CURX,CURY,Z+1)
210 CALL KEY(0,K,S)
214 IF S<>0 THEN 230
215 TIME=TIME-1
217 IF TIME=-30000 THEN 2000
218 IF TIME>TICK THEN 220
219 GOSUB 2100
220 GOTO 210
230 IF K<>11 THEN 290
245 GOSUB 20100
250 CALL GCHAR(CURX,CURY,Z)
260 CALL HCHAR(CURX,CURY,Z-1)
270 CURX=CURX-1
275 IF CURX<>0 THEN 190
277 CURX=22
280 GOTO 190
290 IF K<>10 THEN 350
305 GOSUB 20100
310 CALL GCHAR(CURX,CURY,Z)
320 CALL HCHAR(CURX,CURY,Z-1)
330 CURX=CURX+1
335 IF CURX<>23 THEN 190
337 CURX=1
340 GOTO 190
350 IF K<>8 THEN 410
370 GOSUB 20100
380 CALL GCHAR(CURX,CURY,Z)
390 CALL HCHAR(CURX,CURY,Z-1)
400 CURY=CURY-1
402 IF CURY<>0 THEN 190
404 CURY=32
405 GOTO 190
410 IF K<>9 THEN 470
430 GOSUB 20100
440 CALL GCHAR(CURX,CURY,Z)
450 CALL HCHAR(CURX,CURY,Z-1)
460 CURY=CURY+1
462 IF CURY<>33 THEN 190
464 CURY=1
465 GOTO 190
470 IF K<>32 THEN 590
475 CALL GCHAR(CURX,CURY,Z)
477 IF Z<34 THEN 550
480 IF LOCK<>0 THEN 550
490 LOCK=Z
500 CALL SOUND(1,880,0)
510 CALL SOUND(1,440,0)
520 CALL SOUND(100,-5,0)
530 CALL HCHAR(CURX,CURY,145)
535 BFLAG=BFLAG+1
540 GOTO 210
550 CALL GCHAR(CURX,CURY,Z)
560 IF Z<>LOCK THEN 570
565 GOSUB 21000
567 IF FLAG=1 THEN 500
570 CALL SOUND(100,110,0)
580 GOTO 210
590 IF K<>80 THEN 690
595 CALL GCHAR(CURX,CURY,T)
597 CALL HCHAR(CURX,CURY,T-1)
600 FOR X=1 TO 22
610 FOR Y=1 TO 32
620 CALL GCHAR(X,Y,T)
630 IF T<144 THEN 650
640 CALL HCHAR(X,Y,LOCK-1)
645 CALL SOUND(20,1175,0)
650 NEXT Y
660 NEXT X
670 LOCK=0
675 CALL SOUND(20,1319,0)
676 CALL SOUND(20,1568,0)
677 CALL SOUND(60,1760,0)
678 BFLAG=0
680 GOTO 190
690 IF K<>67 THEN 860
693 IF BFLAG<3 THEN 570
695 CALL GCHAR(CURX,CURY,Z)
697 CALL HCHAR(CURX,CURY,Z-1)
700 FOR X=22 TO 1 STEP-1
710 FOR Y=1 TO 32
720 CALL GCHAR(X,Y,T)
730 IF T<>144 THEN 820
740 SCORE=SCORE+BFLAG
750 CALL SOUND(50,-6,0)
760 CALL SOUND(75,-7,0)
770 FOR Z=X TO 2 STEP-1
780 CALL GCHAR(Z-1,Y,W)
790 CALL HCHAR(Z,Y,W)
800 NEXT Z
810 CALL HCHAR(1,Y,32)
815 GOTO 720
820 NEXT Y
830 NEXT X
840 LOCK=0
845 BFLAG=0
846 GOSUB 3000
847 GOSUB 20200
848 GOSUB 22300
849 IF YFLAG=1 THEN 85
850 GOTO 190
860 IF K<>81 THEN 890
870 CALL CLEAR
880 PRINT "QUIT EARLY? THE ONLY THING  YOU DEMOLISHED WAS YOUR     PRIDE!"
885 STOP
890 IF K<>84 THEN 995
900 PFLAG=0
905 ISCORE=SCORE
910 FOR X=1 TO 22
920 FOR Y=1 TO 32
930 CALL GCHAR(X,Y,T)
940 IF T<34 THEN 982
950 PFLAG=1
960 CALL HCHAR(X,Y,32)
970 CALL SOUND(10,-3,0)
975 BLEFT=BLEFT+1
980 SCORE=SCORE-1
982 NEXT Y
984 NEXT X
986 CALL CLEAR
988 IF SCORE>0 THEN 992
990 SCORE=0
992 GOTO 2200
995 IF K<>70 THEN 210
997 GOTO 4000
1000 FOR X=96 TO 144 STEP 8
1010 CALL CHAR(X,"3C7E7E7E7E7E7E3C")
1020 CALL CHAR(X+1,"FF818181818181FF")
1022 CALL CHAR(X+2,"AA55AA55AA55AA55")
1025 NEXT X
1030 CALL COLOR(9,10,1)
1040 CALL COLOR(10,7,1)
1050 CALL COLOR(11,6,1)
1060 CALL COLOR(12,5,1)
1070 CALL COLOR(13,12,1)
1080 CALL COLOR(14,13,1)
1090 CALL COLOR(15,2,1)
1095 CALL CHAR(33,"FF818181818181FF")
1100 RETURN
2000 CALL SOUND(4000,1760,0)
2010 FOR X=1 TO 30
2020 CALL SOUND(-50,1760,X)
2030 NEXT X
2040 GOTO 900
2100 CALL SOUND(500,1760,0)
2105 TICK=TICK-1000
2110 S$="  TIME: "&STR$(INT(TIME/1000)+30)
2120 FOR A=1 TO LEN(S$)
2130 CALL HCHAR(24,29-A,ASC(SEG$(S$,LEN(S$)-A+1,1)))
2140 NEXT A
2150 RETURN
2200 PRINT "INITIAL SCORE: ";ISCORE:
2210 PRINT "BLOCKS REMAINING: ";BLEFT
2220 PRINT:"FINAL SCORE:";SCORE
2230 IF SCORE<=HIGH THEN 2280
2240 PRINT:"NEW HIGH SCORE THIS SESSION":
2250 PRINT "TYPE NAME AND PRESS ENTER."
2260 INPUT HIGHN$
2265 HIGH=SCORE
2270 PRINT:"CONGRATULATIONS"
2280 PRINT:"Q QUITS, ANY OTHER KEY TO   PLAY DEMOLISH AGAIN."
2290 CALL KEY(0,K,S)
2300 IF S=0 THEN 2290
2310 IF K=81 THEN 2340
2320 GOTO 60
2340 CALL CLEAR
2350 PRINT "THANKS FOR PLAYING DEMOLISH!":" VISIT US AT ORPHANTECH.COM"
2360 END
3000 IF SCORE<FLIPFLAG THEN 3040
3005 IF FLIP=1 THEN 3030
3010 FLIP=1
3017 CALL HCHAR(23,30,89)
3020 CALL SOUND(40,1175,0)
3022 CALL SOUND(40,1047,0)
3024 CALL SOUND(80,1397,0)
3030 FLIPFLAG=FLIPFLAG+100
3040 RETURN
4000 IF LOCK<>0 THEN 20000
4010 IF FLIP=0 THEN 20000
4020 CALL GCHAR(CURX,CURY,X)
4025 IF X<34 THEN 20000
4030 CALL HCHAR(CURX,CURY,X+1)
4040 FOR Y=1 TO 2
4050 CALL SOUND(40,440,0)
4060 CALL SOUND(40,494,0)
4070 CALL SOUND(40,698,0)
4080 CALL SOUND(40,466,0)
4090 NEXT Y
4100 A$="SELECT TILE 2 FLIP-Z CANCELS"
4110 FOR Z=1 TO 28
4120 CALL HCHAR(24,Z+2,ASC(SEG$(A$,Z,1)))
4130 NEXT Z
4140 CALL KEY(0,K,S)
4150 IF S=0 THEN 4140
4170 IF K<>90 THEN 4180
4172 CALL GCHAR(CURX,CURY,X)
4173 CALL HCHAR(24,1,32,32)
4174 CALL HCHAR(CURX,CURY,X-1)
4175 GOSUB 2110
4176 GOSUB 20200
4177 GOTO 20000
4180 IF(K<8)+(K>11)<>0 THEN 4140
4190 ON K-7 GOSUB 4210,4250,4290,4330
4200 GOTO 4370
4210 FLIPY=CURY-1
4215 FLIPX=CURX
4220 IF FLIPY>0 THEN 4240
4230 FLIPY=32
4240 RETURN
4250 FLIPY=CURY+1
4255 FLIPX=CURX
4260 IF FLIPY<33 THEN 4280
4270 FLIPY=1
4280 RETURN
4290 FLIPX=CURX+1
4295 FLIPY=CURY
4300 IF FLIPX<23 THEN 4320
4310 FLIPX=1
4320 RETURN
4330 FLIPX=CURX-1
4335 FLIPY=CURY
4340 IF FLIPX>0 THEN 4360
4350 FLIPX=22
4360 RETURN
4370 CALL GCHAR(FLIPX,FLIPY,Y)
4375 IF Y=32 THEN 4172
4380 CALL HCHAR(FLIPX,FLIPY,Y+2)
4390 FOR Z=440 TO 1760 STEP 20
4400 CALL SOUND(10,Z,0)
4410 NEXT Z
4420 CALL HCHAR(CURX,CURY,Y+2)
4430 CALL SOUND(300,-5,0)
4440 CALL HCHAR(FLIPX,FLIPY,X+1)
4450 CALL SOUND(300,-7,0)
4460 CALL HCHAR(CURX,CURY,Y)
4470 CALL HCHAR(FLIPX,FLIPY,X-1)
4480 CALL HCHAR(23,30,78)
4490 FLIP=0
4500 FOR X=1 TO 32
4510 CALL HCHAR(24,X,32)
4520 NEXT X
4530 GOSUB 2110
4540 GOSUB 20200
4550 GOTO 190
20000 CALL SOUND(100,110,0)
20010 GOTO 210
20100 FOR SS=880 TO 1880 STEP 100
20110 CALL SOUND(5,SS,0)
20120 NEXT SS
20130 RETURN
20200 S$="SCORE: "&STR$(SCORE)
20203 FOR X=1 TO LEN(S$)
20204 CALL HCHAR(24,4+X,32)
20205 NEXT X
20210 FOR X=1 TO LEN(S$)
20220 CALL HCHAR(24,4+X,ASC(SEG$(S$,X,1)))
20225 CALL SOUND(10,-3,0)
20230 NEXT X
20240 RETURN
21000 FLAG=0
21010 IF CURX=1 THEN 21040
21020 CALL GCHAR(CURX-1,CURY,T)
21030 IF T=144 THEN 21140
21040 IF CURX=22 THEN 21070
21050 CALL GCHAR(CURX+1,CURY,T)
21060 IF T=144 THEN 21140
21070 IF CURY=1 THEN 21100
21080 CALL GCHAR(CURX,CURY-1,T)
21090 IF T=144 THEN 21140
21100 IF CURY=32 THEN 21130
21110 CALL GCHAR(CURX,CURY+1,T)
21120 IF T=144 THEN 21140
21130 RETURN
21140 FLAG=1
21150 RETURN
22000 CALL CLEAR
22010 PRINT "       DEMOLISH V1.1":"   COMPILED FROM TI BASIC":"   (C) 2017 KEITH BERGMAN"
22020 PRINT "       ORPHANTECH.COM": : :
22030 PRINT "ARROW KEYS  DIRECTIONS": : :
22040 PRINT "     SPACE  SET CHARGES":"       C    DEMOLISH":"       P    CLEAR CHARGES"
22050 PRINT "       F    FLIP 2 TILES":"       Q    QUIT": :
22070 PRINT "      FIND GROUPS OF 3":"      OR MORE LIKE COLORS":"      SET CHARGES AND"
22080 PRINT "      DEMOLISH THEM...": :"HIGH SCORE: ";HIGH;" ";HIGHN$
22085 PRINT:"      PRESS ANY KEY"
22090 CALL KEY(0,K,S)
22100 IF S=0 THEN 22090
22110 CALL CLEAR
22120 RETURN
22300 YFLAG=0
22310 LCHECK=0
22320 FOR Y=1 TO 32
22330 CALL GCHAR(22,Y,Z)
22340 IF Z<>32 THEN 22360
22350 LCHECK=LCHECK+1
22360 NEXT Y
22370 IF LCHECK>=LEVEL THEN 22390
22380 RETURN
22390 CALL SOUND(2000,2000,0)
22400 PRINT "YOU DEMOLISHED YOUR WAY     THROUGH - CONGRATULATIONS"
22410 PRINT: : : : : : : : : :
22420 SCORE=SCORE+(LEVEL*1000)
22425 FLIPFLAG=FLIPFLAG+(LEVEL*1000)
22426 FLIP=0
22430 PRINT LEVEL*1000;" BONUS POINTS ADDED":
22440 PRINT "SCORE: ";SCORE
22450 PRINT: : : : : : : :
22460 PRINT "PRESS ANY KEY FOR NEXT LEVEL"
22470 CALL KEY(0,K,S)
22480 IF S=0 THEN 22470
22490 LEVEL=LEVEL+1
22495 YFLAG=1
22500 RETURN 

I'm hoping one of you has time to look over some code, because I'm having a helluva time with this.

 

Version 1.1 adds a level goal (clear one column all the way to the bottom of the screen, then clear two for level 2, and so on) and a "flip" option.  Every 100 points you earn the ability to flip any two tiles.  This is essential if you want to put patterns together that you can clear and get all the way to the bottom of the screen.

 

It all works fine - most of the time.  But every now and then, the main game loop seems to stop after checking CALL KEY for the arrow keys and space bar.  I'll select some tiles, hit "C" to clear them, and... nothing.  The other keypress functions (Q to quit, F to flip, P to clear selected tiles) don't work either.  But all four directions and the space bar do.

 

After I move around a few times, the other keys 'come back online' and work again.

 

I'm attaching the TI BASIC listing for the newest build.  This is what I've compiled with Harry's BASIC compiler.  If anyone has time to play the game once or twice, then look over the code, I'd supremely appreciate it.  I think it's a really fun game, and I'd like to jazz up a title screen and release it and be done with it.  I hope it's some stupid simple bug that's been staring me in the face this whole time, honestly.

 

<

Attached Files



#28 InfernalKeith OFFLINE  

InfernalKeith

    Dragonstomper

  • Topic Starter
  • 699 posts
  • Location:Toledo, OH

Posted Tue Dec 19, 2017 6:47 PM

More detail: the initial CALL KEY (0,K,S) that kicks off the input loop is line 210.  The two previous lines replace the tile with the properly-colored cursor at the appropriate location.  All actions lead back to line 210, except the movement keys, which send it back to 190 to redraw the cursor.  For some reason, occasionally it just won't even accept the later options in the loop as input.  It doesn't take the input and reject them -- there'd be a warning noise if it did -- it just acts like no key was pressed.  And then after I move around (sometimes a few movements are needed) it resumes working as normal.



#29 senior_falcon ONLINE  

senior_falcon

    Stargunner

  • 1,009 posts
  • Location:Lansing, NY, USA

Posted Tue Dec 19, 2017 9:26 PM

Does this problem happen in both the BASIC and compiled versions?



#30 InfernalKeith OFFLINE  

InfernalKeith

    Dragonstomper

  • Topic Starter
  • 699 posts
  • Location:Toledo, OH

Posted Tue Dec 19, 2017 10:46 PM

Yes.  I thought it might be a vagary of compiling I couldn't control, so I did play-testing in BASIC (try that if you ever want to feel what swimming in molasses is like).  The problem exists there too.  



#31 InfernalKeith OFFLINE  

InfernalKeith

    Dragonstomper

  • Topic Starter
  • 699 posts
  • Location:Toledo, OH

Posted Sun Dec 24, 2017 1:37 PM

Bump.  Hey, if anyone wanted to get me a Christmas present, helping me find this bug would make my 2017.  I'm gonna take another whack at it tonight after the kids are in bed but I'm starting to feel like a crazy person when I look at this listing.



#32 Tursi OFFLINE  

Tursi

    River Patroller

  • 4,903 posts
  • HarmlessLion
  • Location:BUR

Posted Sun Dec 24, 2017 3:55 PM

I took a look at the code and I don't see anything. I also played through until 48 seconds remaining without seeing the bug. But, I did test out a theory. If you're using Classic99, the simulated keyboard has to guess whether you want FCTN to be down or up. If you use the PC arrow keys, and in particular if you hold them, and they're being used as arrow keys as they are for you here, sometimes FCTN gets stuck on.

 

I tested whether pressing FCTN-C triggers the "bad move" sound, and it does not.

 

You can test if this is happening -- when you are in the bad state, just press enter. Enter resets the reference counts for the meta keys and releases all of them (as a workaround for this issue). if that fixes it, then you're just facing a Classic99 issue, not a game issue. 

 

You could just use straight ESDX without FCTN?

 

And I scored 924 in that time... I started to get the hang of it. ;)



#33 senior_falcon ONLINE  

senior_falcon

    Stargunner

  • 1,009 posts
  • Location:Lansing, NY, USA

Posted Sun Dec 24, 2017 4:08 PM

I was about to suggest making line 210 CALL KEY(3,K,S) thinking it might be some glitch in the shift lock key when Tursi posted.  He is probably right; after all who knows more about Classic99 then Tursi?  You might want to do the 3,K,S anyway just so you don't have to wonder whether the shift lock is up or down. 

 

You could try it out in Win994a or Mess to see if the problem happens there. 



#34 InfernalKeith OFFLINE  

InfernalKeith

    Dragonstomper

  • Topic Starter
  • 699 posts
  • Location:Toledo, OH

Posted Mon Dec 25, 2017 1:54 AM

Holy crap, that makes so much sense!  If it thinks the subsequent keypresses are actually "FCTN C" instead of "C"... mind blown!  :)  Thank you both so much.

 

I'll switch it back to ESDX in the morning and see if that does the trick.  

 

I thought I was losing my mind.  I can't wait to work on something that isn't this game.  Final version coming soon!






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users