Question:
How should I get started in C++ game programming?
?
2010-06-26 11:42:56 UTC
I've been reading a book on C++ (I'm a pretty novice programmer), and so far all it has dealt with is logic. For example, arrays, loops, conditions, etc.. But what I'm really interested in is GUI. My goal is to create some simple 2D game such as Snake or Tetris. What do I have to read or do to get to the point where I can program a simple 2D C++ game?
Six answers:
xdizzyspinnerx
2010-06-26 12:04:44 UTC
Logic is highly important, for everything.

The game itself is likely to run inside a huge loop, for example:

while (lives > 0){

//Main game

}



I recall C++ having quite a complex gui, Java has an easier to use one, but if you are set on C++, searches for C++ GUI on google are a good step in the right direction.

There are books in some libaries on game design, and although I have only glanced through them I see they all seem to assume some previous knowledge, so it is good that you are learning the basics.



Another way you could do it is to use a visual C++ program of some sort.



A little example of creating the game part would be to have an array, for example 10x10 of character.

A character could be 'A' or 'B; A being empty, and B being part of the snake.

Then you would just print each part of the array to the screen.



Once you get more advanced, you can use all 8 bits of the character to represent a part of the board, and save some memory
2010-06-26 12:22:15 UTC
There are 4 things you're asking about, so you'll have to learn 4 things:



1. Game design. this has nothing to do with computers. It's strategy, rules, characters, etc. One of the most successful games ever designed, Monopoly, was designed during the depression. No computers.



2. Computer programming. Start with http://www-old.oberon.ethz.ch/WirthPubl/AD.pdf



3. Object Oriented programming. Once you learn programming. (Then, and only then, you start learning C++.)



4. Graphics. The characters, the scenery, etc.



You can't create a game with a GUI - the GUI is just where the game takes place. That would be like writing a book by binding paper between covers You're still missing the "book" itself.. The GUI isn't the game.
?
2010-06-26 12:23:21 UTC
If you feel confident with OOP concepts of C++, i suggest you move to C#(C sharp) which is the most common used languages for game development. Its 3 main benefits are:

1.easy to code and design game .

2. Game engines like Torque2d and Torque3d available which provide a very easy way of building games through C#.(Having simplified functions for game development).

3. Microsoft XNA framework for PC and also XBOX which also requires programming in C# and you can create games from Snake,Tetris to SuperMario,Road Fighter to any game like DemiGod and any RPG.
2010-06-26 12:25:17 UTC
just focus on learning the basics inside and out. You can actually do tetris and snake in a console window.



1. But if you want to do a gui in c++, use a library like Qt.



2. If you want to do 2d/3d games in c++, start learning directx.
Shaken_Earth
2010-06-26 14:13:22 UTC
Logic is the foundation of game programming. You NEED to learn that before making a gui or full-fledged game. For example:



while(b.size>c.size){



//Do stuff



}



without logic counting lives and points is impossible.
leanne
2016-06-04 02:06:30 UTC
You can use SDL.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...