Getting Started in Game Programming - Part Two

Shawn Delahunty's picture
Retro Programming Hello everyone, welcome to my second article on learning the fine art of programming. In my last article I listed a goodly number of possible options for learning to program with BASIC. Some were old, some were new, some are decidedly cool, and some were ridiculous. Some were (and are) extremely good development tools--capable of being used to create commercial quality software. There are also many other options which I left out of the mix.

Previously, I covered the highlights of what each one offered, and provided enough links for you to do some more research on your own. (You did go out and research some of those, didn't you?? I mean, if you're serious about wanting to program, then a little effort into research and experimentation can't be a huge hurdle. If it IS, you really need to re-think your future career.)

We've seen the various contenders. Well, most of them anyway. After my last article, Armchair Arcade member Felix Pleasoianu pointed out what appears to be a rather glaring omission on my part:

10. Install an emulator for an old 8-bit computer system and play with it. :P

Seriously, option 9 is how I started programming, back in the day, so I second your advice. And since you mentioned PyGame, that should probably be the second step, once the basics have been mastered. That, or Javascript in a browser, since going from Python to JS may seem like a step backwards to a less experienced programmer.

But those are already pretty high level. Good old Basic with GOTO and line numbers is very close to how the computer really works on the inside, and that perhaps more than simplicity is a good reason to start with it.

To refresh your memory, the #9 option Felix refers to was:

9. Buy an old 8-bit home computer system on eBay and program directly on that.

In truth, I did consider putting option #10 up on the list originally. I decided against it for multiple reasons:

  1. Setting up an emulator for one of the old 8-bit computer systems can be complicated.
  2. As I pointed out for option #9, "Why do you want to learn the details of programming for an OLD system?"
  3. Unless you provide a web-based/web-hosted emulator solution, no one else will be able to play your game---or you require that they go through the hassle of setting up the same "native code" emulator on their computer.
  4. The very "retro" nature of your game limits your audience. For instance, my TRS-80 game Retro-Zap! is hosted right here on Armchair Arcade. Judging from the page-hit counter, only a moderate number of people have even visited the page. And I seriously suspect they were far more interested in the classic Z-80 Assembly games like Scarfman and Robot Attack than they were in my goofy little retro-game.

Now since this IS Armchair Arcade after all, perhaps my focus ought to have been on the solution proposed by Felix. Retro-gaming and Retro-computing are the shared vision, passion, and obsession of our community here. However, my real focus for these articles is Programming. Specifically, I am presenting what I feel are the best BASIC language options are for a neophyte programmer. So the option of, "learn BASIC inside an emulated VIC-20 / Spectrum / Apple][ / C-64 / Acorn / Amstrad / ColorComputer / Dragon / TRS-80 / ZX-80" just didn't make the final cut.

HOWEVER, should you feel the urge to code for one of these older platforms, PLEASE DO SO. There will never be enough games for these old platforms! If you happen to write anything for the TRS-80, please send it to me at: shawn@armchairarcade.com with "TRS-80 game" in the subject line. If your game is sufficiently "Retro Cool", I'll gladly host it here on our TRS-80 emulation page. (In the next few months, I'm going to see what I can do about hosting/configuring browser-based emulators for other classic 8-bit systems. So stay tuned!)

(Side Note:
Felix has a very interesting and thoughtful blog of his own, notimetoplay.org. His latest entry (as of this writing) presented some interesting facts about retro-computing platforms, and the conversion hell which plagued developers of the classic 8-bit systems. Felix's "Thoughts on Portability" blog entry.)

Ok, back to the matter at hand: Learning to program in BASIC. Now that you've had a chance to look over the options I presented last time, it's time for the big reveal.


Stage Three: On your mark... Get set...

Taking all of those possibilities into account, here's my recommended BASIC programming solution for the inexperienced folks who want to dip their toe in the vast, deep, and roiling ocean that is computer programming: QB64

Go get QB64. You can download the language/IDE and read much more about it here.

My choice may seem odd; puzzling and counfounding folks initially. So why do I recommend QB64 to all the young and budding padawans seeking to become "Master Code Jedi"?

  1. Because it has 100% compatibility with QBasic programs, QuickBasic programs, and even grotty old line-numbered BASICA programs. There exists THOUSANDS upon THOUSANDS of old BASIC programs floating about on the Internet which you can download and test and run and learn from. QB64 can handle nearly all of them.
  2. Because it is "Free/Libre Software", and thus unencumbered by goofy corporations with itty-bitty minds and over-powered legal departments.
  3. Because it is a very capable tool, and offers many modern extensions to the original QuickBasic command-set. Better graphics, sounds, image-file handling, mouse inputs, networking (Yes, NETWORKING!) and so forth.
  4. Because it runs on Linux, MacOS, all flavors of Windows, BSD, and so on.
  5. Because it is very actively developed and maintained, with lots more features planned.
  6. Because it comes with some very excellent documentation for beginners.
  7. Because YOU DON'T HAVE TO PIRATE ANYTHING to get started with it.
    (There is a PayPal donation link on the main website. If you find yourself using QB64 a lot, consider throwing a fiver in the donation bucket to keep the developers motivated!)

A (not-so-)Quick Note on Availability, Abandonware, and Software Piracy

Lest anyone thinks I've been too preachy in these articles about the topic of SOFTWARE PIRACY, be aware of something:

I am a programmer. This means I make my living turning caffeine into working code. I know how damn difficult and challenging it is to write good software. I know what it's like to pour your sweat and tears into code for weeks and months at a time. I know how it feels to have some jackass swipe all that hard work from you. So there is no way I'll ever accept any argument for mass piracy.

Casual piracy though? Wellll... that's a whole other kettle of fish. I was a huuuuge software pirate, back in the days of "Sneaker-Net". The urge to pirate is far worse when it comes down to the sticky issue of unavailability of legitimate copies. It's incredibly easy to justify downloading a hacked/cracked/pirated copy of some old software which is flat-out not available anywhere anymore. Ancient games, which are well and truly abandoned, are a prime example. If you can't get a copy off eBay, if the game company doesn't offer it anymore, if the game company doesn't even exist anymore, then what do you do?

Here's a recent case from my own life:

I just recently re-read Matt Barton's Dungeons and Desktops book. In it he talks about a 1992 game called The Summoning, from Event Horizon Software. It's one of the lesser known titles licensed from and distributed by Strategic Simulations. The game is a "near realtime", single-player, isometric RPG. After reading about it, I searched and found some play-through videos of the game on YouTube, and became fascinated with the thing. What to do?

In this case I was fortunate. Two minutes spent on eBay and I found a couple used copies for sale. I did order a box copy with manual & poster inserts, but there's a snag. The game comes with floppy diskettes; the 3-1/2 inch kind. So what now? Well, I DO happen to keep a couple spare floppy drive wrapped up in the closet for this kind of thing. I keep it in case someone has "an emergency" and needs to rescue data off some old disks. But I truly didn't want to risk damaging these aging game floppies if I can help it.

My choice? In less that 5 minutes of searching I found ZIP-files on two different "abandonware" websites.

And guess what? I downloaded from both of them.

Before anyone starts lecturing me, here's my reasoning:

  • I actually OWN a legitimate copy of the game. So I'm not actually pirating anything.
  • There exists the possibility that the floppies are bad or corrupted.
  • There exists the possibility that the executables on the game floppies are infected with some ancient malware or viruses!
  • While it's possible that the EXE files on the download sites are also corrupted or infected, it's unlikely that both sets would be screwed up the same way. (Running virus scanners and data-comparisons on the ZIP files, everything is kosher.)
  • There are, truthfully, ZERO other ways to get a backup copy of the game.

Thus, I didn't feel a whit of guilt about what I did. And I probably would have yanked the pirated copy even if I couldn't find a legitimate used copy on eBay. I'd have felt somewhat guilty about it, but I'd have done it. The game is out of print, likely forever.

To be clear though, I genuinely feel extremely guilty about my past. As a kid, I was a monster little pirate. I would beg, borrow, and bargain whatever I could wrangle, just to get the use of somebody's game disks for an hour--all so I could copy the things. It was a function of my reality.

In conclusion I will say this about piracy:

  1. If you are 12, and have no job, I understand. You shouldn't do it, especially not to Indie studios, but I understand. At least try to wait until there's a Humble Bundle or something, and get your folks to chip in $20 or so--and be sure to give it to the folks who wrote the games. Charities like the FSF are wonderful things, but people deserve to get paid for their efforts first.

    (You might also try Emailing the developer, explain your predicament, and ask to be a beta-tester. Be professional, be helpful, and be polite. Stress that as a 12-year old, you've got a LOT more time to devote to game testing than the developer's married friends who just had the new baby. It may not work, but then again you might be surprised.)

  2. You are a real stinkeroo if you DO have a job, and still go pirate software which is commercially available.
  3. You are also a complete knee-biter scumbag if you do this to Indie developers.
  4. You are double-sized human turd with extra corn chunks, if you then turn around and seed more torrents with the program.
  5. If this upsets you, good. Don't give me any BS excuses... if you have the job, cough up the dough bub.

Stage Four: GO!

The selection of QB64 was actually a tough call for me, as FreeBASIC is also an extremely capable tool and meets nearly all of my criteria. And, well, just like QB64, it's FREE. (When you're just atarting out, it's very hard to argue with FREE tools.) But, like the Olympic judges, I had to consider a lot of tiny, nit-niggly factors when making this decision. It really came down to one of those "hundredths of a point" judgment calls. As a result, FreeBASIC still got edged out in my final selection.

What won the day for QB64?

As mentioned in my last article, QB64 is a user-developed modern port of the classic Microsoft QuickBasic. It's exceptionally compatible with QuickBASIC, even mimicking the console/DOS-based IDE of the original. And THAT is what swayed me, the inclusion of the IDE with the language. The fact that QB64 features that funky, chunky, blocky-pixel "old school look" in the built-in IDE is good for two reasons:

  1. It has a "retro-cool" charm about it.
  2. It is purely, and ONLY, functional. The IDE is neither complex nor hard to navigate. Too many modern IDE's try to do too much.

And ultimately that was what edged out FreeBASIC in my selection:

  1. The more modern IDE's available for FreeBASIC are NOT included with the language. They must be downloaded and built separately. That's extra steps you have to fiddle with.
  2. The more modern IDE's also require more configuration, to point them at the FreeBASIC compiler, your build directory, your source-code directory, and so on. Again, it's not a "Grab and Go" solution.

I'm aiming to recommend the simplest and most effective solution for a beginner. Fancier IDE's represent more of a distraction from the task at hand; learning to program.


Stage Five: You're Gonna Be Disappointed If....

Time for a little bit of a reality check. This is the dream:

Coder_DreamsCoder_Dreams

This, I'm sorry to say, is the reality:

Coder_RealityCoder_Reality

Every game developer on Earth has tried to break this harsh truth to the up-and-coming young people, all of whom are practically vibrating with excitement about becoming "Game Developers". Some variation of this cautionary tale is on every forum, every site, every discussion board, and in nearly every game developer interview I've ever seen.

But because people LOVE video games so much, it's easy to get carried away by your excitement. And like so many other programmers, I've seen innumerable "project announcements" for "the best game evarz" on various web forums, which never even saw a second posting, much less any evidence of progress.

So let me caution you: This process of learning to program is going to take a WHILE. You are going to get frustrated. You are going to get confused. You are definitely going to get discouraged at times.

Know what else?

Initially, you're going to write crap. A WHOLE BUNCH of crap, ok?

I did the same thing as I learned. I wrote LOADS of crap. Games, utilities, tools, and graphic-demo whatsits. They were all (mostly) complete steaming piles of buffalo poo. A mildly cooked cabbage could've outwitted the code I wrote. Hell even John Carmack wrote crap at some point. But that's all part of the process. And along the way, you are going to learn a great deal about much more than programming.

You may find out that you don't like programming at all. That's perfectly OK too. At least you'll have tried it, and have a greater appreciation for the folks that do it--and that's never a bad thing. (This is true in all areas of life. I gained one HELL of a greater appreciation for plumbers the first time I helped my Dad dig up the septic tank in our back yard... those folks seriously EARN their pay.)


Stage Six: Code. Code! CODE LIKE THE WIND!! GO GO GO!...

Well, almost. Before you can start hammering out code like some clicky virtuoso of the keyboard, you actually need to download and install the thing. The best way to start is with the tutorial page on the QB64 wiki: QB64 "Getting Started" and Tutorial guides

When you get the QB64 program installed, it ought to look something like this:
Initial LookInitial Look

So you're probably asking, "Now what bub?"

Stick with the Wiki. The first QB64 tutorial page walks you through installing the package, writing your first little 3-line "Hello World" program, and covers step-by-step how to run the IDE.

"What then?" you ask.

Stick with the Wiki. At least until you get through the entire section marked "EASY".

"And then what?" you say.

At this point, you've got some capability and some options. Before diving into the "MEDIUM" or "HARD" sections listed on the QB64 Wiki, I suggest that you strike out on your own for a bit. Before you're ready to tackle the complex graphics and such, you need to feel comfortable writing somewhat more complicated programs completely on your own using the BASIC instructions which you learnt from the Wiki.

What do I mean? Well, in classical (and annoying) textbook fashion, "Here are some useful 'Exercises for the Reader'."

  1. Write a program which calculates and prints out the number of seconds in each month of the year.
  2. Write a program which asks the user for their birthdate, asks for today's date, and calculates the number of seconds they've been alive.
  3. Write a program which asks the user to type in a series of 5 words. Store them in an array. Then sort the array alphabetically and output the result.

It may seem like I'm re-covering a lot of ground which the Wiki takes you through. That is absolutely what I'm doing. When you can write programs which accomplish the above tasks, off the top of your head, THEN you're ready to start mucking with the more complex stuff.

"Really? I have to do this junk? Can't I just jump in and start making games?"

Yes. Yes. And, uh... no. Well maybe.

Naturally, you can do whatever you like. But just like eating your vegetables, these practice programs are good for you to mentally chew on. I've picked these examples for multiple reasons. If you can write code to solve these problems, without breaking a sweat, then you've got a good enough grasp on the fundamental bits to proceed. Jump ahead too much or too quickly, and I guarantee that you WILL get discouraged. Besides, you'll have to figure out these kinds of thing to make your game programs work anyway.

Other References:

Once the preliminary exercises are out of the way, you're ready to start with the "MEDIUM" and "HARD" programming walk-throughs on the Wiki. After that? Well, I suggest you go digging around elsewhere on the QB64 website and in the forums for sample programs and games. Download the ones which interest you, load them into the IDE, and try them out!

Another option to consider is Reference Books. There were piles of the things written in the late 1980's and through the 1990's. (I'm sure Greenpeace blames computer books for deforesting whole swaths of rainforests somewhere.) Here is a selection of titles which I just now pulled off my ridiculously overloaded bookshelves:

  • Microsoft QuickBASIC: Learning to Use MS QuickBASIC. (c)1988, Microsoft. Vol. 1
  • Microsoft QuickBASIC: Programming in QuickBasic. (c)1988, Microsoft. Vol. 2
  • Microsoft QuickBASIC Programmer's Toolbox. (c)1988, John Clark Craig. Microsoft Press.
  • Running MS-DOS QBasic. (c)1991, Michael Halvorson & David Rygmyr. Microsoft Press.
  • MS-DOS QBasic Programmer's Reference. (c)1991 by The Waite Group. Robert Arnson, Christy Gemmell, & Harry Henderson. Microsoft Press.

As you can tell, I haven't bought any "old BASIC" books in a looong while. However, I should point out that I didn't buy any of these books new! I bought them ALL on discount sales, starting in about 1992 or so. Amazon and eBay are your best best for finding copies of these. There are dozens of other titles available used from Amazon. Just search under 'QuickBASIC' and look through the list.

And just for the anti-BASIC nay-sayers out there, here's an Amazon link that will blow your itty bitty minds:

Engineering Analysis: Interactive Methods and Programs with FORTRAN, QuickBASIC, MATLAB, and Mathematica. (c)1998.

That's right bub, QuickBASIC is listed right alongside MATLAB and Mathematica. In the title. And this isn't some lightweight book on recipes--this is an engineering analysis textbook. QuickBASIC is a seriously powerful programming tool. Don't dismiss it lightly.


Stage Seven: The road goes ever on and on....

Now comes the best and most fun part: Start tearing into any one of the BASIC games which you downloaded. Study how the example program works, make changes, and see what happens. Usually, you'll get weird behavior, unexpected crashes, or an error message. Occasionally though, you'll get nifty new behaviors. The more experience you get, the less bumpy the process gets. You'll start branching out and adding whole new features, and suprising yourself with the results.

Once you get to this point, you'll certainly know if you like programming enough to continue with it. There are literally HUNDREDS of programs available on the QB64 site alone. Doing a bit of Google-Fu should yield TENS OF THOUSANDS more programs. The tricky part, in some cases, will be converting some of those "BASIC" programs so that they will run correctly. As mentioned earlier, there are a ton of different 'dialects', or variations, of BASIC. Some commands are different or structured differently. A few aren't supported by QB64. (There's a list on the Wiki page of which commands it does NOT support.) So you'll have to get creative in hacking up the code to make it run. But that's the fun of it!

At any point in there, if you feel like branching off and writing something of your own, especially a game, DO IT. There are no rules, save for the rules of the language. If you can dream it, you can code it.


Stage Eight: " Um, What now?"

At a certain point, if you start to get "Really Serious"(TM) with your programming, you may start to feel the limits of QB64 BASIC. You have several options at this point:

  1. Go for one of the commercial BASIC compilers out there. Blitz3D, the successor to BlitzBasic This one has been used to create professional games. Ditto for DarkBasic. These things have ways to hook into SDL, OpenGL, and all kinds of other libraries.
  2. Dig further into QB64. It supports function calls into SDL (Simple Direct Media Library) and even OpenGL as well. It also supports calling into other programs and libraries that you write yourself. (It's a little clunky, but you can do it.)
  3. Learn a more modern language.

Really, your best bet is the last option. If you are serious about programming, and particularly if you are serious about pursuing it as a CAREER, then you're going to have to learn other languages. With only BASIC on your resume (and not even VB.Net at that), you aren't going to be working for DoubleFine any time soon. Start looking at C++, start looking at Unity, start looking into Perl, Python, Java. Chances are you'll begin drifting towards one sector of programming or another, based on your interests and aptitude. Let your exposure in that arena be your guide in selecting which language(s) and tools to explore.



Whew! I think that's just about it folks. I've said nearly all I have to say on the topic of starting out in BASIC programming. The rest, and where you go from here, is up to you.

Thank you for reading, and please comment below with any suggestions and experiences of your own. Happy Coding!

Comments

Sokurah
Offline
Joined: 02/05/2011
...another one for Stage 8.

Nice article - both parts so far. :)

However, you've mentioned several different Basic packages but there's one omportant one (IMHO) that you've forgotten (probably because you've never heard of it) that I think should be mentioned - and that is GLBasic (http://www.glbasic.com/).

It's a Windows program (which will also compile OSX executables from Windows) and it's an easy Basic on par with BlitzBasic & BlitzMax. In other words - made for making games. But it's free. If you buy the premium version you'll have access to 3D graphics and options to compile for about a million mobile devices too, but the standard version is a free and very capable Windows based Basic package.

n/a
Shawn Delahunty
Shawn Delahunty's picture
Offline
Joined: 08/01/2011
Very nice addition!

Thank you very much for mentioning this Sokurah.

You are absolutely correct, I'd never seen GLBasic before. I very much like the fact that it has a Free version for people to play with initially, and at first glance it seems incredibly capable. The iOS and Android options are very intriguing... hmmm...

I can't tell from the website or Wikipedia just how long GLBasic has been around. Looks like the PocketPC timeframe would mean around 2002 or so?

Cheers,
-S

n/a
Sokurah
Offline
Joined: 02/05/2011
No problem - for some reason

No problem - for some reason it often gets overlooked, but I think it's good and deserves more recognition. Gernot (the author) is very active on the forum too, and will help with problems, and if a bug is found he will often correct it in a matter of days.

It's quite the oposite with BlitzMax (my preferred language) - development on that language is almost dead in the water...personally I just happen to like that one more.

But GLBasic is easy to learn and I made this game with it: http://tardis.dk/wordpress/?page_id=481
I'd never played with GLBasic before then, but I managed to make the game (for a competition) in 5 weeks (ifair). It did help a lot that I'd been programming in BlitzMax and Blitz3D, though. The languages are very similar.

There was a thread recently about how long it's been around here: http://www.glbasic.com/forum/index.php?topic=8190.0
It seems some of the example files are dated 2002, but the first version was released September 1st 2003.

n/a
Felix Ple?oianu (not verified)
Wow, thank you so much for

Wow, thank you so much for mentioning me.

Stage 5 reminded me of my own obligatory "getting started" article (shameless plug), where I stressed that 1) you must be willing to work hard and 2) you need to know stuff about real life, since that's what you're going to simulate in your games, however abstractly.

As for stage 7, yes, at some point you'll have to work with code written by other people. It will seem a daunting task in itself, but you have to do it if you're serious about programming. Start by reformatting the code to your liking, it helps a lot (perhaps surprisingly).

Um, that's all I've got this time. Thanks again.

Matt Barton
Matt Barton's picture
Offline
Joined: 01/16/2006
You know, I think learning

You know, I think learning BASIC rudiments or any game making language is great for all of us gamers. Even if you don't go beyond the basics, you will still have a much deeper appreciation for games. Then when you play older games, especially, you will be blown away by how much they were able to achieve.

n/a

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.