Learning to Program with
                 DarkBASIC

Download the Plateau Game

Hi, my name is Hank Hufnagel. During the summer of 2002 I taught my son, Pete, and some of his friends how to program using DarkBASIC. They had all had programming classes in school, but somehow had not caught fire as programmers. I set out to change that. A couple of years have passed now and I have forgotten all the DarkBASIC I ever knew, but Pete at least took the lessons to heart and is now a Computer Science major at Penn State. The Plateau Game that you can download above still runs fine and the instructions that follow are still good stuff, but believe me, if you have DarkBASIC questions, I am not the man to ask any more.

Why I Picked DarkBASIC

I have worked in the computer industry since 1975 and founded Hufnagel Software in 1986. I have written applications in FORTRAN, BASIC, ALGOL, ESPOL, APL, COBOL, Assembler, C, C+, and, especially, Visual BASIC. Even after 25 years, I still love writing computer programs, and my plan that summer was to infect Pete and his buddies with this same enthusiasm by teaching them how to write computer games. Step one was to find a very easy language that was capable of producing exciting results.

What I was really looking for was something that made it easy to access the power of DirectX, a Microsoft product designed to allow programmers to get the most from today's graphics and sound boards. I use DirectX in one of my commercial product called PartyCAD, and have been very pleased with the results. However, using DirectX from C++ or from Visual BASIC is a complex programming task. DirectX is great, but it has so many bells and whistles that a raw beginner would be totally swamped by the technicalities of using it while at the same time learning a general-purpose language. I needed a simpler way to get at the power of DirectX. Where would you look?

I found DarkBASIC on the Net about 6 weeks before our sessions were to begin, and as I browsed the samples gallery and downloaded demo games I became more and more excited at its ability to create a wide variety of excellent games. I downloaded the trial version and had a look at the code for some of the games, and saw right away that DarkBASIC was easy, and a little strange.

With a single command you could do the work of dozens of DirectX statements in other languages. Its was also a cinch to manipulate 3D worlds, fiddle bitmaps and do other tasks related to game creation. On the downside, DarkBASIC was a very strange dialect of BASIC. It was as though the developers never looked at any another version of BASIC before writing their own. The language was rife with little problems, like the inability to print to a printer, or the fact that spaces were important and the lack of one, or an extra one, might cause a syntax error. Or, how about --- there were no global variables, except all outer block arrays are global. Well, even if you don't understand these technicalities, suffice it to say that DarkBASIC was a mixture of the ridiculous and the sublime. Still, though it had a tendency to make me laugh and curse, I found the power inherent in the language worth the frustrations.

I sent away to England for the full version ($75) and two weeks later it arrived. The manual was a mess, but the tutorials were very helpful, especially a small book called Further Tutorials. This took me step by step though the creation of a simple game. I soon started using Dark EDIT, a companion editor for the language, and this was a big help in writing actual DarkBASIC code. In three days, I managed to work my way though all of the tutorials, and then it was time to begin writing my first independent DarkBASIC app.

My plan was to use this as the basis for the seminar for my son and his friends, and you can see how my first attempt evolved from idea to completed project by studying the pages that follow. My plan was to teach my students the basics of DarkBASIC, and then to get each of them to develop a new level for the game. If they could do that, they would be well on their way to becoming real game makers and programmers. And, once you master that first computer language, once you have had that first 'aha' moment, then it is easy to tackle any other computer language you may bump into.

The Pieces of the Project

If you are a beginning DarkBASIC programmer, or just interested in the steps required to create a computer game, you will find it interesting to study the following pages to see how a real DarkBASIC project took shape and became a finished program:
Making the World - Plateau allows you to create and walk through a landscape.
Furnishing the World - Plateau2 extends this to add objects to the landscape.
Making it Work - Plateau3 is the basic game, now in working order.
Dressing it up - Plateau4 adds incidental scenery, sounds, music and opponents.
Finishing Touches - The finished program, complete with splash and ending screens.
 


  Hit Counter

Links:
   DarkBASIC - much improved no doubt from the version I used in 2002
   Blitz Basic - DarkBASIC's main competitor. Looks good!
   DirectX Home - the professional way to write games
   About Hank - about me
   PartyCAD - about my commercial product that uses DirectX