A beginner's introduction to game programming
Welcome to the QB64 Tutorial!
This tutorial will focus on the Phoenix Edition version of QB64 located at https://qb64phoenix.com/forum/index.php. If you use an alternate fork of QB64 the tutorial will more than likely be just fine for your version. Please be aware that any new enhancements made to the PE version and utilized in the tutorial may not be compatible with your version. Likewise, new enhancements made to other forks of QB64 may not be covered in this tutorial.
Recent News and Updates:
04/14/23 - Joystick and Game Pad commands added to Lesson 7.
04/18/23 - Lesson 21: Advanced Controller Input added.
05/17/23 - Added two games, Octogo and Goblin's Gold, to the games list.
06/01/23 - The controller library in Lesson 21 has been updated to version 1.10.
06/03/23 - Added the statement OPTION _EXPLICIT to Lesson 2.
06/14/23 - The QB64 Phoenix Edition developers just released version 3.8.0. Read about it here.
09/17/23 - Added the _DISPLAY and _AUTODISPLAY statements to Lesson 5.
09/20/23 - Added the _LIMIT statement to Lesson 5.
09/20/23 - Lesson 22: Hardware Acceleration added.
09/29/23 - The _SETALPHA statement in Lesson 14 has been corrected to remove errors.
09/30/23 - The use of _RED, _GREEN, _BLUE, and _RGB32 has been clarified in Lesson 14.
10/01/23 - Added the RND and RANDOMIZE statements to Lesson 3.
10/01/23 - The tutorial asset file has been updated to include all new code added in past few days.
10/01/23 - Ten more games have been added to the games section.
10/08/23 - Added the _SAVEIMAGE statement to Lesson 13.
10/10/23 - Added a more in depth discussion of the CLS statement in Lesson 4.
10/10/23 - Added the SLEEP statement to Lesson 7.
10/26/23 - Replaced all embedded code listings with standard HTML listings. Google sold Google Sites to SquareSpace. Over the past month embedded items in the tutorial have been intermittent where the code listings were not showing up. This has been corrected by converting the code listings to HTML. Also, all code listings now have a header showing where the source code can be found in the tutorial asset file making it easier to identify.
10/26/23 - The ASC statement in Lesson 9 has an optional parameter (position%) explained that was missing.
11/02/23 - All code listings can now be downloaded individually by clicking on the header above them.
11/21/23 - Database (Random) file commands and a sample database program have been added to Lesson 11.
11/24/23 - Local vs Global variables has been corrected in Lesson 6. Some of the variables were labeled incorrectly.
01/03/24 - The QB64 Phoenix Edition developers just released version 3.11.0. Read about it here.
What is QB64?
QB64 is a modern version of Microsoft's QuickBasic from the 1980's and 1990's. It has the same familiar, albeit enhanced, integrated development environment (IDE) from the original version. QB64 is nearly 100% compatible with source code written in QuickBasic. That source code from 1988 will load, compile, and run just fine. Furthermore, QB64 has added hundreds of new powerful commands and enhanced existing ones to take advantage of today's high-powered computer systems. Visit the QB64 Wiki for a listing of all the new features available.
The simple answer; because it's fun and easy. QuickBasic (and QBasic that shipped with DOS) was a very popular programming language in the 80's and 90's because many early computers, such as the Commodore 64, The Texas Instruments TI99/4A, and the TRS-80 line of Radio Shack computers, used BASIC as their operating system. Because of this many early computer enthusiasts "cut their teeth" using BASIC and moving to Microsoft's QuickBasic was a simple way to write software since the familiarity with BASIC was already there. QuickBasic (and BASIC in general) fell out of favor when 32bit operating systems started to become the norm. The developers of QB64 remember QuickBasic's heyday with fond memories and want to pass that experience onto others while adding modern features for today's powerful computer systems. Will the next killer app be written in QB64? Probably not. (Although a game written in QB64 was green lit on Steam once). So why QB64? It's a simple way to get introduced to programming while at the same time allowing you to write custom software quickly and easily. And who knows, YOU just might write the next killer app in QB64. The skills you learn using QB64 and this tutorial are easily transferred to other programming languages as well.
The first thing you'll need to do is get QB64 installed on your computer system. If you already have QB64 installed you may want to upgrade to the latest version. You'll also need the tutorial asset file installed to take full advantage of this tutorial. Visit the Install QB64 page to get started.
Tutorial Asset File
The tutorial asset file will be updated from time to time to reflect changes made to the tutorial. You can download it here:
Latest update: November 21st, 2023
Note: If you were using the old tutorial site you'll need to delete the old tutorial folder in your QB64 directory and download the new tutorial asset file. It's the same procedure as before, download the tutorial asset file and move the "tutorial" folder found in the ZIP file into your QB64 (or QB64PE) folder.
QB64 Phoenix Edition Forum
The QB64 Phoenix Edition forum is your one-stop shop for all things QB64 related. Stop by, create an account, and join in the conversations. There are many QB64 users there that are more than willing to answer your programming questions. Remember, there are no stupid questions! We were all new to programming once.
QB64 Phoenix Edition Wiki
The QB64 Phoenix Edition Wiki is your go to place for everything QB64 command related. You'll find helpful code snippets and command syntax to help you complete your game project.
Versions of QB64
In early 2022 the QB64 community decided to take a few different directions. The author of this tutorial chose to align with the Phoenix Edition version of QB64. The author is in no way stating that one version is any better than another. As new versions appear the links to them will appear below to give users a chance to check out their varying features.
Getting Involved With The Tutorial
I welcome any comments, suggestions, and/or criticisms you may have about the tutorial. Please feel free to email me with improvements or suggestions that you may have (see the fine print below for my email address). I welcome help in the following areas:
You want to write a tutorial lesson on a topic that you have useful knowledge you wish to share with users.
You have found and wish to report errors in the subject matter or source code listings. I really appreciate the help I have already received in this area.
You have an idea for an advanced tutorial lesson in a subject area I'm not well versed in (3D graphics, OpenGL, etc..) but don't want to write the lesson yourself. I'm more than willing to learn from your examples and guidance and write a lesson based around your knowledge and expertise.
You have written a game in QB64 and wish to have it included in the games section. You will need to allow users access to your source code however as pre-compiled .EXE files will not be accepted.