how to start with game

This is a discussion on how to start with game within the Game Programming forums, part of the General Programming Boards category; I have compleated reading windows game programing for dummies and I want to make a 2d game useing directX. How ...

  1. #1
    Unregistered
    Guest

    Question how to start with game

    I have compleated reading windows game programing for dummies and I want to make a 2d game useing directX. How should I start with the game? I cant decide what to do first (interms of coding.

  2. #2
    Ethereal Raccoon Procyon's Avatar
    Join Date
    Aug 2001
    Posts
    189
    First write a few simple test programs based on what you think you've learned. See if you can get individual elements like graphics and sprite creation/loading working. When you're done with that, plan out the game's basic mechanics. Then translate to paper, then to pseudocode, then to code. Make an ultra-stripped-down, barely functional (but playable) version of your game system, and improve upon it by adding new features until you're done.

    That's how I'd do it.

  3. #3
    Vicster
    Guest
    Well, here's how *I* go about beginning. I'll use the specific example of a tile-based game, but the ideas would apply to other kinds of games as well.

    1) Display something, really, ANYTHING. If your game runs in a window, write something to that window. Fullscreeen, set the graphics mode and output anything at all. If you are going to use DirectX, use directX for this test; same goes for OpenGL or any other API. Use WinAPI graphics commands sparingly, if at all.

    2) Trap keystrokes, so you have input to your program.

    3) Create bitmaps for at least a single tile, and get this tile to display all over your screen.

    4) Create a file format for your tileset, as you probably don't want to use a thousand BMPs to store your data. Make sure you can read/write correctly to your new filetype.

    5) Create a few background tiles, and make your display show a few different ones. For now, you can hardcode which tile is blitted where.

    6) If you are using something like DirectX, make a single, large offscreen surface for your tileset. This will make blitting tiles MUCH faster. Make sure your tiles load into this, and make sure you can blit them to the back buffer successfully.

    Now, at this point, you've got tiles appearing on screen. You can't do anything, but you've got at least the basics of a graphics system down.

    Once you've got the basics of a tile engine done, you now need to control HOW the tiles display, so that should be your next goal:

    7) Create a file format for your maps. Make sure you can create them (and you'll probably want to make a graphical map editor), and try to get the screen to show your map.

    8) Now, the last really tricky part about graphics is to do two things:

    * Only copy the parts of the image that need updating, and
    * Allow the window to scroll. As a rule of thumb, I find that scrolling a 640x480 window by 32 pixels in 5/30s of a second (or 5 redraws, assuming you draw 30 frames a second) is a good speed for scrolling. You can tweak this to taste.

    Now, you have the basic display down. Once you've learned to move the background image, moving sprites is pretty easy.

    Your main graphical challenges now are sprites and overlays (tiles which have transparent regions, so they can be "above" other tiles/sprites). Using DirectDraw, this is pretty easy.

    You then need to tackle the non-graphical aspects. You should probably begin working on the functionality of areas -- you have a map, now make it DO things. Make tiles impassable or passable, add actions, add ways to move to other areas, add NPCs.

    After you've got a good proto-game, like you will if you've done all these things, you can work on anything -- like sounds & music, enemies, etc.

  4. #4
    Frustrated Programmer :( phantom's Avatar
    Join Date
    Sep 2001
    Posts
    163
    I'll just repeat what they have said, start very small. But each time write out pseudo code first, you may think you don't need this code before doing a small game but it's worth getting into the habit.
    My site to register for all my other websites!
    'Clifton Bazaar'

  5. #5
    Registered User Esss's Avatar
    Join Date
    Aug 2001
    Posts
    133
    The board FAQ http://www.cprogramming.com/boardfaq.html has links to tutorials which will help you, including one that will guide you through the process of making a game.

    > 4) Create a file format for your tileset, as you probably don't want to use a thousand BMPs to store your data.

    It's worth bearing in mind that you can get many, many tiles in a single bitmap. Not to mention that loading bitmaps into a surface is a task better left to sample code, initially. Custom file formats require editors and loaders, and when you can use a single bitmap to do it, why bother?

    > * Only copy the parts of the image that need updating

    God forbid. This precludes page flipping, and you really don't want to do that, do you?

    I highly recommend using DirectX Graphics 8 to do your 2D sprites - as well as a speed increase on newer cards, you'll get alpha-blending support.
    Ess
    Like a rat in a maze who says,
    "Watch me choose my own direction"
    Are you under the illusion
    The path is winding your way?
    - Rush

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Adventures in labyrinth generation.
    By guesst in forum Game Programming
    Replies: 8
    Last Post: 10-12-2008, 01:30 PM
  2. craps game & dice game..
    By cgurl05 in forum C Programming
    Replies: 3
    Last Post: 03-25-2006, 06:58 PM
  3. Where do i start game programming
    By knight543 in forum Game Programming
    Replies: 12
    Last Post: 01-11-2002, 09:23 AM
  4. Easiest 'real' game to start with...
    By Leeman_s in forum Game Programming
    Replies: 9
    Last Post: 01-03-2002, 12:52 PM
  5. Easiest 'real' game to start with...
    By Leeman_s in forum C++ Programming
    Replies: 9
    Last Post: 01-02-2002, 10:29 AM

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