Programming is a time consuming skill to learn.
It occasionally involves frustration, confusion, and plain old work.
But it’s worth it. It really is. The end result, and learning how to produce those results, gives excitement to the challenges involved. To speak the language of computers, to invent novel solutions, to craft the little universes and puzzles that keep us entertained – these are their own rewards. Aside from those benefits, being able to program can (in the longer term) also help open new career options.
Every programmer should know how to use the command-line. If you already know how to navigate and use programs via command-line, excellent. If not, here’s an introduction to basic command-line navigation.
Most free compilers require command-line arguments, and many other programmer tools (debuggers, code repository…) are also intended for use via command-line. It’s not programming, but it can be learned in less time, and it’s important to know.
Find a Good Book
Books helped me considerably in matters of programming. Although general videogame design and development is best learned by making things, getting started with programming is more easily picked up from books than from web pages or unguided experimentation. The additional explanation in books helps, and there’s value in the careful sequence of information typical in a well-edited work that is generally lacking on the web.
I began my adventure into programming with Dan Gookin’s C for Dummies. I found it enjoyable to read, and appropriately paced for someone with no prior programming experience.
I’m partial to paper books, when available, though if you’re on a budget, or if your library isn’t well equipped, here are free e-books on programming. C/C++ (or their Microsoft-only cousin, C#) are still the best languages to know for programming downloadable games.
Find a Compiler
The compiler is the program that converts typed programming code into the exe/app binary form that the computer runs. Without a compiler, the programming code is just one or more text files.
A program can be written entirely without an IDE (“Integrated Development Environment”) by typing programming code into a text editor. An IDE is a glorified text editor that also helps organize project files, feed the right source files through the compiler, set up the compiled program’s icon, and so on.
Although the MXMLC ActionScript 3 Flash Compiler is also available for free, AS3 is probably not the best first language to start programming in. Most books and web resources on AS3 assume that the pricey Adobe Flash CS animation tool is part of the process.
Start Really, Really Simple
Start small. Make a program that works, even if it’s just putting a line of text onto the screen. Programming makes it easy to build off your past work, and so rather than trying to put together something impressive, a safer and more reasonable approach is to put together a variety of small task-oriented programs, then expand on that accumulated code and experience.
Many people assume that the next step after putting text on the screen is to make something graphical – say, a circle that moves when the arrow keys are pressed, or a colored square that follows the mouse. However before that, learning to do more with just text provides a stronger foundation in programming. These exercises can improve understanding of programming elements, and are much easier to think through than when immediately applied to graphics. Examples:
- Make the text the result of a simple math expression, such as computing distance between points
- Write a function that returns the square of a number typed by the user
- Display all numbers from 0 to 1000 that are multiples of 7
- Load the first line of text from an external file, modify it and save to another file
- Compute the average, median, range, and standard deviation for numbers listed by the user
- Challenge the user to guess a random number, offering hints of hotter/colder
- Program a game of grid-based Battleship against the computer, displaying the board with letters (found this in a book; great way to get a feel for 2D coordinates and 2D arrays)
These may not sound exciting, but without exercises like these, it’s easy to get lost in the voodoo of copy/pasting example code together without a deeper understanding of what’s going on. That deeper understanding is essential to being able to debug (diagnose and repair) errors when they happen during programming, and it’s also helpful in being able to synthesize original material.
Once comfortable with the basics of programming, check out this decoder showing how programming basics fit into game programming.
When you’re ready to make the jump from text to graphics, check out this basic example of Breakout code programmed in C/C++, using the Allegro library for graphics/input. After that, there’s an Asteroids “assignment” available, also in C/C++ with Allegro.
Some tricks can be done without more complicated programming, relying instead on the types of math most used in videogame making.
Learn and practice team game development with Gamkedo Club.
Membership worldwide. Professional support. Proven process.
Subscribe by e-mail to receive weekly updates with Gamkedo.Community interviews and YouTube training videos for game developers!