Game Programming FAQ

This is a discussion on Game Programming FAQ within the Game Programming forums, part of the General Programming Boards category; Hello, it's been a loooooooooong time since I last posted here. I lost interest in programming for a while, and ...

  1. #1
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050

    Game Programming FAQ

    Hello, it's been a loooooooooong time since I last posted here. I lost interest in programming for a while, and I became ditracted with other things for the main reasons why.

    Over the past few days/weeks I've been regaining that spark again by going to math class and hearing certain problems, thinking of how those could apply to programming. Then the other day at my job a fellow co-worker of mine needed help on his Java program, which I only spent a little time tinkering with, and since I spend most of the day doing nothing at work I was helping him with his program. Too shorten this already too long of a story, I was organizing my cd files tonight and came across the cd that contains most of my old programming and such. The files have been off of my computer since I did a reformat sometime last summer; I came across a file called Game Programming FAQ. That's all beside the point, though.

    From what I can tell, it looks the FAQ is no longer around here, and I was wondering why. It may still be around; I'm not sure. The file I have mostly has the questions I answered, in bold. I'll go ahead and post it to see if people might have more to add to it and collaborate on it. There might not be much point in my doing this, but I thought it could become of use again to some people.

    Attached Files Attached Files

  2. #2
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    Ah Tech!!

    Its been a long time!
    Good to have you back.

    [edit]
    I just say paste the text into an actual post and have the mods make a sticky out of it. Good stuff in there.
    What is C++?

  3. #3
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    Hey thanks, nice to see you, too. I'll take up your idea...

    1. General Information
    top
    1.1 How do I make games?
    You make games just like you make any other program in C. You write the source code, compile the program and there you have it. Of course making games can be alot harder than making any other program. If you do not know C, then you should learn it, then return to this FAQ in a couple months. It takes a lot of knowledge and hard work to make a good game, if you do not know C well enough you are just going to be wasting your time. Here is a link to a more indepth article about how to make games.
    1.2 What game should I make first?
    Well, what game do you want to make first? If your answer is Quake, Unreal Tournament or anything of that nature then dream on. There is no perfect game to make first, but here are some suggestions: pong, breakout, tetris, connect four, matching games, snake, tic-tac-toe, and space shooters.
    1.3 How do I display images?
    How to display an image is library dependent, meaning it depends on what graphics (or gaming) library you are using. Don't know what that is? Read on. For specific information on displaying a image for a certain library, check the section in this FAQ for that library.
    1.4 What is a graphics library?
    A graphics library is a collection of functions and data type to help you display graphics, and sometimes to help you play music, get user input, and access a network. There are several graphics libraries used to make games, to list a few: Allegro, DirectX, OpenGL, and SDL. All of them are covered in this FAQ. For more information on each one check there section.
    1.5 How do I use a graphics library?
    This depends on the library. Basicly you create a source file, include the libraries header(s), compile the source file, and link the object file with the library. Check each libraries section for the specifics.
    1.6 What is blitting?
    Blitting is copying, when you see 'blit bitmap to screen' that means to copy that bitmap to the screen, or to another bitmap.
    1.7 What is a bitmap?
    A bitmap is a image, it is not neccesarily a file. Someone else needs to write this answer .
    1.8 What is a sprite?
    A sprite is a bitmap that has transparent parts. Someone else needs to write this answer, or I will finish it later.
    A sprite is an image that contains transparent parts. Many times characters of a game are called sprites, because you only need a portion of the image space to be displayed and the rest to be transparent. If you wanted to have a dog as a character in a game, inside of the image you would create the dog and make the rest of the image transparent. To achieve transparency you use ?magic pink?, which pertains to the R(ed)G(reen)B(lue) color scale of 255.0.255.
    1.9 What is a timer?
    Answer needed here, either someone write it, or I will finish it when I get time.
    1.10 What is double buffering?
    Answer needed here, either someone write it, or I will finish it when I get time.
    All this simply means is drawing your images to a bitmap that would be the size of the screen and then drawing that bitmap to the screen so the images you drew appear simultaneously. For a more in-depth explanation please refer to this tutorial --- http://www.angelfire.com/games4/exem...le_buffer.html
    1.11 What is page flipping?
    Answer needed here, either someone write it, or I will finish it when I get time.
    1.12 Does anyone want to work on a game with me?
    Most likely not. Over half the time that people want someone to work on a game with them, they don't know how to program good enough to make it by there self. It is not a bad thing to ask for help, but in asking for this kind of help, you are usualy asking for someone to write the game for you.
    More than likely nobody is going to want to work on a game with you. The reason for this is that it is very difficult to work in a group over the Internet. People have different interests for the game, which typically wind up conflicting with each other. Not to mention that there is no reliability factor when creating a game over the Internet with somebody. The most important reason why making games over the Interent with another person typically don?t work is because the lack of planning. People like to go about getting into a group project with very little to no planning at all. If groups would think about planning beforehand then the chance of success would increase greatly, however, even with this increase the chance for success is still very low. For the most part try to create a game by yourself, because you will save yourself a lot of time by not joining a group project.
    2. Allegro Specific
    top
    2.1 What is Allegro?
    Answer needed here, either someone write it, or I will finish it when I get time.
    Allegro is not only a graphics library but is a full-fledged library. By full-fledged I mean that Allegro includes functions for 2d graphics, 3d graphics, sound output, mouse and keyboard input, timer routines, GUI routines, and a few other features. All of the features Allegro offers makes a programmer only have to use this one library instead of several different libraries. The cross-platform capability of Allegro means that your programs using Allegro can be used on many different operating systems. Allegro is primarily intended for 2d based games, because the 3d graphics support is still a little bit limited, however, the support for 3d graphics and all other parts of Allegro are continuously growing with the help and support of many individuals. Another great aspect of Allegro is its simplicity. Plus there always is the option of using AllegroGL (read on for more info) All in all, Allegro is a great library for the amateur programmer looking to make 2d games without having to go through much trouble.

    2.2 Where can I get Allegro?
    Answer needed here, either someone write it, or I will finish it when I get time.
    Well, the official site for where you can download Allegro is at http://alleg.sourceforge.net/ The best site for finding information pertaining to Allegro would be at http://www.allegro.cc
    2.3 How do I use Allegro with my compiler?
    Answer needed here, either someone write it, or I will finish it when I get time.
    2.4 How do I initialize Allegro?
    Answer needed here, either someone write it, or I will finish it when I get time.
    There is one basic step to initialize the basics of Allegro. To initialize other features of Allegro you will have to specifically initialize those as well. Below is all you need to include to initialize Allegro:
    allegro_init();
    Here are some of the pages for initializing certain parts of Allegro:
    \Allegro\docs\alleg000.html (http://www.allegro.cc/manual/view_ca...st=1034921875&) --- basics of Allegro
    \Allegro\docs\alleg003.html (http://www.allegro.cc/manual/view_ca...st=1034923362&) --- mouse routines
    \Allegro\docs\alleg004.html (http://www.allegro.cc/manual/view_ca...st=1034923413&) --- timer routines
    \Allegro\docs\alleg005.html (http://www.allegro.cc/manual/view_ca...st=1034973928&) --- keyboard routines


    2.5 How do I display images?
    Answer needed here, either someone write it, or I will finish it when I get time.
    There actually several different ways in which you can display images with Allegro. The most common wasy would be using the draw_sprite(), blit(), or masked_blit() functions. To find more about these functions you can go to \Allegro\docs\alleg013.html or online at the URL of http://www.allegro.cc/manual/view_ca...st=1034921875&
    At those two same locations you will be able to find information about the other drawing functions available for use.
    2.6 How do I get input from the keyboard?
    Answer needed here, either someone write it, or I will finish it when I get time.
    To see if key has been pressed you can use the function keypressed() Example:
    If(keypressed())
    {
    //code?here
    }
    To see what key has been pressed is very simple
    If(key[KEY_UP]) //if the arrow up key was pressed
    {
    //code?here
    }
    To find more information about the keyboard routines Allegro uses go to Allegro\docs\alleg005.html in your Allegro folder or online at the URL of http://www.allegro.cc/manual/view_ca...st=1034921901&
    2.7 How do I display sprites?
    A bitmap is a image, it is not neccesarily a file. Someone else needs to write this answer .
    Refer to 2.5 because essentially a sprite is the same thing as an image. For sprites you are going to want to either use the draw_sprite() or masked_blit() drawing functions.

    2.8 How do I use a timer?
    A sprite is a bitmap that has transparent parts. Someone else needs to write this answer, or I will finish it later.
    2.9 How do I animate sprites?
    Answer needed here, either someone write it, or I will finish it when I get time.
    2.10 How do I play music?
    Answer needed here, either someone write it, or I will finish it when I get time.

  4. #4
    Registered User
    Join Date
    Sep 2004
    Posts
    27
    Due to seeing a few questions on this, I decided to search and see if anything was listed, and I found something. Might be useful to keep this up front, but I wanted to add to it. The largest question many have...


    Q: Where do I start?

    A: Paper. Any game larger than rock, paper, scissors (and even that too if you want to get into good practice) requires good planning. What should you plan out?

    I'll just do a sample with the card game, war.

    What modules does my game need to work?
    - Cards (Structure vs. Class) (face, suit, value)

    - Main Deck <- stores initialized cards. 4 sets of 2 through Ace.

    - Player 1 Deck <- Player 1's card pool. (make one for player two as well)

    - Shuffle Function
    -- A function utilizing a secondary array of 'Cards' and rand() so that I can get some semblance of a shuffled deck.

    - Draw Top Card function
    -- A function that will take the proper card in the array, and ready the next card to be drawn

    .... the list goes on





    Working in such a manner will help organize your code and seperate tasks into much smaller chunks. Making the card game WAR is pretty intimidating to newer programmers, but making a card structure isn't really that bad. Making a function to shuffle cards into an array to act as the deck isn't too bad. It really makes things more digestible for you. And even better, is it will give you practice for that time when you and a group of people want to go and take a crack at making Quake. Commercial games take dozens of people in most instances, and a solid plan is needed in order to keep efficiency with such large groups. Thus I will reiterate in plain english.

    Planning, Planning, Planning. Design Docs, written ideas, flowcharts. It all helps more than you could imagine.

  5. #5
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    That game programming FAQ is far too outdated to be of much use IMO. A lot has changed in game programming since it was written, even in the hobbyist world.

  6. #6
    Registered User
    Join Date
    Sep 2004
    Posts
    27
    Well, actually... it's still all very useful information. I'm in college for game design specifically, and we've covered most of the stuff in the first part. Have no clue what is Allegro is though. Not all of it is still used industry wide, but I've found solutions to problems, and I am sure several other have as well, that had fallen out of practice ages ago but for some reason works very optimally in that instance.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 20q game problems
    By Nexus-ZERO in forum C Programming
    Replies: 24
    Last Post: 12-17-2008, 04:48 PM
  2. Need book to program game into multiplayer...
    By edomingox in forum Game Programming
    Replies: 3
    Last Post: 10-02-2008, 09:26 AM
  3. 2D RPG Online Game Project. 30% Complete. To be released and marketed.
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 10-28-2006, 12:48 AM
  4. C Programming 2d Array Question
    By jeev2005 in forum C Programming
    Replies: 3
    Last Post: 04-26-2006, 03:18 PM
  5. Game Programmer's AIM Circle: Join Today
    By KingZoolerius66 in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 12-20-2003, 11:12 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21