Sign in to follow this  

2 Questions...

This topic is 4667 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have two important questions on how to transform C++ into the game itself. I am an early beginner, and just want to visually see what is beyond the C++ code. So the following questions are described as best as I can describe them... What is it that is used to program C++ into games? I have tried researching this on my own time, but found it confusing, my oppoligies. e.g. (Dirrect-X, Dirrect-Draw) I am still uncertain if this is another language, or a large function in a computer language that already exists.(if you have not already answered this in my first question) Anything else you feel is important for me to know at this point, I encourge you to bring up, thanks.

Share this post


Link to post
Share on other sites
Assuming that you mean commercial games, like for xbox or PC, I'm pretty sure they use mainly the Direct-* headers.
To your other question, Direct-X and Direct-Draw and all the other Direct headers are C++. they are headers. What they are is code that does not have a main() function, but code that simply has the functions to draw to the screen.
PS.
xbox means Derect-X box.
[edit]
Fixed spelling error.
[/edit]

Share this post


Link to post
Share on other sites
When you write a program (a game or otherwise) using your language of choice (in this case, C++), you typically write your code with the aid of a program known as an IDE, or Integrated Development Environment. Your IDE will normally contain tools to help you out - some of the things a typical IDE may contain include a text editor with syntax highlighting (for writing your code - the syntax highlighting makes keywords a different colour), a debugger (to help you find errors), and a compiler among other things.
(further info on IDEs @ wikipedia | @ GDNet Game Dictionary)

To make an executable file (on the Windows platform, not all platforms use executables), you must compile your source code using a compiler. This basically converts your human-readable sourcecode into a form the computer can understand and run.
(further info on compilers @ wikipedia | @ GDNet Game Dictionary)

DirectX is one of many APIs, or Application Programming Interfaces (DirectDraw is a now defunct subset of DirectX for handling 2D graphics (you can still use it if you want)). An API generally acts as a layer between the program and the operating system and/or hardware, providing simpler functions for programmers to work with. The DirectX API includes code for Graphics, Sound, and Input Handling among other things. Some other common graphics APIs include OpenGL (some OGL tutorials) and SDL (some SDL tutorials).

As a beginner, you would probably be wise to start off with learning the basics of the language, and making a few simple games (guess the number, hangman, tic-tac-toe, et al), in console mode (ie. text mode) before delving into any of the more advanced APIs, as a good grounding in the basics of the language will serve you well. For some more general beginners information, as well as links to some good free resources (including some compilers, IDEs, tutorials, etc), if you havn't done so already, please check For Beginners and The For Beginners Forum FAQ.

I hope that answers your questions. [smile]

Share this post


Link to post
Share on other sites
If the other posts answered your question, great. I'm going to assume they didn't answer what you are really asking, just in case :).

"What is it that is used to program C++ into games?"

I'm going to assume you already know what is used to turn C++ source files into standard programs like hello world [#include <iostream> int main(void){ std::cout << "hello world" << std::endl;}] - cause the answer to that is a compiler, and if you want more info on those, just ask us to explain the basics of compilers and building programs ...

But assuming you know how to make programs, a GAME is usually different in that it used more advanced multimedia features than a simple college c++ lab assignment. These multimedia features are made available to you (the programmer) in the form of LIBRARIES. To use these libraries you usually need AT LEAST some header files for them (which tells the compiler what functions they contain, and what arguments the functions take). If these libraries are large, they are usually packaged into something called an SDK. Which stands for Software Development Kit. There is no rule on what these contain, but usually they include the header files for the library, the libraries themselves (the binary files [.dll and .lib on windows], help files and documentation for the libraries, sample projects and code showing you how the libraries are used.

So in the case of DirectX. First you install your compiler (like Visual Studio, Borland, Dev-C++, whatever). Then when you want to try to use a library like DirectX, or SDL or whatever, you download the SDK and install it - and walk through the document that tells you how to CONFIGURE your compiler to USE the SDK (your compiler needs to know where the SDK is, so it can find the libraries files).

Then you look at documentation and samples to see what kind of stuff you want or have to do.

Then you write your own code, using / calling things in the library ... and watch amazed as your screen goes black and smoke comes out of your computer :) (j/k).

....

DirectX is a library, which contains other libraries (DirectDraw, Direct3D, DirectSound, DirectMusic, DirectInput, DirectPlay, DirectShow, ...)

DirectDraw is the old 2D graphics library for DirectX

Direct3D is the 3D graphics library for DirectX (and DirectDraw is not needed even for 2D games anymore, they can be done well using Direct3D)

OpenGL is another 3D graphics library (that works on Windows, Mac, Linux, etc ...

GLUT is a helper library for doing basic things commonly needed for simple OpenGL programs [I HIGHLY RECOMMEND YOU USE GLUT TO DO A FEW VERY SIMPLE THINGS ... then you will understand what a library is and how you use one ... cause GLUT makes it VERY easy to get a window on the screen with very basic graphics in it] (nehe.gamedev.net should help here)

SDL is another library for helping you write games (it has functions for windows, mouse, keyboard, joystick input, audio playing ... etc)

Share this post


Link to post
Share on other sites
I have to thank you for the help, you answered many questions which was helpful. At first I didn't even know what did what after the C++ stage. I have been working with a Dev C++ compiler, as well as reading a book. I probably won't be going to indept with the Direct-X for a while yet, if all goes well though, I will use the knowledge of what I have to make a game with Direct-X in it, in a month or two from now. I will have to keep the sources that you gave me, they really help a lot.

Share this post


Link to post
Share on other sites
Quote:
Original post by Xai
Direct3D is the 3D graphics library for DirectX (and DirectDraw is not needed even for 2D games anymore, they can be done well using Direct3D)


I believe it's simply known as DirectGraphics now (no need to specify 2D/3D, as it's the only graphics component).

Some good articles on many aspects of DirectX can be found in the reference section here when you're interested in starting with DirectX, and if you don't already have the DirectX SDK, you can download it for free from Microsoft, here.

It's fairly common advice to try a different API, such as SDL before jumping into DirectX, as it's considered easier for beginners, and you should definately do some console mode learning projects first to get a good grounding in the basics of the language.


Btw, nice post Xai, I think between the 3 of us that should cover the OPs questions nicely, I liked your detailed explanation.

Share this post


Link to post
Share on other sites
Quote:
Original post by Rarefreak
I have to thank you for the help, you answered many questions which was helpful. At first I didn't even know what did what after the C++ stage. I have been working with a Dev C++ compiler, as well as reading a book. I probably won't be going to indept with the Direct-X for a while yet, if all goes well though, I will use the knowledge of what I have to make a game with Direct-X in it, in a month or two from now. I will have to keep the sources that you gave me, they really help a lot.


Excellent, glad all of us managed to help you. [smile] Let us know how it turns out!

Share this post


Link to post
Share on other sites

This topic is 4667 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this