Sign in to follow this  

Adventure Game Start

Recommended Posts

ok here is my shell starter for the adventure game..

it does nothing but print a banner and do a quick two dice roll..

need to add +++ everything..

plus I need to comment so I can keep on track..

I'm learning how to read and write files.. I think it would be better if all detail were in a text file.. this way .. this is just an engian and can be more basic..

read part of file in to array.

save game to file

things like that.

a config file would tell the engian how many rooms and frequencey of monsters / items

bash-2.05b$ cat adventure.cpp
*   Copyright (C) 2005 by Steve Huskey                                    *
*   [email protected]                                                   *
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
*                                                                         *
*   This program is distributed in the hope that it will be useful,       *
*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
*   GNU General Public License for more details.                          *
*                                                                         *
*   You should have received a copy of the GNU General Public License     *
*   along with this program; if not, write to the                         *
*   Free Software Foundation, Inc.,                                       *
*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *

#include <config.h>
#include <ctime>

#include <iostream>
#include <cstdlib>

using namespace std;
void clear_screen() // this is for portability of system call you must us the -DUNIX or -DWIN32 option for gcc
#if defined WIN32 // compiler replaces clear_screen() with system("cls"); if -DWIN32 is used with gcc
#elif defined UNIX // compiler replaces clear_screen() with system("clear") if -DUNIX is used with gcc
void welcome_message()
cout << "This is a demo program to a help me learn C++ better and to show how to make a text adventure game.";
cout << "If you would like to help with development \nplease see the documetation for more infromation.";
cout << "This software is protected under copywrite law and is covered under the GPL license. You have all rights";
cout << " that are covered under this license..\nsee or the documentation for more infromation" << endl;

int char_gen()
return 0;
int dice_roll(void)
int dice;
dice = 1 + rand() % 10;
return dice;

int rooms()
return 0;
int main()
int dice, dice2;
srand ( time(0) );
dice = dice_roll();
cout << "dice 1 " << dice << endl;
dice2 = dice_roll();
cout << "dice 2 " << dice2 << endl;
return 0;

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this