Thread: my second coming

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    118

    my second coming

    hi there i would like to ask for some advice i have recently started to make games again. i made one game before using sdl which was ok but never finished and polished.

    the game i made i didnt really use classes and as a novice c++ programmer i fell the coding of the game was the easy part.

    ok my question is how do you start designing a game i mean how do you decide the classes to use and which functions will belong to which class.
    ok that might sound easy but i normally position things on screen manually and work out my collisions manually which is ok until i need to change the window size so either a little advice or maybe a link about the design of a game would be much appreciated.

    thanks in advance

    edit: ok maybe using a tetris clone as an example? what classes would you use im fairly sure once i got the idea of classes i could code them together its just the picking choosing of classes that gets me. how do you decide which classes are needed. thanks again
    Last edited by thestien; 12-16-2007 at 04:07 PM.

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Deciding classes and such are never easy and there's never a must-do example.
    But the general idea is to consider classes as objects, so in a tetris game, a class of the falling parts, one base class for them and from them derived classes for each type of part since they have different properties. If anything, their dimensions would be specified in a derived class.
    One class for the actual room where the blocks fall. It must contain a vector with all the parts inside. It will also probably be the one that's responsible for seeing if there are any full lines are for collision detection. Each part class will probably keep track of its own coordinates in the room.

    There's more, to be sure, but just off-hand, I cannot say. It will come to you when you start designing the whole thing. You just need to know what tools are available to you and think logically how they might fit into a solution for your design problem.

    There's going to be polymorphism and virtual functions too (due to the base class).
    Other might give you a different answer. It's up to the designer, really. A good implementation is one that will require you to do little code in sense of checking this and that, one might say. Or I don't really know how to explain it.

    In any case, you really have to try and pan it out yourself. There are no definite rules for layout.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    Dec 2005
    Posts
    118
    thanks for your advice i appreciate it and will try now to use it and put the pieces into perspective my aim for now is to make a packman clone for my daughter but i thought mapping the collisions for everywall would be tiresome and also i would need to do that for each map i made so i decided that i should start with a tetris clone maybe to get the idea ball rolling.

    i have used sdl before but i am going to try using open gl so that i can create 3d games in the near future. would you advise me to do this or should i go back to sdl until i have more game programming and genral programming experience?

  4. #4
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968
    I'd stick with whatever was simpler to begin with, if you already have a bit of SDL experience I'd suggest sticking with it. I tried to dive into OpenGL but got overwhelmed with it, I was trying to create a far too advanced rendering system for my knowledge.

    Now I'm working on a text blackjack game and learning is coming much easier.
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I haven't used SDL at all, so no ideas there.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Stay with SDL because you can use openGL if you want. Personally I find SDL gets in the way too much (my opinion), so I use glfw instead.

  7. #7
    Registered User
    Join Date
    Dec 2005
    Posts
    118
    ok thanks i think ill go back to sdl for now as opengl seems to be more for 3d and less forgving toward 2d?

    wow its not until u try to make tetris that you realsie its a bigger task than ive ever undertook.

    so far im still on the design stage as this for me is the hardest part because i can simply find tutorial and advice for code but working out the inner functions is very hard for me at the moment.

    i have decided that i will try to make a 2d array for the grid and in turn that will draw the blocks as need be.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. The world is coming to an end.
    By NeonBlack in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 12-28-2007, 09:41 AM
  2. Aktif 6.0 coming eventually...
    By doubleanti in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 02-15-2006, 09:36 AM
  3. Interview coming up
    By thomashdavies in forum C++ Programming
    Replies: 2
    Last Post: 06-30-2004, 08:23 PM
  4. Job Interview Coming Up
    By adamg in forum C Programming
    Replies: 5
    Last Post: 05-02-2004, 11:25 PM
  5. what's the world coming to?
    By Waldo2k2 in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 11-22-2002, 12:00 PM