My first game project

Started by
12 comments, last by counterrabbit 18 years, 8 months ago
Hello everyone I am new to this forum site, hence the name n0o0b. I am senior at Hofstra University and I want to start working on my first game. I have basic programming skills with C++, VB, and java. I have touched on other languages like perl, C, and scheme. As previously stated I want to try and work on my own mini game something simple I can do on my own. I was hoping for something good for beginners that can show me the overall structure of how to work on a project of this scale. I asked around my school and it seems like you can’t get more basic then Tetris. So I being that I am a noob, I was wondering is anyone out there new of any websites out there can help me get started with the overall structure. Things like figuring out what functions to right, that sort of thing. If anyone has any advice of their own I will more then welcome that as well. I will try and keep some of live journal of my efforts, so you all can help me out and comment on things I have done wrong. Thanks all, I hope you can help little old me, heheh. n0o0b
Advertisement
Well, you definitley need to learn one of the API's out there; OpenGL, SDL to name a few.
i have some knowlegde about opengl, but i still don't knwo how to bring things together. Any suggestions???
Maybe you can get a game engine, I think that should be much less work then working with an API. You can find some in the FAQ in this forum...
The simplest game projects need two basic things, user input and visual output.

User input is needed in order for the player to communicate with the game.

Visual output is needed to communicate the game state with the user, be it via text in the console or by a 3d graphics api.

Games also need something in between, the game update. The game update is responsible for updating the game state based off the users input and other game specific logic.



This process of turning user input into visual output via the game logic usually happens continuously until the game finishes. So the process is usually organised into a game loop.

A game loop may look something like

while(GamePlaying){GetUserInput();ProcessGameLogic();RenderGame();}


Here we have the three basic things that all games need happening over and over again in the same sequence.


A trivial implementation of these three processes can be demonstrated in a simple console game.

#include<iostream>int GuessANumber(){  std::cout << "Please enter a guess\n";  int UsersGuess;  std::cin >> UsersGuess;}bool CheckTheGuess(int NumberToGuess, int NumberEntered){   bool WasTheGuessCorrect = NumberToGuess == NumberEntered;   return WasTheGuessCorrect;}void PrintTheResult(bool WasTheGuessCorrect){   if(WasTheGuessCorrect == true)   {       std::cout << "You guessed correctly" << std::endl;   }   else   {        std::cout <<"You guessed incorrectly" << std::endl;    }}int main(){  bool HasTheUserGuessedCorrectly = false;  int NumberToGuess = 10;  while(HasTheUserGuessedCorrectly == false)  {    int UsersGuess = GuessANumber();    HasTheUserGuessedCorrectly  = CheckTheGuess(NumberToGuess, UsersGuess);    PrintTheResult(HasTheUserGuessedCorrectly);  }}


Here we have a simple number guessing game. The user is prompted for a guess until he guesses correctly.

As you can see from the code, it has the three basic elements I mentioned above. User input is handled via the GuessANumber function, the game update is done through the CheckTheGuess function, and the user output is handled by the PrintTheResult function.

This may seem a rather simple example, but all games work of this same principle in one way or another, whether the user input is coming from a computer on another network, or from a joypad, it needs to be checked at some point during the game update.

The game state needs updating to react to user input and the changes caused by the game logic. The game needs to be rendered in order to feed back to the user what is happening in the game.

Hopefully that gives you an idea of the kinds of things you need to be thinking about. You can also extend the concept to include things like sound and music.

For 3d and 2d games you will need to use some sort of API to do things like getting user input, and rendering the 3d or 2d world to the screen.

You might want to look into OpenGL, or DirectX. With DirectX, for example, you would use DirectInput to read in the users input, and Direct3D to render to the screen. You can get the DirectX Software Developers Kit from the here. Its quite a big download, but it comes with very detailed documentation.
Hi there.

You said you already have some knowledge about C/C++ and OpenGL?

There was a OpenGL game programming site, named "NeHe" i believe. Don't know if this site still exists though.
As far as i can remember it had everyting: Drawing your first triangles, texturing, user input,...

you may have a look into that one..

good luck
regards,
- christoph -
The site Acid-Chris is referring to is: http://nehe.gamedev.net/.
Is there a way to do graphical programs like a tetris or a car racing game ina 2d DOS environment. i spoke to one of my comp sci professors today and they said that the racing car game wold be easier to do. What do you gusy think.

Meanwhile i have been trying to figure out what kind of data structure to use to represent the tetris pieces. Anyone have any suggestions.

n0o0b
Quote:Original post by n0o0b
Is there a way to do graphical programs like a tetris or a car racing game ina 2d DOS environment. i spoke to one of my comp sci professors today and they said that the racing car game wold be easier to do. What do you gusy think.

Meanwhile i have been trying to figure out what kind of data structure to use to represent the tetris pieces. Anyone have any suggestions.

n0o0b


Tetris as a grid. You can represent that with a one dimension or two dimension array or list or vector or whatever you prefer. In each cell, you can create a struct representing the cell. The cell would have to have a few attributes:

struct Cell{  BOOL isFilled;  BOOL isAtBottom;  color;}


hope this gives you something to think about... good luck with the project!
-fuchiefck----------------------------------------------------------"Inside the world that you as a programmer or developer create, you are God" - Zerbst & Duvel
I would do a BreakOut-like game. It would teach you most of the basics of 2d game development: collision detection, double buffering, the game loop, etc.
Still 2^10 :P

This topic is closed to new replies.

Advertisement