Classes - CDX - SDL - OpenLG - Direct X? Help!

Started by
8 comments, last by AcePilot 18 years, 10 months ago
Ok, My names Matt and I'am a newbaholic. Ive taken c++ in highschool and i'm going into game development for college. In order for me to get a scholarship (i need the money badly) I need to develop a simple 2D rpg, nothing big i just wanna learn the basics on developing a 2d rpg or online 2d rpg. I've herd alot about game engines and class files. All stuff that fogs up my mind like swimming in dirty water. First i'd like to know about class files? what are these!. Also i've herd people talking about Directx , Openlg , SDL and CDX. What are the following and what should i begin with and what would have the best performance for my scholarship project? If you wanna know what programming lang's ive touched on and programs , where they are: C++ (Basic's) Visual Basic 6.0(Basic's) Java(Bear Bones) For that help me i wanna give thanks, From me this nub!
Advertisement
Quote:Original post by MattBurgessAlso i've herd people talking about Directx , Openlg , SDL and CDX. !
DirectX and OpenGL are used to draw 2D or 3D graphics to the screen (DirectX is also used for playing sound, and other features). They're quite difficult for a novice to learn.

Quote:Original post by MattBurgess
I've herd alot about game engines and class files. All stuff that fogs up my mind like swimming in dirty water. First i'd like to know about class files? what are these!.

I suggest going back and actually learning C++ first off so that you know how to use the language.
Ok, i think these 'class files' you are talking about are class structures which are one of the basis for object orientated programming (OOP). These are like groups of functions and variables that have the class in common. The class itself is an object and you can create new instances (read- new versions in the memory). Mostly, at the bare minimum, they contain 2 functions- the constructor (inits the class) and destructor(cleans up the class).
They also have two sections of memory- Public where variables can be redefined outside of the class and functions can be called and the Private sections where variables can only be redefined by a class function and functions can only be called within a class function.
An example of a class can be:

class foo
{
private:
int thingy; // Can only be manipulated by internal functions

public:
foo(); // Constructor
~foo(); // Destructor
void ChangeThingy(int blah); // This function can be called outside of the instance and it changes the value of 'thingy'
};

Usually the class declarations are held within a header file (seeing as the most efficient way of using them is a modular approach) and the definitions of the variables and functions are in a seperate cpp file.
eg:
foo.h <- Holds the above code
foo.cpp <- Holds the definitions of the functions in the above code.

Second-
DirectX/OpenGL... The Big Two!

DirectX: An API to interface with the different hardware. DirectX is the group term for the suite of different APIs for media development (such as games). Such APIs include Direct3D (2D/3D Graphics), DirectSound (Sound), DirectInput (keyboard, mouse etc) etc.
Basically DirectX has everything you need to develop games. And its built to be approached object orientatedly (sp? word?)
Big Name Engines: All the Unreal engines including the 3.

OpenGL: The other graphics API (I use this one mostly). It allows you to interface directly with he gfx card. It does not have the other media interfacing features that DirectX does since its only a graphical library.
Big name Engines: Doom3/Quake(rehash)/Quake2/Quake3

The other things I haven't really looked into before so don't rely on me for a precise definition.

As for which one is best...well its the one you feel most comfortable with. Its the age old DirectX vs. OpenGL debate and sadly there is no end in sight.
Play around with both and choose the one that feels right.

As far as what you have touched on-
Many people will say on this forum you should stick with C++ (some are just fanboys [smile]). I would say that from your experience you should stick with C++ for games dev. As long as you get some of the trickier aspects under your belt you should be able to advance with game programming.

However, you do need to do quite a bit of reading up on subjects since even writing a simple 2D RPG can be quite complex when you get down the dirty of the engine.
One thing you might want to check out is:
NeHes Tutorials - Second to none as far as OpenGL tutorials are concerned.

Hope that helps
Quote:
Quote:Original post by MattBurgess
I've herd alot about game engines and class files. All stuff that fogs up my mind like swimming in dirty water. First i'd like to know about class files? what are these!.


Quote:I suggest going back and actually learning C++ first off so that you know how to use the language.

I didn't say i don't know c++, class files and headers were never taught to use in high school. The purpose of highschool computer science is to introduce us to business programming, not game dev.
If you were never taught anything about C++ classes in high school, then you are unfortunately off to a bad start on that rpg. Classes in C++ are not a gamedev thing, they are a C++ thing. Almost all progamming in C++ uses classes, thats the point of using C++ over C. I would highly recommend The Beginners Guide to C++ by Ivor Horton. He is quite excellent. When is that scholarship due btw ?
Quote:Original post by MattBurgess
I didn't say i don't know c++, class files and headers were never taught to use in high school. The purpose of highschool computer science is to introduce us to business programming, not game dev.

Than you didn't learn C++ programming in school... probably some wierd hacked up version of C/C++ mixed.. although I find it really hard to believe you didn't use header/source files with classes... you must have just had an utterly brutal teacher.

Also just FYI business and game programming are very similar at the core level.. actually completely similar. The language constructs, syntax, environments, patterns, etc all apply to both worlds. I used to work in business development and moved to game development, and quite honestly they are nearly the same other than game development being more fun :)
I think of classes as guidelines for an object. Even like templates for an
object (no, i dont mean the templates used in C++). For example, lets try
to make a class that represents an animal.

At the most basic, an animal can eat, sleep, and drink.

class Animal{    void eat();    void sleep();    void drink();};


Then, an animal also has some general info that needs to be included such
as age, and if the animal is alive or not.

class Animal{    BOOL isAlive;    BOOL isHungry;    int  age;    void eat();    void sleep();    void drink();};

At the most basic, thats it for a class. And if you want to use this in a real
program, you will need the definitions as well.

// animal.hclass Animal{    BOOL isAlive;    BOOL isAwake;    BOOL isHungry;    BOOL isThirsty;    int  age;    void eat();    void sleep();    void drink();};// animal.cpp#include "animal.h"void Animal::eat(){    isHungry = FALSE;}    void Animal::sleep(){    isAwake = FALSE;	}    void Animal::drink(){    isThirsty = FALSE;}


This is how to create an animal:
 Animal *mypet = new Animal(); 

This is like reading the guidelines for an Animal, then actually creating an animal named "mypet".
Now you can work with that animal.

#include <stdio.h>#include <conio.h>#include "animal.h"int main(){    Animal *mydog = new Animal();    mydog->age = 3;    mydog->eat();    mydog->sleep();    if(mydog->isAwake)        {	    printf("mydog is sleeping");        }    return 1;}
Like i said in school i was only taught the basic's, like the very very basic's remember this is highschool not college, or university. Some schools are lucky enough to have that much. And my scholarship isn't due for a year from now. i want to really thanks AcePilot for those examples it really help understand what a class file is. Now i have a small question don't go wack on me a i'am a newb whats does the "->" define in c++ or the code "void Animal::eat()" thanks :)
"
Quote:void Animal::eat() { }


I assume that you are wondering what the "Animal::" part is about. Since
the definition of the function is outside the main body/scope of the class,
the compiler needs to know that this definition is for the Animal class.
Because if we just put "void eat() { }", then the compiler will consider it
as a global function, i mean a function without a class, like the ones in C.

Quote:Now i have a small question don't go wack on me a i'am a newb whats does the "->" define in c++


Sorry! [smile].
For the "->" operator, it means that you want access inside a pointer.
For example there are two valid ways to declare an animal.
 Animal *mydog = new Animal();// orAnimal mydog();


both will work, but the first one gets a pointer to the mydog and the other
one just gives you the real thing. So if you are using the first one,
you gotta use the "->" because its a pointer, and for the second one, you
can use a "." .

Animal *mydog = new Animal();mydog->sleep();// orAnimal mydog();mydog.sleep();


If you are confused about pointers, and want more advanced info on classes,
visit www.cplusplus.com

Glad I was of help,
AcePilot






This topic is closed to new replies.

Advertisement