Thursday, February 5, 2009

Beginner FAQ

programmers

Maybe you know video games and you have a great idea for creating the next big hit, but you have no idea about how video games are made. The problem with technology is how quickly things change and you are having trouble finding some relevant information that introduces you to game development in English. You are very excited and you have a million questions flying through your head. And now you have found the Beginner FAQ on the Game Programming Wiki, guaranteed to be current or your money back (but you didn't pay anything, did you?).

What do I need to make computer games?

Game development necessitates 3 things: motivation, time, and talent. Without motivation you won't make time for game development. And without time, talent is meaningless. But without any talent you might as well be a carrot.

Beyond the obvious, you need:

  • Game Logic
  • Art Assets
  • Sound Assets
  • Game Content

Game logic (usually source code) is the most crucial to a complete game, after all, you can have a game without art and sound (text-based games). The visuals of the game entice people to download your game and also increase the "fun factor" of the game. Sound should not be overlooked as the music drastically influences the mood of the game, and cheap sound effects can ruin a game. The importance of game content (levels, dialogue, quests) is obvious.

In commercial game development, there are lots of people and they each have different roles. But if you are doing game development as a hobby, you can create everything (maybe getting some sound effects from the web) or you can "mod" a game or you can join a small team. Now we focus on the different jobs.

I want to be a game designer.

So you want to be the Idea Man? The fact of the matter is that everyone developing games has their own ideas and they have limited time, so the chance of you finding quality coders, artists, and musicians to make your game is miniscule. Unless, of course, you pay them ;).

Sometimes development teams will ask for suggestions, so feel free to give your opinions on various forums. You can also find "Game Design" forums where people just like you discuss their ideas. Don't be afraid to tell other people your idea, chances are it is not as revolutionary as you think. Make sure if you post your idea that it is well thought out, because other posters may ask you questions and look for faults in your idea.

I want to be a game programmer.

So you want to be the person who makes everything run? There are many, many choices of how to make the computer do what you want. Your decision is based upon many factors. This article will present a few different recommended paths for beginners. Ultimately your decision is "what software will I use to help me develop software?" which boils down to a programming language for the most part. See the article Picking a Language here on the Game Programming Wiki for a more verbose comparison of programming languages.


Pros Cons Resources
Python Powerful and easy language Not very fast at number crunching. [1] [2]
Game Maker Great for quickly making 2D games Control, Commercial (although cheap), not cross-platform [3]
Multimedia Fusion 2 2D game development, easy to learn and powerful, online games like flash and standalones Commercial, 3D still in development, not cross-platform [4]
Basic All-in-one packages Blitz and DarkBASIC - Very easy to get into and get started, Full Featured Slower, Less Flexible [5] [6]
Java Well-tested language that has seen major improvements. Extensive standard library and code that can be truly multiplatform. User must have JVM. JVM has memory overhead. Graphic performance depends on drawing methods. [7] [8] [9] [10]
C# Modern language supported by Microsoft with powerful GUI and connection to DirectX User must have proprietary .NET Framework. Cross-platform support available through Mono. [11] [12] [13]
C++ Complete control and power. Lots of resources and libraries. Cross-platform. Used commercially. Time-consuming and difficult Too many to list.
Visual Basic.net All of the power of basic, plus many more features, including the huge .net library. Used commercially. Doesn't have some features that some other languages have, like pointers. The .net library has a linked list class, though. Too many to list.
Pie In The Sky Games Creation System(PITSGCS) easy to learn and use, creates good 3d fps games Only works on Windows (so no Linux or Mac Games),only makes fps games, not open source Have to get your own resources.


Examples of games:

Besides the computer, many people also develop games for other electronic devices. If you choose this path, you are more limited in your selection of programming language. Some examples of these devices are TI calculators, cell phones, GBA, GP32X, and Dreamcast. You can also modify an existing game if the game provides tools that enable you. Some examples of games that are easy to "mod" include Half-Life 2 and Neverwinter Nights.

I want to be a game artist.

So you want to create amazing worlds, characters, and special effects? Here is a list of the tools you might need. The type of art a game requires is very dependent on the way the game is designed. For 2D art, it might have to have a certain "color key", dimension, number of colors, or an alpha channel. For 3D art, it can be even more complicated to make 3D models, animate them, texture them, and "export" to a file the game can use.

See also:


I want to be a game musician.

So you want to compose the music, or create the sound effects, for a game? The process for creating music (or sound effects) for a video game is very similar to that of creating music for other forms of media. When it comes to video games, though, there is a major constraint. Not only must the music and sound effects match the mood/atmosphere of the game but they must be created in a format that the target platform, and game engine, can support. Here is a list of the tools you might need.

Learning C++

If you are learning C++ it is predictable that you will come across some stumbling blocks. Remember to keep your cool, even if it takes forever to solve the problem.

How can I draw stuff?

Look into the resources on this site and others. You will need to use "libraries" of other people's code that are not part of C++. You can download these libraries from various websites. The easiest way to start drawing 2D graphics is a library called SDL (which stands for Simple DirectMedia Layer). If you want to draw 3D graphics that use the computer's graphics card, you need to use OpenGL, Direct3D, or another library that uses either of these.

Why does my "Hello World"/console program close so quickly?

Sometimes the IDE you are running from will pause automatically, but sometimes not. Unless your code says otherwise, your program will terminate as soon as it finishes everything. If you run from the command-line, you won't have this problem. For Windows XP, "Start->Run" and type "cmd" ENTER then use "cd" to get to the directory with your executable and run it by typing the name of the executable.

Or, add the following to the end of the code.

  • getchar()

This will tell the computer to get the character of the next key pressed, the natural upshot is that it will wait for the next keyboard press before continuing, in this case, continuing to the end of your program. Or

  • std::cin.get()

Same as above.


How can I convert an int into char*/string or vice versa?

This is something you do a lot in programming and pretty much every language makes it easy to convert between types. You may have already printed integers to the console with cout or printf, which of course needs to be converted to a string first. Converting numbers to strings is done in a similar way. Boost is a C++ library that can help you with problems like these and many others. The stringstream class is the ultimate conversion class and it provides the functionality of both istringstream and ostringstream.

  • Methods for converting X to string: ostringstream (C++), sprintf (C), itoa (non-standard C)
  • Methods for converting string to X: istringstream (C++), strtol (C), atoi (C), sscanf (C)
// In C++
int number = 411;
std::ostringstream mystream;
std::string mystring;
mystream << number;
mystring = mystream.str();

// In C++ (using boost)
#include
int number = 123;
std::string mystring = boost::lexical_cast(number);

// In C
int number = 411;
char buffer[20];
sprintf(buffer, "%d", number);
// In C++
int number = 0;
std::string mystring ("411");
std::istringstream mystream (mystring);
istringstream >> number;

// In C++ (using boost)
#include
try {
std::string string = "4567";
int number = boost::lexical_cast( string );
} catch ( const boost::bad_lexical_cast & ) {
// invalid conversion
}

// In C
int number = 0;
char *string = "411";
number = atoi (string);

What does "undefined reference" to blah-blah mean?

This is known as a linker error and is the most common linker error. I'll assume you know about functions. Let's say you called a function that creates a window for you, CreateWindow(). Since you didn't write CreateWindow() and somebody else did, you need to tell the linker where to find CreateWindow() because it did not find it on its own. Maybe CreateWindow() is part of a library called XXX. The solution to this problem depends on what compiler/IDE you are using. If you are using an IDE like Visual C++, Code::Blocks, or Dev-C++ then you need to go to Project/Build Options and look for Linker Options. Add XXX to something like "Link Libraries." If you are working on the command-line

>> to link to SDL
g++ main.cpp -lSDL
>> to add a directory to the linker's search path
gcc main.c -L/home/Joe/

What does "indie" mean?







Indie does not mean India, although maybe you thought that because there are a lot of programmers in India now. Indie is short for independent and is akin to independent films, which you probably have heard of. Independent films might be artsy, low-budget, different, and sometimes weird and all these adjectives can be applied to indie games. These games may not have the latest special effects and largest budgets, but they have heart and are created by people who love what they do. And these games may take more risks, instead of sticking to tried-and-true money-making formulas.

See also:


Compiler/Library/Engine/API/SDK/IDE ?

Prepare to be bombared by lots of terminology and technical jargon. This natural inundation is normal and it's okay to feel a little bit panicked and excited. What do all these mean?

Compiler
Transforms the code you write (which you can understand) into your program (which the computer can understand)
IDE (Integrated Development Environment)
This program allows you to write code in a text editor and then call the compiler to create your program. You can run your program from the IDE without clicking on the program icon.
Library
Other code that someone has written so you don't have to. Your code uses the library to perform tasks that might be impossible otherwise (Windowing, Networking, fast 3D graphics) or might just take a lot of code that you don't want to write (compression, image loading, XML parsing)
Engine
A game engine does a lot more than just a library. It handles the main tasks required of a game, like audio and graphics.
API (Application Programming Interface)
Refers to how you interact with the library. A good API makes it very easy to code with the library. Usually when people say they prefer Direct 3D or OpenGL they are talking about the API.
SDK (Software Development Kit)
Contains the library, documentation and example programs to make it easier to use the library.

Pretty much every language has a "standard library." The size and capabilities of the standard library varies between languages. For the most part, they all let you print to the console, get user input, read/write files, etc. Some languages have large and full-featured standard libraries with networking and windowing.

If you want to create a window for your program, you use a library to give you access to functions that enable window creation. The names of the functions and how they work encompasses the API of that library. You usually download the library with extra stuff like documentation and sample programs, this is a SDK.

Can I use sprites from other games in my own game?

Most likely you want to use sprites from a commercial game. If you are not going to distribute your game and are just using the sprites for learning/practicing, you won't get in any trouble. If you plan on giving away or selling your game, then you need the permission of the copyright holder. Some free games have liberal licenses that will allow you to use the sprites in your game.

See also:

Where is a good tutorial for making an MMORPG?

Such a tutorial, if it existed, would be very large and either useless or incomprehensible to novices. Be careful, you might fall into the stereotypical category that seasoned game developers know well. Are you a male between the ages of 12 and 18 who knows nothing about programming but plays MMORPGs and has ideas that would make MMORPGs better?

See these links:

Resources

Search Engine Submission - AddMe