So you want to be a programmer


Welcome to my humble little QB64 game programming tutorial. I'm thrilled that you have stopped by.

The first half of this tutorial was designed for the beginner to programming. It will walk you through the basic concepts and terminology of programming as well as teach the core QB64 command set along the way. The second half of the tutorial gets into the more powerful command set that QB64 offers and how to incorporate them into game programming techniques. The following suggestions will help you get the most from this course.

Type, Type, Type

Type the code examples in by hand. Repetitive coding through the keyboard will help you get a "feel" for source code. There are certain constructs that commands require such as parenthesis, commas, quotation marks, and symbols that are going to feel strange typing in at first. Only through the repetition of typing these commands in over and over will you start to develop the muscle memory for coding. When I started coding back in the early 80's the most common way to learn coding was though books and magazine articles that contained source code listings. Typing those listings in over and over again definitely helps.

Ask Questions

The QB64PE forum is full of knowledgeable people willing to answer your questions. Don't hesitate to ask a question because you feel it's dumb. There are no dumb questions ... we all were beginners at one time. Go over to the forum now, create an account, and say "hi". Everyone there is very friendly and helpful.

Don't Give Up!

You are not going to write awesome code at first so don't set your expectations too high. It takes time, patience, and persistence to learn how to code fluently. I've been dabbling in programming for 40 years and I still learn better ways of coding all the time.

Be Curious

I was a high school computer science teacher for 18 years. During that time I taught Visual Basic, C#, PHP, WScript, VBScript, Python, and QB64. Regardless of the language being presented I noticed one common trait amongst my students that went on to become successful programmers ... curiosity. If you find programming and computers in general fascinating and have a sincere desire to learn their inner secrets then you will do fine.

Again, welcome to my little corner of the web. Happy coding!

Terry Ritchie

About the Author (for the curious)

I was bit by the programming bug at the age of 12 in 1980 when my father borrowed a friend's TRS-80 Model I for a few weeks. It had a few simple games that could be loaded from cassette tape like Race Car (control a character inside a scrolling road) and Archer (shoot an arrow through the air by supplying the angle and velocity). But when I discovered the LIST command I could see the code! I was fascinated!

I begged my father to buy a computer when he had to return his friend's and to my surprise he brought home a TRS-80 Model III. Woohoo! It included the usual manuals that came with those systems and he purchased a book, Business Programs for the TRS-80 Model I/III, as well. It was full of dry and boring programs but I didn't care. I hunt-and-peck typed every one of those programs in and changing things afterwards to see what would happen. Within a month I wrote my very first program, Interview, that asked the user a series of questions and then came up with a response as to what type of person it thought you were. My friend's couldn't understand why I wanted to sit in front of that computer and type instead of hitting the hill in the back yard to go sledding. That business programming book is probably the reason I programmed nothing but utility software for years.

A few years later we upgraded to the TRS-80 Color Computer 2 and this thing had color, easy to program sound, and diskette drives! I made some early attempts at games with this machine but could never really get the hang of it. My father is a HAM radio operator and HAMs were connecting their computer systems through the air with something called CW, RTTY, and later Packet Radio. Bulletin board software would interface with the radios and over the course of two years I had written a custom bulletin board program that needed four diskette drives to run. It could switch between different radio frequencies (2 meter and 440) for short and long distance message forwarding. That was a blast! HAMs had a fully working "Internet" back in the early 80's all done through radio waves. I eventually got my HAM ticket, KC8EYT.

Now comes the strange part. I was a very smart kid. I taught myself programming, classically trained in violin since the 5th grade, and could repair almost anything electronic. I was the typical "nerd" but I was a big kid. The high school football coach (who was also a retired Colonel in the Marine Corps, we'll get to that later) constantly tried to get me to join the team but I had zero interest in sports. I performed very poorly in school however. My report card was full of As and Fs. If I liked the class I got an A, if I didn't I got an F. Of course college was probably not in my future so I joined the Marine Corps the summer before my senior year. I needed to graduate early in December to make the date of my departure. This probably wasn't going to happen given my grades. However, the high school football coach, the former Marine, took me aside one day and ordered me to report after school every day to his office for personal tutoring. He helped me to get my grades high enough to graduate. I am forever thankful for his help to this day. It was many years later that I was diagnosed as having Autism on the Asperger's spectrum. Nothing about this was known back in the 80's.

So there I am, it's 1986 and I'm an autistic, computer programming, violin playing nerd in the United States Marine Corps. I damn near aced the military ASVAB entrance test so I had my choice of career paths. I chose to become an Aviation Electronics (Avionics) Technician and was assigned to work on Grumman A6E TRAM Intruder all weather bombers. We put those bad boys to the test during Desert Shield and Desert Storm in the Persian Gulf. My love of programming never left me though. During tours in Japan and elsewhere I would lug along a Color Computer, diskette drive, and small portable TV everywhere I went. During my times aboard the USS John F. Kennedy CV67 aircraft carrier there was simply no time for anything other than working since we worked 12 on, 12 off, for 7 days a week (and considered one of the most dangerous jobs in the world). Besides, the living space given to each marine was quite small (6 of us had to squeeze into that little area). During Desert Storm this was also not possible so I made friends with the guys in the admin department and used their computers during their off hours teaching myself x86 Assembler and Turbo Pascal during the long 6 months waiting around in the Desert Shield stage. This was my first experience with X86 computers and I was hooked. I loved DOS.

Upon returning to the states I picked up a Tandy 1000EX computer system at a local pawn shop and continued my X86 adventures. My wife and I loved to play Connect 4 but one day while playing we ran out of checkers. My cats had a habit of carrying them off and my son, 2 at the time, probably had a hand in their disappearance as well. So I decided to program the game on my 1000EX. A month later and I was finished. My first game! Back then computer magazines were all the rage and one named PCM was dedicated to the Radio Shack x86 series of computers. I decided to send my Connect 4 clone to them, named Link Four, and they published it in the April 1992 issue of their magazine! You can download a copy of it here along with PDF files of the original magazine article. The .BAS code will not run in QB64 without heavy modification. Tandy 1000 computers offered SCREEN modes from 3 to 6 and I used one of those for the game. You can use the Tand-EM or PCem emulator if you want to see the code in action. Here's a few screen shots of the me playing against the computer.

Link Four: My first game!

Link Four: The computer is tricky! (black)

I wrote the game in Tandy Basic 2.1 (A modified version of GWBasic for Tandy systems). Early Tandy 1000 systems were basically clones of the IBM PCjr offering SCREEN modes not found in standard IBM and compatible systems. They could also play 3 voice sound again something standard IBM systems couldn't do.

April 1992 also happened to be the end of my six year enlistment in the Marine Corps. Soon after I was hired as a Clarion database programmer thanks in part to the freshly minted copy of the magazine in hand. I was tasked with writing database software for my local municipality to replace the aging IBM mainframes they were still using. I then moved on to work as a PC technician for a local computer store and eventually in 1995 was hired as a systems administrator for a local plastics corporation. My tasks included writing custom software for the company, maintaining the Novell network (which I eventually migrated to NT), PC repair and upgrade technician, some light PLC programming, MasterCam programming for the CNC router, and 3D model rendering using Truespace.

In early 2000 I started getting calls from a computer science teacher at the local technical high school. They needed another computer science teacher and wanted me to come in for an interview. By this time I was pretty well known in my area for being the "fix-it" guy for everything computer related. This reputation caught the attention of the local school. At first I told them I was not interested, "Me, a teacher?!" But they just kept calling until I finally agreed to come in and look around. The school was amazing! They had a CAD/CAM department, a PLC department, a computer science department (CISCO and CompTIA associated), automotive, medical, and criminal justice. Everything was new and state of the art. I was starting to see this as a possible future. I told them there was one problem though, I did not have a college degree. They told me if I was willing to attend a two year college teaching program during my first two years of teaching that could be worked around. I interviewed, got the job, and taught for 18 years afterward.

Part of my curriculum was to teach a programming language. At first the local college was utilized and had one of their professors teach that portion of the curriculum which also gave the students college credit as a bonus. I took courses in PHP, VisualBasic .NET, Wscript, Cscript, and COBOL of all things. Eventually I started teaching PHP and other scripting languages leaving VisualBasic to the college professor. Scripting is a snooze fest so I decided to spice it up and introduce game programming. I wrote a game once, how hard could it be. LOL This started me on the path to seriously studying game programming techniques.

I utilized QB64 in the classroom for a few years until the school forced me switch to Python around 2015. I liked using QB64 because the students were forced to create everything from scratch which in my opinion makes for a better programmer. Python is a perfectly good language but to do anything useful it relies too much on libraries leaving the budding programmer to ponder what the library is doing rather than knowing exactly what is going on "under the hood" so to speak. Besides, this was a nine week introductory course to programming. It's not like I was teaching programming to be their only career option. It was meant to be an exploration into one of the possibilities they could choose when entering the IT field. QB64 was fun and easy for students to learn in such a short period of time but still make a few games along the way. Python, not so much, even when utilizing the PyGame library. In 2018 I decided to take my teaching hat off as common core was just ruining everything. Test scores and memorizing test answers seem to be the only important thing now. No time for anything else, especially fun and engaging curriculum.

Since then I've been finding things to keep me busy. The occasional networking job here, programming job there, and eBay. I was surprised to find a thriving community in the vintage computer enthusiast arena so I've been busy refurbishing and upgrading systems for them as well as a few local companies that still rely on vintage software and systems. I did look around for another IT job but was unsuccessful (ageism is a real problem in the IT field that needs to be solved). If your resume isn't full of certification alphabet soup don't even bother. You'll need all that to get by the resume' bots that now infest the hiring system.

I've been maintaining and updating the QB64 game tutorial since 2013 and have heard from many people, perhaps in the many hundreds by now, how the tutorial helped them get back into the programming they loved as a kid. People from all over the world have contacted me. That kind of response is always good to hear and motivates me to keep the tutorial going for many years to come. I don't care what nationality you hail from or your country's political status. All are welcome here.

If you have read to this point I thank you once again for visiting my little slice of the Internet.


Join the QB64 forum and become part of the fun! Stop in and say "hi". No one will ever look down on the code or questions you post there. We were all beginners at one time.