QB64 Tutorial
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. As it stands now the only version of QB64 that has been actively updated in the past two years is Phoenix Edition.
Recent News and Updates:
- 04/10/24 - Added the DRAW, PSET, and POINT statements to Lesson 5.
- 04/13/24 - Added the _PIXELSIZE and _NEWIMAGE statements to Lesson 5.
- 04/13/24 - Legacy SCREENs are now covered in the SCREEN section of Lesson 5.
- 04/13/24 - SCREEN pages and page flipping are now covered in Lesson 5.
- 04/18/24 - A tutorial for InForm-PE has been released by mpgcan. Get the tutorial here. InForm-PE is an IDE front end that allows the creation of QB64PE programs using a VisualBasic like GUI interface.
- 04/22/24 - Added the PCOPY statement to Lesson 5.
- 05/08/24 - Added the side lesson Using the IDE (getting the most out of it) to Lesson 8.
- 05/21/24 - Lesson20: Libraries has been completely rewritten to incorporate the new $INCLUDEONCE statement.
- 05/21/24 - The QB64 Phoenix Edition developers just released version 3.13.1. Read about it here.
- 05/21/24 - An FAQ (Frequently Asked Questions) page has been added to the site.
- 05/22/24 - Updated the tutorial asset file to include the new code examples added to Lesson 20. (found a bug)
- 05/23/24 - A new game, Alchemy, has been added to the games section.
- 05/26/24 - The portable version of this tutorial has been updated to version 2.1.0 by mpgcan. Get it here.
- 05/30/24 - A new forum section has been added to the Phoenix Edition forum dedicated to the tutorial. All are welcome to join the forum and post questions, comments, and code pertaining to the tutorial. You can find the new tutorial forum here.
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.
Why QB64?
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 QB64 Tutorial
The first half of this tutorial is designed for the newcomer to QB64 and programming in general, covering basic programming topics with an eye towards game development. The second half of the tutorial delves into deeper programming topics and commands for those serious about writing games with QB64. If there is a QB64 command or topic not covered in the tutorial that you would like to see added simply email the author with your idea.
QB64pe forum member mpgcan has created and maintains a portable version of this tutorial (thank you!)
Get the portable QB64 Tutorial here.
Install QB64
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.
Useful Links
QB64 Tutorial Asset File
The tutorial asset file will be updated from time to time to reflect changes made to the tutorial. The tutorial asset file contains the example source code throughout the lessons along with the image, sound, and library files needed to go along with them. You can download it here:
Download Tutorial Asset File
Latest update: May 22nd, 2024
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 Forum
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.
QB64 Phoenix Edition Wiki
QB64 Tutorial Forum *New*
The QB64 tutorial forum is your place to post questions, comments, and code pertaining to the tutorial. The tutorial forum is a sub-forum located within the QB64 Phoenix Edition Forum. Stop in, create an account, and say hi. I'll do my best to answer all of your questions and comments. If you have a suggestion or criticism about the tutorial I want to hear those too. You won't hurt my feelings at all, I need to know how the tutorial may be improved.
QB64 Tutorial Forum
InForm-PE Tutorial
InForm-PE is a Rapid Application Development (RAD) tool for QB64pe. It comprises a library of graphical routines and a WYSIWYG (What You See Is What You Get) editor that enables you to design forms and export the resulting code to generate an event-driven QB64pe program (very similar to VisualBasic). In event-driven applications, the program's flow is determined by events such as user actions (mouse clicks, key presses), sensor outputs, or messages from other programs or threads. The link below includes instructions on installing and a link to download the InFrom-PE tutorial.
Get the InForm-PE tutorial here
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.
QB64 Phoenix Edition - Current version 3.13.1 (05/24)
QB64.com - Current version 2.1 (04/22)
QB64 Team (before the 2022 change - static at this point) - Last version 2.1
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.
You may contact the author of this tutorial, Terry Ritchie, through e-mail at quickbasic64 (at) gmail (dot) com. The author of this tutorial is in no way affiliated with any QB64 Project other than being a long time fan of the language. If you have questions or comments about the QB64 project please refer to the QB64 Phoenix Edition forum. If you have questions or comments about this tutorial please direct them to the author.
(I was just basically a little curious about some of the new formatting options added, and was wondering how close to the original I could make it look with just a little MYCODE.. This is my 15 minute copy/paste/edit hackjob. It's missing lots of links and pictures and tiggers and poos and what not, but it's not TOO bad. I just got lazy and distracted by the tv and didn't try and harder. LOL!)