Writing Your First Game

If you’re about to set out to write your first game.  There are some things you need to establish. 

What language is it going to be in?

There are a lot of languages available, and picking a language is a lot like picking a religion.  It’s really only going to matter to you, and to the people who want you to share there religion, oh I mean language, with them.  Most games are written in C.  But there is starting to be a big push towards C++, even Microsoft is realizing this.  Their Direct-X SDK is both C and C++, but it sure is a lot easier to use if you go ahead and use C++.  I prefer C++, but will use just about anything. 

Another viable option for an early project is BASIC.  Don’t scoff, remember we’re talking about the first game project, and unless you’re a very good programmer already, BASIC is a good choice.  It’s not a very fast language, nor is it very powerful.  But a lot of perfectly good games have been written in BASIC.  I once wrote a version of both Pac-Man and Donkey Kong in BASIC.  They ran at normal speed, but the graphics were terrible, and there was no sound.  But hey, they were good, playable versions of the games.  Plus, if you still have DOS on your machine, you probably have QBASIC, a reasonable good version that is free.  And free is good.  Of course you’ll need to get Visual BASIC if you want to write Windows programs. 

If you do decide to go with C or C++, there are a lot of compiler choices.  Here’s my opinions of what’s best for each task.  For doing DOS games I feel that Borland C++ 3.5 is the best.  I know they’re up to 5.x, but I don’t think they’ve really improved there DOS functionality very much.  If you need to use more the 640K, then you probably want a DOS Extended compiler, such as Watcom.  There’s certainly enough games that use Watcom to warrant a serious look at it.  If you are going to be writing Windows games, I feel that Visual C++ is the way to go these days, if for no other reason than the debugger.  The Visual C++ debugger has made my life so much easier.  And of course we have to consider money, if you’re budget is tight, consider GNU C, it’s free, and it generates pretty good executables.  There’s also a C++ version available called DJGCC.  But read the license agreement on GNU C before committing to using it. It’s got a fairly strict agreement about whether you can charge, and if you have to provide your source code with anything distributed written with it. 
Back to top.

What type of game are you going to do?

This is probably the single most important question you can ask.  If you pick a project that is too big, you probably will get frustrated and quit.  I have a friend who wanted to write a game like Doom, but better.  Remember that Doom took 4+ guys over a year of full time work to complete.  And these guys weren’t writing their first game.  They knew what they were doing.  They already had number one hits.  If you are writing your first game, don’t even think of writing a game of that level. 

If you’re working on a game that is similar to a game that is published, take a realistic look at what resources you have available, and how much time you want to spend on it.  Then think about how long it took the game company to write that game.  Most games take a team of about 6 people over a year to write.  These people know what there doing, and have way more resources available to them than you probably do.  They have very talented artists, musicians, sound engineers, designers, and programmers coming out their ears.  Many people like to say, well look at id, it was just a bunch of guys working out of there garage.  Well, that true.  But they had all been pros before they went off to their garage, so it’s not like a bunch of guys getting together to write a game in there spare time.  And they worked on there projects full time.  Something most people can’t afford to do. 

I always recommend for the first project something that you know you can finish in a reasonable amount of time.  I recommend something like Hangman, or Tic Tac Toe.  If you’re feeling particularly courageous, pick any board game that you’ve ever played.  Tic Tac Toe, may be better than many other examples, because if you write it so that you play against the computer, you will have to write AI.  AI is a very important feature of most games.  In addition, unless you cheese out and do it with text, you also get experience at writing graphics code.  You’ll also have to write a way for the user to input moves, usually that would be either keyboard or mouse.  But, it could be just about any kind of input device.  All of these things seem very simple, until you actually try to do them.  No project is too small to start with. 
Back to top.

Design is important!

Before you start to write a single line of code, and before any artwork is drawn, design what the game will be when it’s done.  It’s so easy to start writing a game with a simple concept in mind, and end up adding features for 5 years.  There has to be an objective, if not, when will it end?  I’ve worked on so many projects that were being designed while the code was being written.  Then they decide to put in a feature that will change everything that’s already done.  Scrap 6 months worth of work, and keep going.  Then a couple months down the road, someone comes up with the feature that will make or break the game, but guess what, you have to start over again.  If you design the whole game first, then you know what all the features that you need are.  Don’t allow any new features to be added until the ones that you designed are already done.  But make sure that you write your code in a such a way that you can add features.  That’s a talent that takes years to master, but it’s a very important one, because you’ll always find a feature you want to add after most of the project is done. 

And another note about design, if you’re writing an adventure or RPG then the actual plot is part of the design.  It’s amazing how much plot will change how the engine is written.  It is possible to write an engine that will allow for multiple plots without having to change code.  But I haven’t seen one yet.  Even Sierra On-Line makes little changes to their adventure engine for every adventure game.  If you don’t believe me, do a file compare on it between any two of their games. 
Back to top.

Where will you get art and sound?

It seems to me that many first time game programmers think that they can be artist, musician, sound engineer, and programmer.  I’ve actually had to review games sent in to companies I worked for by people who were bragging about how they did everything, and how they should come in as a lead programmer on a project.  When in reality, the art was horrible, the music was annoying, the sound was obviously taped in a bathroom, and the programming was totally amateur.  I always try and give helpful advice when people ask me what I think of something, but when they brag about how great they are, when in reality they aren’t, that’s a different story. 

Don’t try and do everything yourself.  If this is a project for yourself and friends, then use sounds and music off of the net.  There are hundreds of MIDI files free for the download.  They make a great musical score to a game.  Look at all the shareware Windows 95 theme packs for fairly good sound effects.  And there’s tons of artwork on the web that can simply be downloaded.  If you need to do original artwork, by all means do so.  But before you go bragging about it, do a realistic comparison to what the other games in your genre are like.  If you’re planning on submitting a game to a publisher for review, you can use placeholder art and sound, but make sure they know it can’t be distributed like that.  If they like your game, they can supply artists and musicians.  If you’re planning on distributing it yourself via shareware, or any other distribution method, make sure you secure the rights to use whatever art and sound you use. 

For originating artwork there are some really great free tools available.  For your rendering and ray tracing needs, I recommend using POV-Ray.  It’s a really good freeware rendering program, that works a lot like a compiler.  It has a language that you script what your scene looks like, and then the software generates that scene at whatever resolution you tell it.  For painting, I recommend Paint Shop Pro, it’s shareware version will do most things you’d need for simple images.  Make sure you register shareware, it’s usually worth it. 
Back to top.

What will you do with it when it’s done?

The eventual purpose of writing a game is to complete it.  But then what?  Are you just going to make copies and give it to your friends?  Are you going to lock it in a time capsule for future generations?  Or do you intend on selling it?  If you’re planning on selling it, are you going to try and get a publisher to distribute it?  Are you going to try and sell it via shareware over the net? 

If sales is your goal, look real hard at the little details.  Shareware tends to have lower expectations, but even low expectations can be pretty high.  You have to make a user interface that’s easy to use and intuitive.  You have to have a polished look to the game.  If you’re making an adventure game, it’ll be compared to Myst.  Does the artwork stand up to that challenge?  If you’re making a fast action, first person shooter, will it compare favorably to Doom?  If you’re making a platform side scroller, how does it look when compared to the ones from Apogee?  Don’t just think because you like it, it will sell well.  There are plenty of avenues available for getting professional Art, Sound, Music, and anything else you need for a professional quality game.  And if you’re expecting people to shell out money, it better have a professional look to it.  Look at all the games you’ve paid for, both shareware and commercial.  Most of them probably have a really clean professional look and feel to them.  They were probably fairly well documented, and mostly bug free. 
Back to top.

Get to work.

So now that I’m done spouting off on top of my soap box again, it’s time to start writing a game.  Sit down, and decide a game to write.  Design it.  And start going.  But remember to start small, otherwise you’ll probably never finish.  If you haven’t already written a simple game like Tic Tac Toe, that’s what you should start with.  If you feel that’s beneath you, make it a 24 bit color, 1024x768 game that has a grid that’s 10x10 and you only win if you get 5 in a row.  Render all the artwork, and make it multi-player across the Internet.  That should keep you busy for at least a month.  Oh yeah, don’t forget the 3D Dolby surround sound. <grin> 
Back to top.


Last revised:  August 12, 1997