I've just started learning c++,so i want to take any challenge concerning c++.My question is where do i start when drafting a game program.Please ppl help me out.

Recommended Answers

All 20 Replies

make a game that uses dice. you roll 2 dice and you are rolling against the computers 2 dice. make the dice random and whoever has the bigger sum wins or gets 1 point... i dunno, start with that and build up from there, if you are just starting all you will be able to do is make a number game...

I would suggesst you first learn structures,classes and file i/o before trying games.You will just be frustrated and end up failing if you jump into games too soo.

Try www.google.com and search for c++ tutorials.

maybe it's a nonsense,but do accumulate step by step
wondering which type do ya like?

hey, if u r interested u can check out the game I made in C. U can run it using a C++ compiler as well. Try to run it if u r using a DOS based compiler, otherwise dont bother. U can find it in code snippets "Projectile game in C"

I would suggesst you first learn structures,classes and file i/o before trying games.You will just be frustrated and end up failing if you jump into games too soo.

Try www.google.com and search for c++ tutorials.

This is not neccessarily true! You can make decent text based RPGS (many games for that matter) in a single file using structures only, not classes! PM me for a source code of a pretty cool basic game if you want creator of thread.

later

This is not neccessarily true! You can make decent text based RPGS (many games for that matter) in a single file using structures only, not classes! PM me for a source code of a pretty cool basic game if you want creator of thread.

later

I did not say anything about games, but in C++ it's best if you know classes along with file i/o because it simpilfies a lot of things.And they are the basics of C++.

Now structures and classes are complimentary it's really your choice most of the time.But usally if you have experiance using classes, for games many classes will be used.

the best thing to do is make one in a single file using structs, and then remake the game using oob ie. make structs into classes!

Not neccesarly,it may be better in most cases to begin with classes.Of course you make structs in classes but with experiance you will be able to write classes directly.

I've just started learning c++,so i want to take any challenge concerning c++.My question is where do i start when drafting a game program.Please ppl help me out.

What type of game? The more complex your game is, the more you'll need to organize your code, so I highly recommend learning object oriented techniques. Please be a little more speficic on what you have in mind. The simplest game I can think of that you can create is a "Guess The Magic Number" Game where you generate a random number, go into an infinite loop, and break out of the loop when the user guesses the generated random number.

inscissor is right, start simple. I have made the guessing game, take a look at virus, it should help you


here is the simple guessing game!

#include <cstdlib> 
#include <ctime> 
#include <iostream>
using namespace std;
int main()
{
	int randomnumber = 0;
	int userguess = 20;
	randomnumber = (rand()%10)+1;
	cout << "The random number has been generated! It is between 1 and 10! \n";
	do
	{
	cout << "Please enter your guess" << endl;
	cin >> userguess;
	}
	while (userguess != randomnumber);
	cout << "YAY \n";
	return 0;
}

same thing but with voids

#include <cstdlib> 
#include <ctime> 
#include <iostream>
using namespace std;
void guesser();
int main()
{
	guesser();
	return 0;
}
void guesser()
{
	int randomnumber = 0;
	int userguess = 20;
	randomnumber = (rand()%10)+1;
	cout << "The random number has been generated! It is between 1 and 10! \n";
	do
	{
	cout << "Please enter your guess" << endl;
	cin >> userguess;
	}
	while (userguess != randomnumber);
	cout << "YAY \n";
}

:cool:I have search almost all day. Can someone please post a link or something.

My first game I wrote was an rpg(made it yesterday), so yes..I am new as well. As a matter of fact, I've only been learning c++ this month. Anyhow, make an RPG where you choose your character and battle enemies...it isn't as complicated as you would think.

A text-based RPG would be my suggestion too. As well as learning OOP, I would also suggest finding a graphics library like Allegro.

please give me a Hollywood/Hangama : A Word Guessing game in c++ language

We'll the question is a bit vague, but if your trying to go on the road that leads up to a professional game programmer, I would suggest:

1. Start with learning the fundamentals of the native ISO / ANSI C++. This is what I started with. Learn what a Class really is, how does I/O work behind the scenes, get used to all the data types used for variables, how to construct a program to solve a problem or particular need, etc.

2. Once you have the basics, begin with a few "In-Console" games. These mainly need you to know how to use I/O and how to handle and use stored variables in such a way that allows the user to focus less on how the code would work, and more on the game itself. Start with "Text Adventures" ( Google it if your not in the loop ) and build from there.

3. I'm sure you know that commercial games today do not use the Console as its output to the user. No sir, they use GUI's, 3d and 2d sprites and models ( Poly Objects ), high quality sound effects and 3d sound ( bomb goes off near you sounds louder than a bomb 10 feed further away ). This will require you to make a window ( or windows ) to do this. Try to google up some tutorials on that if you'd like. Then, start adding buttons, text areas, etc.

4. We'll if you get that out of the way, you'd be left with "man this takes too long to code all this and for such a poor outcome." We'll in that case try to learn the coding and implementation of either DirectX ( as im sure you have heard of ) and or OpenGL. There are surely others to try out that exist, but these are the main ones you will come across in the commercial industry. Plus, if you are tired of coding windows over and over and over, you can simplify it by learning/using Windows Form, which has a drag-and-click style for letting you design what you want your window to look like and act like and it generates the code for you. Then all you have to do is add the methods as needed.

That's the basic steps that I think you should take, though anyone with an opinion can say that, so do with the information what you will with it. Just to add, if you want a hard-copy of C++ programming books and don't already have any, i'd recommend:

Ivor Horton's Beginning Visual C++ 2008 ( don't worry you don't need Visual C++ to understand what it is teaching, though I highly recommend it. )

Beginning game programming with C++ ( this isn't the best out there but it give's you the fundamentals and after reading you will understand some key terms that you will become familiar with in the coming days.

Good luck mate, and if you need anything else or more information just email me at ----> <EMAIL SNIPPED> <----.

Why dont you check out console pong in the dani web code snippets

Hope this helps
Anurag

You could write a guessing game that goes like this:

computerNum is set to a random number in range 1-10 (look up rand and srand to help you)

userNum is set to user input

A while loop is created until userNum equals computerNum. (Don't forget to have userNum re-entered inside of the loop)

I've just started learning c++,so i want to take any challenge concerning c++.My question is where do i start when drafting a game program.Please ppl help me out.

hey i had found an cpp source code for snake and ladder game in http://cpparchive.blogspot.com/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.