Jump to content

C, C++ ?? which one is the way to go for developing games for a beginner?


MasterACE14

Recommended Posts

hey guys,

 

Just wondering, what language is better for first person shooter games similar to that of Counter Strike Source, Half Life 2, Team Fortress 2, that sought of standard. C or C++ or something else??

 

And could someone let me know what program you use to program in these languages?

 

I would like to start learning them at some point and am interested in learning of where I should start?

 

Regards ACE

Link to comment
Share on other sites

If I were you I would learn C++ and as you go along you will have learnt most of what you need to program in C if you ever need to. Most tutorials you come across will explain that C++ is an extension of the C language adding object orientation and generics to the language. The C libs are contained in the C++ library but with a C in front of their names such as <math> in a C program and <cmath> in a C++ program. So from learning C++ you will have a fairly good grasp of what is available in C also.

Link to comment
Share on other sites

to be honest, any decent programming language can teach you the principles of game development quite well. before getting into web development, i used to be heavily into games development as i loved the maths for stuff like trajectories, AI, etc. I used to do my early code in Pascal or Basic. Whilst you wont get commercial results along the lines of the examples you've given, you'll get both:

1, an idea of the maths that goes into any game, never mind a 3D one

2, generic concepts of programming that you can apply fairly easily to any "advanced" language.

 

I've heard some decent reviews of C# from those that use it. The only issue is, to the most extent, it ties it down to Windows OS's. Sure, there are cross-compilers, but I tend to find this sort of practice quite messy.

 

Either way, there are free/cheap applications that I would recommend choosing from:

- dev c++ - free IDE for the free GCC compiler

- BlitzBasic - not free but quite cheap. Do not underestimate Basic (especially this one) as a good knowledge foundation before moving on.

- Visual C++/C# - I think theres a free 'express' version of Visual Studio that has these

- Turbo C/C++ - Freely downloadable now as they're quite old, but they are very simple and do have their uses in teaching the basics of the language. Anything you learn is definitely still applicable to more recent versions of the language.

 

Don't expect though to be able to code the next Halo overnight - it will take you YEARS of hard work and learning. I remember my first 3D "world" - nothing but flat walls, no textures, etc - the maths involved already got quite intense. In fact, I'd recommend staying away from 3D programming to start with anyway, as 2D has enough to begin with. Having said that, ID Software do have a good collection of their back-catalogue source code (Doom, Quake, etc) available to download and see how it all works. SourceForge too is a good resource for 3D games, and may also give you a better idea of what languages are used than you'll get from a PHP forum ;)

 

Good luck.

Link to comment
Share on other sites

C++ for heavily 3d, graphics intensive games. Plan on spending several years of your life, learning some really hard shit.

 

Flash, for easily distributable, quick to write games, that are still fun to play.

 

yeah thats true. I've worked with flash before.

 

---

I have another question, How much knowledge of PHP can be used in C, C++ ? I understand C and C++ are both object orientated, so the knowledge of PHP OOP can carry over partly to C and C++ ?

Link to comment
Share on other sites

I've just read through this tutorial: http://www.cplusplus.com/doc/tutorial/ and stopped at classes(I)

 

It is all making sense and I have put all the examples into practice. But Im abit lost with something.

 

All the examples I compile and run them and they run in command prompt no problem. But how do I make an actual interface?

 

how can I make say a Main Menu that comes up, and say it has 2 buttons and a heading, 1 button says "Calculator" and goes to a calculator page when clicked on, and the other button says "Exit" and closes the program when pressed.

 

How do I make the actual interface/layout/template whatever. for the program I make in C++ ?

 

 

---

EDIT: I think I may of found what i was looking for, I'm using Dev-C++ as my editor, and I hit File > New > Project... , and it came up with a few options such as console, static library and windows application. I'm guessing thats it, I'm giving Windows application a go.

 

heres what came up when i chose window app.

 

#include <windows.h>

/*  Declare Windows procedure  */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

/*  Make the class name into a global variable  */
char szClassName[ ] = "WindowsApp";

int WINAPI WinMain (HINSTANCE hThisInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpszArgument,
                    int nFunsterStil)

{
    HWND hwnd;               /* This is the handle for our window */
    MSG messages;            /* Here messages to the application are saved */
    WNDCLASSEX wincl;        /* Data structure for the windowclass */

    /* The Window structure */
    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
    wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
    wincl.cbSize = sizeof (WNDCLASSEX);

    /* Use default icon and mouse-pointer */
    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL;                 /* No menu */
    wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
    wincl.cbWndExtra = 0;                      /* structure or the window instance */
    /* Use Windows's default color as the background of the window */
    wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;

    /* Register the window class, and if it fails quit the program */
    if (!RegisterClassEx (&wincl))
        return 0;

    /* The class is registered, let's create the program*/
    hwnd = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           szClassName,         /* Classname */
           "Windows App",       /* Title Text */
           WS_OVERLAPPEDWINDOW, /* default window */
           CW_USEDEFAULT,       /* Windows decides the position */
           CW_USEDEFAULT,       /* where the window ends up on the screen */
           544,                 /* The programs width */
           375,                 /* and height in pixels */
           HWND_DESKTOP,        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           hThisInstance,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

    /* Make the window visible on the screen */
    ShowWindow (hwnd, nFunsterStil);

    /* Run the message loop. It will run until GetMessage() returns 0 */
    while (GetMessage (&messages, NULL, 0, 0))
    {
        /* Translate virtual-key messages into character messages */
        TranslateMessage(&messages);
        /* Send message to WindowProcedure */
        DispatchMessage(&messages);
    }

    /* The program return-value is 0 - The value that PostQuitMessage() gave */
    return messages.wParam;
}


/*  This function is called by the Windows function DispatchMessage()  */

LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)                  /* handle the messages */
    {
        case WM_DESTROY:
            PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
            break;
        default:                      /* for messages that we don't deal with */
            return DefWindowProc (hwnd, message, wParam, lParam);
    }

    return 0;
}

 

I guess thats what I was looking for... I'll have to find out :D

 

---

EDIT again... : that appears to be it. I'm just alittle confused as to how you incorporate your different files into that template? I don't think C++ has a include(); function :/

 

Link to comment
Share on other sites

One point I would make there also is learn the difference between standard ansi C++ and the little extra bits that creating programs through a windows IDE give you. On the whole an IDE that has project templates for a win32 application and then includes <windows.h> & <stdafx.h> (or whatever it is) is linking you to windows libs that are not part of the C++ standard. The same with the whole way that the winmain() method is created.

 

On your windows machine it makes your programs simpler and getting a windowed application simpler but just be aware that this is not a part of C++. There are other ways of creating windowed apps and depending on where you end up working you may need to know the difference.

Link to comment
Share on other sites

C++ And C Are okay for making games, The language I use is called "TorqueScript", Maybe you should look into it; Its a great language for programming physics. Also before u get into learning on how to incoperate windows libs if u have never leaned C++ before it may be a good idea to start off learning how to program with the basics, yes Im talking about <iostream.h>, but if you have never done the iostream stuff and you can already use windows libs then congradulations to you because you are doing stuff most beginners into C++ cant do! But if you have programming experience in PHP or Java Or Javascript then for sure you can skip the first few sections of C++ because even though they look very diffrent the languages are very similar.

 

Best luck to you in your new programming language.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.