Skip to main content
GameDev.net gamedev.net
🔒 Locked

Help wanted please!!!!!!!!!

Started by huve Apr 13, 2001 at 8:58 PM 8 replies 900+ views
Original Post
huve
huve
I wanna make a text-based high-school basketball game.The problem is that in VB i have something but then i realized i need a database and well i dont have one.So I wanna try with MSVC++ and i wanna know does it need a database.Also if anyone wanna get what i''ve done so far i''d be happy to mail it to you so you can give me so examples.I''d also like help from anyone who''s willing ti help.Hell i''d even pay if you really want the money so what do you guys say?Help a newbie out.email me at huve_9@yahoo.com huve
lutas
lutas
I don''t know if anybody emailed you about it, but I might as well post here...

Firstly - you don''t have to use a database at all if you don''t want to although as you come to program it you will find that your program will naturally act like a database (it has too).

In VB you can link the databases to Access (though I don''t know much about it I must admit), but there is a much simpler solution in the form of making your own...

I presume you have covered the TYPE statement and OPEN (files)...

I suggest you look up RANDOM access files eg in VB:

OPEN file$ FOR RANDOM AS #1 LEN=23

If you can''t understand it, just mail or reply and I will explain the whole thing k?

Man I love having freetime heh

Philip Lutas
CEO of Optical Realities
huve
huve
I dont get it can you explain?
I wanna make a game with like 1000+ players with 30+teams and have everything randomly change each you start a new career.Is what your talking about C++ or VB6?



huve

Yogispaw
Yogispaw
I too am also trying to make a text based basketball game. Although I''m looking to make a college basketball game. I also thought that a database would be the way to go but I''m stuck for answers. I am programming the game in C++ if anyone can help I would appreciate it.
huve
huve
Anonymous Poster i need a blue print of how it should look.And i''m completely lost when it comes to databases.Also i want to know how make a sim-engine like Team A vs. Team B and genrate a score along with stats.Any help would be welcomed...

huve

ZoomBoy
ZoomBoy
For setting up a database I would recommend using Excel for all the data. Then export it out to the hard drive in CSV format(comma separated values) I would also recommend using MFC for all the editing and learning how to deal with linked lists. I''ve built such things from scratch in DOS and you''d be insane to try to do so when MFC does a much better job(SAMS'' Teach Yourself Visual C++ 6 in 24 hours by Mickey Williams is a MFC basics book that I used). Besides message boxes, it has edit boxes, linked lists and tree-views.

For the RPG I am working on, I have tons of data that I created in Excel to edit and sort and organize. I then exported it to CSV and built a CSV parser and importer(code for that is on my diary page/ you''re might have to code for double commas).

I created a base class
// Declarations for the intermediary Class
//This is my top class that will allow a lot more list activities
// than the simple ones of CPtrList
//
class totplist
{
public:
~totplist() {};
char KeyName[40]; // sortable fields
int KeyCode;
char Key2ndName[40];
int KeySourceCode;
int UPriority;
int ObjType;
int nID;
};
Derive from the above for different objects.

And the CSV importer/parser loaded it into the totplist object and then I added that object to a CPtrList linked-list object.
The CPtrList object has all the things you need for linked lists except sorting.

ZoomBoy
Developing a iso-tile 2D RPG with skills, weapons, and adventure. See my old Hex-Tile RPG GAME, character editor, diary, 3D Art resources at Check out my web-site
invective
invective
I absolutely agree that you should use excel to generate CSV files for you database, as its simply the easiest way to maintain and read in your data© You can even use notepad, if you don''t have excel ¥buts its harder to edit¤© However if you are using VC and making a text ¥console¤ app, i do not suggest using MFC, as it is fairly cumbersome and difficult to learn if you are just starting out© Instead, just focus on the standard C++ functions© If you are adventurous, you can use the STL container classes to hold your data, or if not, just make an array© As to how the CSV file works, its like this: every row is separated by a newline, while every column is separated by a comma© Basically, this means that every player is going to be separated by a newline, and the stats for the player are going to be separated by commas, as in:

player1,500,100¥newline¤
player2,200,50¥newline¤

you can read the file in as follows ¥note: I left out lots of error checking, and I am using an array for simplicity, a linked list, vector or some other container maybe more helpful, if you know how to use them¤:
  
#include <fstream>
#include <string>

#define MAXPLAYERS 1000;

using namespace std;

typedef struct {
string name;
int data1;
int data2;
} playerinfo;

playerinfo player[MAX_PLAYERS];
int number_of_players = 0;

void readfile ¥¤
{
char buffer [500];
ftream file;
int i = 0;

file©open ¥"data©csv"¤;

while ¥!file©eof¥¤¤
{
//Read up to first comma and store name

file©getline ¥buffer, sizeof¥buffer¤, '',''¤;
player[ i ]©name = buffer;
//Read up to second comma and store integer

file©getline ¥buffer, sizeof¥buffer¤, '',''¤;
player[ i ]©data1 = atoi¥buffer¤;
//Read to end of line and store integer

file©getline ¥buffer, sizeof¥buffer¤ ¤;
player[ i ]©data2 = atoi¥buffer¤;
i++;
}
number_of_players = i;
file©close ¥¤;
}


ZoomBoy
ZoomBoy
>>>>
... I do not suggest using MFC, as it is fairly cumbersome and difficult to learn if you are just starting out. Instead, just focus on the standard C++ functions. If you are adventurous, you can use the STL container classes to hold your data, or if not, just make an array
>>>>

For clarity I''d divide the programming into 2 parts.
You''re going to need to build an interface for the user to interact with. Lists display!, boxes, buttons and all the interactive stuff should be built with Windows User Interface MFC. The data sorting and storing functions can be done in STL, arrays, or, linked list objects. I just use the MFC object class of CPtrList because I didn''t want to build a linked list class from scratch.

ZoomBoy

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.