Retrospect Posted November 15, 2022 Share Posted November 15, 2022 (edited) SUBKILL2 << FIAD file Subkiller TI BASIC.wav < wav cassette file ***** SUBKILLER ***** A simple subhunt type game. I've not seen any for TI Basic so I made one. Use keys S & D for left and right, and keys 1 & 2 for firing of up to two missiles at once. The enemy will appear at either side of the screen, and travel right or left. If you cross the enemy's path it will fire a missile of it's own at you. You score a point with every enemy killed. EDIT: All bugs now fixed, missiles don't stay on screen after used and score resets to zero with new game. Have fun playing one of the slowest subhunt games in history! Edited November 15, 2022 by Retrospect 14 1 1 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted November 15, 2022 Share Posted November 15, 2022 Clean simple fun very much in line with the early days of the TI. One suggestion: I would recommend changing the assignment of the left/right keys from S/D to maybe K/L so that the player's hands are not cramped hovering over both the 1/2 keys and the S/D keys as you frequently have to fire a missile and immediately get out of the way. That wave file by the way is so nostalgic! I now have the urge to go and load up a few cassettes! 😂 2 1 Quote Link to comment Share on other sites More sharing options...
Retrospect Posted November 15, 2022 Author Share Posted November 15, 2022 Good call @Vorticon, here's revision 2 with player definable keys SUBKILL3 < Fiad file Subkiller rev2.wav < Cassette WAV 5 1 Quote Link to comment Share on other sites More sharing options...
chris36 Posted November 16, 2022 Share Posted November 16, 2022 Nicer than this one 1 1 Quote Link to comment Share on other sites More sharing options...
Retrospect Posted November 16, 2022 Author Share Posted November 16, 2022 56 minutes ago, chris36 said: Nicer than this one Ahh yes I forgot about that one! I think that one was probably one of the C & VG magazine entries, where the artwork was perhaps misleading as to how good the game was. Mind you it was probably written by a ten year old, at that age I was still wondering how the light switched on and off in the refrigerator. 2 1 Quote Link to comment Share on other sites More sharing options...
+OLD CS1 Posted November 16, 2022 Share Posted November 16, 2022 2 hours ago, Retrospect said: Mind you it was probably written by a ten year old, at that age I was still wondering how the light switched on and off in the refrigerator. Looney Tunes taught me it was a gnome or something what turned that light on and off. I was off, then, to learn about girls. I occasionally regret not pondering the fridge light problem longer. 4 Quote Link to comment Share on other sites More sharing options...
Retrospect Posted November 16, 2022 Author Share Posted November 16, 2022 56 minutes ago, OLD CS1 said: I was off, then, to learn about girls At ten years old, I had a girl. She was a year older, my mum didn't like her so she was good to go. She kept making me follow her to where she put her cigarettes out. She lead me ashtray. 4 Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted November 16, 2022 Share Posted November 16, 2022 (edited) Looks great. Nice cloud. A more random distribution of clouds would have been nice. Would have loved to try it out, but I don't do cassette anymore. Last time was ... probably definitely in the eighties ! Could I have the BASIC listing or something ? Edited November 16, 2022 by sometimes99er 1 Quote Link to comment Share on other sites More sharing options...
ti99iuc Posted November 16, 2022 Share Posted November 16, 2022 (edited) It could be a nice concept start. It remember me the listings games published from the magazines in the eighties where you had the basic structure and the possibility to modify it to improve the game anyway I have to admit to have tried it in overdrive with classic99, this was my high score @sometimes99er the FIAD file is also present Edited November 16, 2022 by ti99iuc 1 1 Quote Link to comment Share on other sites More sharing options...
Retrospect Posted November 16, 2022 Author Share Posted November 16, 2022 (edited) 2 hours ago, sometimes99er said: Could I have the BASIC listing or something ? SUB KILLER TI BASIC.txt Yep It's a funny coincidence you mention the clouds need to be more random, that listing there , has a better more random cloud routine, as I'd thought of it myself for the 2nd revision. I've had difficulty with making the player missile go away once it's hit something. It's only when one of them hits a sub that it happens, it will stay on screen until the next submarine because I've made it do a CALL HCHAR(14,1,106,320) to try to get rid of it. Edited November 16, 2022 by Retrospect 3 Quote Link to comment Share on other sites More sharing options...
Retrospect Posted November 16, 2022 Author Share Posted November 16, 2022 1 hour ago, ti99iuc said: tried it in overdrive with classic99, this was my high score That's a really good score for playing in Overdrive. I tried it and died pretty much straight away 2 Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted November 16, 2022 Share Posted November 16, 2022 2 hours ago, ti99iuc said: the FIAD file is also present Oops, my fault. 😕 Quote Link to comment Share on other sites More sharing options...
Willsy Posted November 16, 2022 Share Posted November 16, 2022 Just a quick nit-pick looking at your code... Hope you don't mind! In the fire routine you have this: 4400 IF F1=1 THEN 4405 ELSE 4499 4405 4405 AA=A1 ... ... 4499 RETURN In other words, you want to take the jump to 4499 when F1 is not equal to 1, otherwise you want to just continue. So just say that to the computer and it will do it! 4400 IF F1<>1 THEN 4499 So by inverting the IF condition we make a nice little optimisation - less code, and therefore (should be) faster. There are quite a few other places where you can make the same optimisation (e.g. line 4600, 4700, 4800, 4900, 4905, 4910, 5000, 31100, 31105, 31150, 31155, 31161). Also, you could combine IFs in some places into a single IF statement, which would be shorter, and potentially faster: Example: 31150 IF F2=1 THEN 31155 ELSE 31199 31155 IF E=1 THEN 31160 ELSE 31199 31160 CALL GCHAR(A2,A4,CH) ... ... ... 31199 RETURN Another way of looking at this is to say "If F2 is not 1, and E is not 1, then just return" You could write as follows: 31150 IF (F2<>1)*(E<>1) THEN 31199 31160 CALL GCHAR(A2,A4,CH) ... ... ... 31199 RETURN These optimisations might not make any noticeable difference, but it just jumped out at me when I was reading the code! 2 Quote Link to comment Share on other sites More sharing options...
Switch1995 Posted November 16, 2022 Share Posted November 16, 2022 6 minutes ago, Willsy said: IF (F2<>1)*(E<>1) THEN 31199 Can this be compiled in XB256? Quote Link to comment Share on other sites More sharing options...
Willsy Posted November 16, 2022 Share Posted November 16, 2022 Dunno! Quote Link to comment Share on other sites More sharing options...
+TheBF Posted November 16, 2022 Share Posted November 16, 2022 2 hours ago, Willsy said: Just a quick nit-pick looking at your code... Hope you don't mind! In the fire routine you have this: 4400 IF F1=1 THEN 4405 ELSE 4499 4405 4405 AA=A1 ... ... 4499 RETURN In other words, you want to take the jump to 4499 when F1 is not equal to 1, otherwise you want to just continue. So just say that to the computer and it will do it! 4400 IF F1<>1 THEN 4499 So by inverting the IF condition we make a nice little optimisation - less code, and therefore (should be) faster. There are quite a few other places where you can make the same optimisation (e.g. line 4600, 4700, 4800, 4900, 4905, 4910, 5000, 31100, 31105, 31150, 31155, 31161). Also, you could combine IFs in some places into a single IF statement, which would be shorter, and potentially faster: Example: 31150 IF F2=1 THEN 31155 ELSE 31199 31155 IF E=1 THEN 31160 ELSE 31199 31160 CALL GCHAR(A2,A4,CH) ... ... ... 31199 RETURN Another way of looking at this is to say "If F2 is not 1, and E is not 1, then just return" You could write as follows: 31150 IF (F2<>1)*(E<>1) THEN 31199 31160 CALL GCHAR(A2,A4,CH) ... ... ... 31199 RETURN These optimisations might not make any noticeable difference, but it just jumped out at me when I was reading the code! Here here! In a language like BASIC, where you can jump anywhere, ELSE can be avoided most of the time using your thinking. 1 Quote Link to comment Share on other sites More sharing options...
+OLD CS1 Posted November 16, 2022 Share Posted November 16, 2022 8 hours ago, Switch1995 said: Can this be compiled in XB256? Yes, but if you are going to use XB you would use AND and OR, anyway, plus multiple statement lines, &c. As @Retrospect is a prolific XB256 programmer, I expect this BASIC project was meant to be a BASIC project without the corruptions of XB or compilation. 6 hours ago, TheBF said: Here here! In a language like BASIC, where you can jump anywhere, ELSE can be avoided most of the time using your thinking. Most of the time. ELSE does have its place. I sometimes use it in my programs to book-end a section which would otherwise end with a GOTO, or needs to return to a certain point in a test, and such. In XB, a statement such as "IF condition THEN line ELSE RETURN" is useful, too, where line is a calculation within the subroutine and condition is the subroutine non-exit condition. I also like using FOR/NEXT loops and manipulating the counter variable to control when the loop exits. I can do this for tracking players, tracking scores, &c. The computer performs an implicit IF/THEN for me. 4 Quote Link to comment Share on other sites More sharing options...
Cheung Posted November 16, 2022 Share Posted November 16, 2022 (edited) I took a brief look at the code for this and there seems to be some things that might speed up the game a bit. I noticed that you have multiple calls to CALL KEY to check for user input. I was thinking that a single call to CALL KEY in the game loop would be a better implementation? So the single CALL KEY would check the values of the key pressed and then perform the move left/right/fire action based on the key code instead of a CALL KEY for each. It might be faster to check for collisions based on the coordinates of the torpedoes and ships instead of using CALL GCHAR. Where you have GOTO LINE_THAT_RETURNS it should be a little faster to just RETURN instead of jumping to a new line and then returning. Collision detection should only be performed when the torpedo is on the same Y axis as the ship/sub. So in addition to jumping out with 31100 IF F1<1 OR E<1 OR FY>Y THEN RETURN And have a separate GOSUB for each collision detection. Edited November 16, 2022 by Cheung Quote Link to comment Share on other sites More sharing options...
Cheung Posted November 17, 2022 Share Posted November 17, 2022 (edited) I went ahead and took a stab at making things a little faster. It's been a while since I've done any plain old TI BASIC programming, so I didn't remember that the conditional statements were so limited. I was able to get around not using OR or AND with some old fashioned math. Any who, it's a little bit faster but still not blistering speed Subkiller.txt Edited November 17, 2022 by Cheung 1 Quote Link to comment Share on other sites More sharing options...
+OLD CS1 Posted November 17, 2022 Share Posted November 17, 2022 @Cheung I think I should point out that, before line 1060 in your listing, you misspelled "color". Also, this line 3010 K = ABS(((LM=K)*1)+((RM=K)*2)+((FI1=K)*3)+((FI2=K)*4)) Can also be optimized without ABS (which is slow) as 3010 K = -(LM=K)-(RM=K)*2-(FI1=K)*3-(FI2=K)*4 Interesting comparison order you used. I would normally compare the variable to the constant, i.e. K=FI2 Also, the key press detection might be sped up a little by having a string variable (constant) which holds the expected keys, then use POS with your ON-GOSUB. 10 CALL CLEAR 11 PRINT "DEFINE YOUR CONTROLS"::: 12 INPUT "KEY FOR LEFT MOVE ":Z$ 13 K$=Z$ 14 INPUT "KEY FOR RIGHT MOVE ":Z$ 15 K$=K$&Z$ 16 INPUT "KEY FOR FIRE 1 ":Z$ 17 K$=K$&Z$ 18 INPUT "KEY FOR FIRE 2 ":Z$ 19 K$=K$&Z$ REM MORE OPTIMZATIONS POSSIBLE ABOVE REM 1...2...SKIP A FEW... 3010 K=POS(K$,CHR$(K),1) 3020 IF K=0 THEN 3040 3030 ON K GOSUB 4100,4200,4300,4500 NOTE: I updated to fix a bounds-checking problem. I ain't happy with my solution, now... needs more... finesse. 1 Quote Link to comment Share on other sites More sharing options...
Retrospect Posted November 17, 2022 Author Share Posted November 17, 2022 25 minutes ago, Cheung said: with some old fashioned math Thankyou I do appreciate that, because it's all too apparent when i ever do release my source codes that Math is not one of my strongest points. In fact I do all I can to avoid it. haha! 1 1 Quote Link to comment Share on other sites More sharing options...
Cheung Posted November 17, 2022 Share Posted November 17, 2022 (edited) 30 minutes ago, Retrospect said: Thankyou I do appreciate that, because it's all too apparent when i ever do release my source codes that Math is not one of my strongest points. In fact I do all I can to avoid it. haha! I updated the order that the subroutines are called in this latest edit, shouldn't make much difference but every little bit helps with the TI. Subkiller.txt Edited November 17, 2022 by Cheung 1 Quote Link to comment Share on other sites More sharing options...
Cheung Posted November 17, 2022 Share Posted November 17, 2022 32 minutes ago, OLD CS1 said: Also, the key press detection might be sped up a little by having a string variable (constant) which holds the expected keys, then use POS with your ON-GOSUB. I added OLD CS1's changes to the updated source and it seems a little more responsive Subkiller.txt 1 Quote Link to comment Share on other sites More sharing options...
Cheung Posted November 17, 2022 Share Posted November 17, 2022 I was able to get it running and compiled on XB256 with some minor changes to the PRINT and INPUT statements. needless to say, the compiled version is way too fast to play. If I have time later this evening, I'll try to get it working correctly when compiled. 1 Quote Link to comment Share on other sites More sharing options...
Retrospect Posted November 17, 2022 Author Share Posted November 17, 2022 2 hours ago, Cheung said: I was able to get it running and compiled on XB256 with some minor changes to the PRINT and INPUT statements. needless to say, the compiled version is way too fast to play. If I have time later this evening, I'll try to get it working correctly when compiled. If I was compiling it, I would have a set of variables used as timers. For example, for the player movement, have it ignore the joystick completely unless C1 equals 4 .... ie- C1=C1+1 :: IF C1>3 THEN ..... and set C1 back to nill. For the submarines movement, the same, C2 used as a timer for those ... and the missiles too would need timers unless you wanted those to be brutally fast. 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.