Thread: General Steps a game should have

  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    11

    General Steps a game should have

    I've just begun programming in C++ to make actual games, and I was wondering what the general steps should be?

    This will be openGL. I know I have to include commands for moving, commands for outputting, commands for loading, etc. I'm not sure exactly what order things should be done. Should I put everything in one big loop inside the main loop? HELP!

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    First things first. You say you have just started learning C++ right?? I suggest you do some more C++ before venturing into games. Games are among the hardest things you can program because of the complexity of it all.

    I reccomend that you dont venture into games yet. Program more and learn more about the logic and problem-solving.
    STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.

  3. #3
    Registered User
    Join Date
    Apr 2006
    Posts
    11
    I've just begun programming in C++ to make actual games

    That doesn't mean I'm just starting c++ programming. Also, not to be rude, but i'm not asking if you think I can do it... i'm asking how i should begin. Thanks.

  4. #4
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    Well, that can be interpreted in different ways.

    All loading should be done before the main loop. As for the rest...there are many ways you can do things. One way is messagebased approach (something similar to Win32). In the mainloop everything else will be done...one way or another. It is here the problem come; how will it be done? I cant answer you on that though.

    I would advice you to think strongly on the layout of things. What classes do you need. What should those classes do and so on. Think strongly on this since if you dont have a good layout the game will soon become unstructed to the point where you cant implement the things you want. Possibly read a book on the topic aswell.
    STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.

  5. #5
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    One possible approach might be using "modules" as jverkoey describes in this article. And make sure you read the discussion as well.
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  6. #6
    Registered User
    Join Date
    Apr 2006
    Posts
    11
    Thanks guys. Also, sorry about how I worded it up there ^^, didn't mean to offend if I did.

    Any other help is welcome!

  7. #7
    User
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    499
    It's a good idea to use GLUT for windowing and other tasks; it makes your code highly portable, and simplifies things such as creating and displaying the game window.

  8. #8
    Registered User
    Join Date
    Apr 2006
    Posts
    11
    In C++, can you run multiple loops at a time?

    Or would I have to order the steps to they all change before the loop continues? This is the main problem i'm seeing.

  9. #9
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Quote Originally Posted by Atolar
    I've just begun programming in C++ to make actual games

    That doesn't mean I'm just starting c++ programming.
    Quote Originally Posted by Atolar
    In C++, can you run multiple loops at a time?
    You can do things like this
    Code:
    for (int i=0;i<10;i++)
    {
       for (int j=0;j<20;j++)
       {
          //Do something
       }
    }
    Or if you are talking about having two loops running independently at the same time then you'd need to using multi-threading. Multi-threading isn't part of c++ and is OS specific.

    A basic game loop is like this
    Code:
    while (GameRunning)
    {
       GetInput();
       UpdateGameworld();
       Render();
    }
    This would all be done once each frame so it would apear to happen at the same time.

  10. #10
    Registered User
    Join Date
    Apr 2006
    Posts
    11
    Ok, thanks quantum, that's what i was looking for.


    Although what's the difference between UpdateGameworld() and Render()?

  11. #11
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Updating the gameworld includes moving objects based on the players input and doing pysics calculations etc.
    Rendering is the process displaying your gameworld.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C# - Building a SCUMM-like game.. questions
    By Iyouboushi in forum Game Programming
    Replies: 0
    Last Post: 05-24-2008, 10:54 PM
  2. my upcoming UNO card game :)
    By Hussain Hani in forum Game Programming
    Replies: 5
    Last Post: 01-24-2008, 01:19 AM
  3. Please comment on my c++ game
    By MegaManZZ in forum Game Programming
    Replies: 10
    Last Post: 01-22-2008, 11:03 AM
  4. Engine <=> DX/OGL | c++ ?
    By darkcloud in forum Game Programming
    Replies: 6
    Last Post: 05-13-2005, 12:19 AM
  5. Someone help me with this game??
    By stehigs321 in forum Game Programming
    Replies: 15
    Last Post: 10-30-2003, 09:42 PM