Thread: Starting games - books? api?

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    18

    Starting games - books? api?

    Okay, I know c++ fairly well and have done several text-based games like battleship, hangman, and such.

    I am wanting to start graphics programming now. I am thinking that I want to use DirectX since that seems to be the most powerful API, although it'd be major overkill for the programs I'm wanting to start out with ( I'm wanting my first games to be Chess and Blackjack or something ). After I program one or two simple games, what I'd really like to be able to do is program a game similar to Command & Conquer. I have searched a bit for DirectX books but have been totally lost. A few review sites recommend a book called "Programming Role Playing Games with DirectX 8.0", although I want a book that teaches more any sort of game. I have also touched into the Windows API using Petzold's "Programming Windows". Also, I don't know what software I need to get started... all I have now is MSVC++6.

    I much prefer books to online tutorials, preferably one that actually works through an actual example or two (like I think Sams Teach Yourself books do).

    Any advice would be greatly appreciated.

  2. #2
    Registered User
    Join Date
    Sep 2002
    Posts
    69
    I have to recommend you try SDL.

    It is cross-platform, powerful (has been used in several commercial titles for Linux), and robust.

    There is a good book that you can get for free now as well, called Programming Linux Games, but it focuses on SDL and OpenAL (a 3D sound library, also cross-platform and used in games such as UnrealTournament 2003) and should help you using SDL in Windows as well. I code in Win2K at school, and I use that book. Get the book here: http://www.overcode.net/~overcode/writing/plg/

    Get the library here: http://www.libsdl.org/

    I use VC++ 6.0 at school, so I know it works.

    Oh, the PLG book teaches a parallax scrolling game. It does network, sound, etc..

    It's at least worth checking out. IMHO.

    I've heard it's easier to learn than DirectX as well, though I only used DirectX via DelphiX.
    D. Olson
    The Mandrake eXPerience
    Battle Pong

    IDE: kate 2.0
    Compiler: gcc 3.2
    Graphics/Input/Net: SDL 1.2.5 (pdf)
    3D Audio: OpenAL (pdf)


    I am a signature virus. Please add me to your signature so that I may multiply

  3. #3
    Registered User
    Join Date
    Sep 2002
    Posts
    69
    Oh yeah, I should mention, you could just skip this and use GDI. I hear it's really fast and better than DirectX and stuff.

    I don't know because it's Windows-specific and I don't use it though.
    D. Olson
    The Mandrake eXPerience
    Battle Pong

    IDE: kate 2.0
    Compiler: gcc 3.2
    Graphics/Input/Net: SDL 1.2.5 (pdf)
    3D Audio: OpenAL (pdf)


    I am a signature virus. Please add me to your signature so that I may multiply

  4. #4
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    you could just skip this and use GDI. I hear it's really fast and better than DirectX and stuff.
    Are you trying to mock me? Because I think it's just going to confuse sean...

    Sean, DirectX is of course one of the most powerful API's. GDI, however, is built into Windows and is useful for small and simple programs. It is slow but in my opinion very adequate for simple games as well. Also, it is used in DirectX programs for some things such as loading bitmaps, although not usually (ever?) for graphics. SDL might be a good choice to begin with; but personally, I started out with GDI (although I never tried SDL - it might be better).

    P.S. if you don't use Windows, don't bother with GDI

    P.P.S. Chess might get pretty complicated... I suggest tic-tac-toe to start out with or something like that.
    Last edited by Hunter2; 11-18-2002 at 01:34 PM.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  5. #5
    Registered User
    Join Date
    Sep 2002
    Posts
    69
    Originally posted by Hunter2
    Are you trying to mock me? Because I think it's just going to confuse sean...

    Sean, DirectX is of course one of the most powerful API's. GDI, however, is built into Windows and is useful for small and simple programs. It is slow but in my opinion very adequate for simple games as well. Also, it is used in DirectX programs for some things such as loading bitmaps, although not usually (ever?) for graphics. SDL might be a good choice to begin with; but personally, I started out with GDI (although I never tried SDL - it might be better).

    P.S. if you don't use Windows, don't bother with GDI

    P.P.S. Chess might get pretty complicated... I suggest tic-tac-toe to start out with or something like that.
    I have to agree. Chess has a lot of rules and I've never really even understood it, while Tic Tac Toe AI is pretty straight forward.

    DirectX is also built into Windows, since about Windows 98... As well, if you install a game, chances are good that it requires it. The SDK is pretty big, IIRC... Prolly over 100MB or so... Not 100% sure, as I downloaded it once long ago. SDL isn't very big to download, and all you need is a small DLL or two put into your System folder to allow SDL programs to run. And if you ever use Linux, most distributions come with it.

  6. #6
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Tic Tac Toe AI is pretty straight forward.
    Especially if you just make it pick random spots

    The GDI doesn't need a SDK, and you don't need to download the SDK either
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  7. #7
    Registered User
    Join Date
    Nov 2002
    Posts
    18
    I don't think the algorithms for chess should be a problem for me, as I've already made a chess game in Java. Also, after everyone's helpful post's I think I've pretty much decided on either DirectX or GDI. What are the main differences between these? Also, what books would you recommend for either one? I'm sure both of these questions would be on previous message threads as well, so I'll be sure to search those, as well.

    Olson - you said GDI is better than DirectX - how is this?

    I'm wondering what api most commercial games are programmed with. I realize that I won't be making games nearly as complicated, but nevertheless I think that I'd like to learn one that could at least possibly give me some experience for a programming profession, which is what I'm currently in school for.

    Thank you for your help.

  8. #8
    Registered User fry's Avatar
    Join Date
    Mar 2002
    Posts
    128
    Commercial games are pretty much all made with either DirectX or OpenGL.

    They are both good, but the learning curve is often a bit steep when your just getting into it.

    GDI is good to learn the basics, but as was said, it can be a bit slow for games (unless they are basic games). Though it is probably the best option if you want to learn something inside out.

    SDL and Allegro are pretty similar, and both have support to use OpenGL on top of them. You can get some very good results with these much faster than GDI, and learning curve is very simple, but you wont want to learn them inside out if you plan to move onto DirectX or OpenGL. Both these are good to get some quick results, if thats what your looking for.
    IDE: Dev C++ 5
    Lib: Allegro
    OS: Windows 2000

  9. #9
    Registered User
    Join Date
    Sep 2002
    Posts
    69
    I think anything is better than DirectX.

    I don't like GDI, but I'm sure I'd like it better than DirectX... But if I had to use DirectX, I'd be using Delphi, not C/C++.

    If you want to do stuff that works on multiple platforms (Linux, Win32, BeOS, MacOSX, etc) then SDL is really the only way to go.

    There are a bunch of links in my sig, if you want to go that route.

    EDIT: if you are gonna pick between DirectX and OpenGL, I would recommend you go with OpenGL. The name says "open" for a reason. You won't see DirectX on Linux/Be/whatever any time soon.
    D. Olson
    The Mandrake eXPerience
    Battle Pong

    IDE: kate 2.0
    Compiler: gcc 3.2
    Graphics/Input/Net: SDL 1.2.5 (pdf)
    3D Audio: OpenAL (pdf)


    I am a signature virus. Please add me to your signature so that I may multiply

  10. #10
    Registered User fry's Avatar
    Join Date
    Mar 2002
    Posts
    128
    then SDL is really the only way to go.
    Allegro and OpenGL also run on every platform
    IDE: Dev C++ 5
    Lib: Allegro
    OS: Windows 2000

  11. #11
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    Sean, if I were you I would listen to what fry has to say.

    But just to let you know, OpenGL is not a complete API. It is only a graphical API, so that means you are going to have to use another API for the other routines involved with games. Which is where Allegro and SDL come into play.

  12. #12
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    I think anything is better than DirectX.
    Why is that?

    Olson - you said GDI is better than DirectX - how is this?
    It's not Olson was being sarcastic.

    I don't like GDI, but I'm sure I'd like it better than DirectX
    Why is that? DirectX is a much more powerful (and versatile, whatever that means ) API to use. And, for that matter, GDI is only for graphics, and 2D graphics at that, while DirectX is used for input, graphics, sound, networking, and other fun stuff.

    Also, after everyone's helpful post's I think I've pretty much decided on either DirectX or GDI.
    Unless you're a really really quick learner, I suggest starting with GDI; it's simpler, and it comes with a plethora of built-in stuff to use. With DirectX, you have to manually do more things.

    **EDIT**
    I hear GDI's harder to learn than Allegro though, since it's kinda hard to figure out what everything does in GDI (it sometimes works sort of counter-intuitively).
    Last edited by Hunter2; 11-19-2002 at 05:50 PM.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  13. #13
    Registered User
    Join Date
    Sep 2002
    Posts
    69
    Originally posted by Hunter2
    Especially if you just make it pick random spots
    I noticed that... But there is really efficient tic tac toe "AI" that can be written up quite easily... I did it in Pascal a long time ago, and it works nicely.

    I could dig up the source if you're interested. I played your tic tac toe game today at school, and the computer didn't win once... Not that that should happen, but I shouldn't win every time on my third piece.
    D. Olson
    The Mandrake eXPerience
    Battle Pong

    IDE: kate 2.0
    Compiler: gcc 3.2
    Graphics/Input/Net: SDL 1.2.5 (pdf)
    3D Audio: OpenAL (pdf)


    I am a signature virus. Please add me to your signature so that I may multiply

  14. #14
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Efficient AI? Mind sharing?
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  15. #15
    Registered User
    Join Date
    Sep 2002
    Posts
    69
    Originally posted by Hunter2
    Efficient AI? Mind sharing?
    Sure. When I get some time, I'll look for the source. It's probably on one of my REALLY OLD CD-RWs... It could take years... Hopefully not though.
    D. Olson
    The Mandrake eXPerience
    Battle Pong

    IDE: kate 2.0
    Compiler: gcc 3.2
    Graphics/Input/Net: SDL 1.2.5 (pdf)
    3D Audio: OpenAL (pdf)


    I am a signature virus. Please add me to your signature so that I may multiply

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reference Books at Work and Home
    By kuphryn in forum Tech Board
    Replies: 2
    Last Post: 05-20-2004, 05:59 AM
  2. a good windows API programming book
    By jpchand in forum Windows Programming
    Replies: 3
    Last Post: 10-10-2003, 06:37 AM
  3. FILES in WinAPI
    By Garfield in forum Windows Programming
    Replies: 46
    Last Post: 10-02-2003, 06:51 PM
  4. Video Games Industry. 5 years left.
    By Cheeze-It in forum A Brief History of Cprogramming.com
    Replies: 26
    Last Post: 12-10-2002, 10:52 PM
  5. Books Books Books
    By aresashura in forum Game Programming
    Replies: 5
    Last Post: 12-28-2001, 09:08 PM