RSS Forums RSS

C++ game?

Please support our C++ advertiser: Programming Forums
Reply
Posts: 183
Reputation: viperman224 is an unknown quantity at this point 
Solved Threads: 1
viperman224's Avatar
viperman224 viperman224 is offline Offline
Junior Poster

C++ game?

  #1  
Apr 6th, 2004
Is it possible to make a very simple game with C++? any good sites to read up on how to do it? I have a program called Dev-C++. any kind of tips or code that i should know? I'm am just a noob at C++. I wish to play with it before I attend a computer programing camp during this summer. thanks
Owner/PC Technician of:

The PC Doctor
"If we can't fix it, it's just not fixable"


AddThis Social Bookmark Button
Reply With Quote  
Posts: 5
Reputation: Creator is an unknown quantity at this point 
Solved Threads: 0
Creator Creator is offline Offline
Newbie Poster

Re: C++ game?

  #2  
Apr 6th, 2004
Of course it is possible. I've been thinking about making a command-line (text) based RPG with C++. What you could do is say, create some bad guys, create a menu of what the user can do to them, randomize some attacks and etc... It will take a lot of function work but yes it could be done. I don't know of any good sites that provide basic game info. But there are lots of OpenGL sites and advanced sites. But you won't make a 3D game by this summer so I'd stick with command line stuff.
Reply With Quote  
Posts: 218
Reputation: BountyX is an unknown quantity at this point 
Solved Threads: 7
BountyX's Avatar
BountyX BountyX is offline Offline
Code Guru

Re: C++ game?

  #3  
Apr 6th, 2004
C/C++ is a fully functional language, you make the computer do virtually ANYTHING you want. The limitations of the language can be overcome with experience and skills.

BTW: 73.2 % of all games on the market are created in C/C++ in cluding popular titles such as Warcraft 3, and Diablo 2.
A Hacker's Mind:
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes..." - J.D.Salinger
Reply With Quote  
Posts: 5
Reputation: Creator is an unknown quantity at this point 
Solved Threads: 0
Creator Creator is offline Offline
Newbie Poster

Re: C++ game?

  #4  
Apr 7th, 2004
I just wrote a small game in C++. I also have the source code to a few RPG games. It actually isn't that hard to make a console RPG. And as BountyX said, funny you should ask if games could be made in C++ because almost all games are. So you've picked the right language! You wouldn't want Java or C# as much because they are slower languages.
Reply With Quote  
Posts: 2
Reputation: Tempus is an unknown quantity at this point 
Solved Threads: 0
Tempus Tempus is offline Offline
Newbie Poster

Re: C++ game?

  #5  
Apr 7th, 2004
You can now get the original Quake source files (C++) and see what a full game looks like.

Check the website for it. Its released under the GNU rules.
Reply With Quote  
Posts: 28
Reputation: Bleek is an unknown quantity at this point 
Solved Threads: 0
Bleek Bleek is offline Offline
Light Poster

Re: C++ game?

  #6  
Apr 8th, 2004
i have my first game code of a dice game you can look at if you would like. ill post it if you reply back, it displays the dice using characters... its simple but i like it.
Reply With Quote  
Posts: 183
Reputation: viperman224 is an unknown quantity at this point 
Solved Threads: 1
viperman224's Avatar
viperman224 viperman224 is offline Offline
Junior Poster

Re: C++ game?

  #7  
Apr 8th, 2004
I would be glad to take a look at it
Owner/PC Technician of:

The PC Doctor
"If we can't fix it, it's just not fixable"


Reply With Quote  
Posts: 218
Reputation: BountyX is an unknown quantity at this point 
Solved Threads: 7
BountyX's Avatar
BountyX BountyX is offline Offline
Code Guru

Re: C++ game?

  #8  
Apr 9th, 2004
post is please
A Hacker's Mind:
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes..." - J.D.Salinger
Reply With Quote  
Posts: 2
Reputation: Tempus is an unknown quantity at this point 
Solved Threads: 0
Tempus Tempus is offline Offline
Newbie Poster

Re: C++ game?

  #9  
Apr 13th, 2004
Honestly, you really should use C#. Its alot more fun.
Reply With Quote  
Posts: 28
Reputation: Bleek is an unknown quantity at this point 
Solved Threads: 0
Bleek Bleek is offline Offline
Light Poster

Re: C++ game?

  #10  
Apr 13th, 2004
i wrote it a while ago but anyways...
Dice Game

/*
  Name: Dice Game
  Author: Bleek
  Description: Game
  Date: N/A
  Copyright: N/A
*/

#include <iostream>
#include <time.h>
#include <cstdlib>
#include <windows.h>
using namespace std;
void one();
void two();
void three();
void four();
void five();
void six();
//Declare Functions used
int main()
{
short unsigned int score = 0;
short unsigned int compScore = 0;
short unsigned int num = 0;
short unsigned int num2 = 0;
short unsigned int compNum = 0;
short unsigned int compNum2 = 0;
short unsigned int sum = 0;
short unsigned int compSum = 0;
char letter;
//Declare Variables
srand(time(NULL));
//Initialize random number generator
system("title Joe's Dice Game");
while (letter != 'q')
{
    cout << "Your Score: " << score << endl;
    cout << "computer's Score: " << compScore << endl << endl;
    cout << "Press r to roll or q to quit: ";
    cin >> letter;
    num = 1 + rand() % (6 - 1 + 1);
    num2 = 1 + rand() % (6 - 1 + 1);
    compNum = 1 + rand() % (6 - 1 + 1);
    compNum2 = 1 + rand() % (6 - 1 + 1);
    
    //Random numbers
    
    sum = num + num2;
    compSum = compNum + compNum2;
    
    //Calculate Sums
    
    if (letter == 'q')
        break;
    if (letter != 'r')
    {
        system("cls");
        continue;
    }
    
    switch (num)
    {
        case 1:
                one();
                break;
        case 2:
                two();
                break;
        case 3:
                three();
                break;
        case 4:
                four();
                break;
        case 5:
                five();
                break;
        case 6:
                six();
                break;
        default:
                cout << "Error...";
                break;
    } //end switch
    
    switch (num2)
    {
        case 1:
                one();
                break;
        case 2:
                two();
                break;
        case 3:
                three();
                break;
        case 4:
                four();
                break;
        case 5:
                five();
                break;
        case 6:
                six();
                break;
        default:
                cout << "Error...";
                break;
    } //end switch
        
    cout << endl << "Yours: " << num << ", " << num2 << endl;
    cout << "Computer's: " << compNum << ", " << compNum2 << "\n\n";
    
    //Display dice and numbers
    
    if (sum > compSum)
    {
        cout << "You won!!" << endl << endl;
        score++;
    }
    else
    {
        compScore++;
        cout << "you lost..." << endl << endl;
    }
    
    //Calculate score
    
    system("pause");
    system("cls");
    
    if (score == 12)
    {
        MessageBox(0, "You Won!!!", "Results:", MB_ICONEXCLAMATION);
        break;
    }
    if (compScore == 12)
    {
        MessageBox(0, "You lost...", "Results:", MB_ICONEXCLAMATION);
        break;    
    }
}
return 0;
}

void one()
{
cout << " -----" << endl;
cout << "|     |" << endl;
cout << "|  O  |" << endl;
cout << "|     |" << endl;
cout <<  " -----" << endl;
}
void two()
{
cout << " -----" << endl;
cout << "|    O|" << endl;
cout << "|     |" << endl;
cout << "|O    |" << endl;
cout <<  " -----" << endl;
}
void three()
{
cout << " -----" << endl;
cout << "|    O|" << endl;
cout << "|  O  |" << endl;
cout << "|O    |" << endl;
cout <<  " -----" << endl;
}
void four()
{
cout << " -----" << endl;
cout << "|O   O|" << endl;
cout << "|     |" << endl;
cout << "|O   O|" << endl;
cout <<  " -----" << endl;
}
void five()
{
cout << " -----" << endl;
cout << "|O   O|" << endl;
cout << "|  O  |" << endl;
cout << "|O   O|" << endl;
cout <<  " -----" << endl;
}
void six()
{
cout << " -----" << endl;
cout << "|O   O|" << endl;
cout << "|O   O|" << endl;
cout << "|O   O|" << endl;
cout <<  " -----" << endl;
}
<< moderator edit: added [code][/code] tags >>
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Similar Threads
Other Threads in the C++ Forum
Views: 39634 | Replies: 21 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:11 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC