So I have a love for old PC games. Maybe because it grew up with them and it is also how I learned to program. While the modern games are very nice with all the eye candy, there is just something about having to type activity in your pc to progress a game that just works for me.
This month I am taking on a larger conversion that I ever have when it comes to VERY old code. Some things to note about the exerpt code below, is that my PERSONAL theory on why it is such a mess, is because back in the 70's (and before) there really was not much of a way to distro your programs. You were really just punching in these games SO YOU COULD play. And as such, the devs at the time, (including yourself when you start programing) wanted to make sure that you could not figure out the game while you were typing it in.
Secondly, many computers back then were limited to 1 or 2 character variables. Me personally, I learned with a TIMEX SINCLAIR (2K RAM non MB OR GB 2,000 characters was it!!!) Then I went to the tandy deskmate (One of the FIRST windows - I think GEO WORKS CAME UP NEXT), THEN bypassed the comodore and went with the COLOR COMPUTER I,II, III . OK I digress
'// FROM LINE # 4020 ALSO
3810 GOTO 1380 ' *** M A I N L O O P
3860 GOTO 1380 ' *** M A I N L O O P
'//FROM 4010,4060, 4110, 4270, 4290
3950 GOTO 1380 ' *** M A I N L O O P
3990 GOTO 1380 ' *** M A I N L O O P
'// FROM 4360
4080 IF fnd
(B1
) > fnd
(B
) THEN 3960
4120 R9 = h
4130 B9 = B1
4150 R9 = R
4160 B9 = B1
'// FROM 4200
4300 R9 = R
4310 B9 = B1
4330 R9 = R
4340 B9 = B1
4380 IF fnd
(B1
) > fnd
(B
) THEN 3960
Normally you can almost, in your head, when converting an old "typed" game from a bookm pretty much convert it to QB64 pretty easy, since they are at most maybe 50 - 200 lines of code and very easy to follow. This particular one is almost a 1,000 lines of code incremented by 10.
- First thing I do, when I run across something this big, i just type it in exactly as shown in the book. I do this for a couple reasons, to get to understand the vars, and various chucks that seem to repeat, qb64 does a wonderful job of running almost any game you copy over.
- once the game is typed in - I, of course, play it LOL. So I can see the flow much better
- Once I have a basic (no pun) understanding of the program, I go through it and do a SEARCH AND CHANGE for variable I know what they are and change them to human readable variable - example the var "P". when I find that it means ships power, I will probably change all the P's to "shipsPower", and continue for every var I am pretty sure what they are.
- the "ON GOTO/GOSUB" routines become very easy to deal with. I change those to SELECT CASE and thin for each var, I make a sub for it instead of putting the routine inside the SELECT CASE. What I mean is, instead of CASE x: [ DO several lines of code for shooting an arrow] I will have it go to SUB shoot_arrow()
- The main game loop I shove into a DO LOOP UNTIL GAMEOVER.
Now this is very abbreviated version of what I do, but might help someone who likes the old games and wants to play them. Yes you can directly just type the game into QB64 and it will play fine, but later you will find it is NOT readable LOL. We call that "READ-ONCE-CODE"
At the time of this writing, the above code is a mystery to me as to what it does. I have a general idea, but the actual mechanism of the variables and what thye apply to is a mystery.
This is a STAR TREK game I have never seen before and I want to play it. No (text) graphics like all the standard clones of the 70's and 80's this is like ELIZA meets STAR TREK. These games in here have some of the most horrifying spaghetti code I have ever seen. Makes DAVID H. AHL code actually readable LOL
https://www.amazon.com/Tested-Ready-Run-Programs-BASIC/dp/0830610855/ref=sr_1_1?keywords=24+tested+ready+to+run+game+programs+in+basic&qid=1560093358&s=gateway&sr=8-1