Archived

This topic is now archived and is closed to further replies.

Makoy

Character Database and Save Game

Recommended Posts

Hello everyone I''m new to programming games. I''ve been a c++ user for just a short time. I''m making a textbased rpg game and I wanted to have a character database and a save menu in it. can you please give me an example code on saving and making a character database. I will really appreciate it

Share this post


Link to post
Share on other sites
Just dump out all your class settings into a file

You could have a .chr file or something with a set structure.

WORD numchars;
WORD charid;
WORD health;
WORD inventoryID;

... then afer numchars have been read

WORD numinventories;
WORD inventoryid;
WORD invetorysize;
WORD objectlid;
WORD objectcount;

...

etc

Think in database terms, think what you need to store and create a structure to hold it all.

[edited by - downgraded on August 11, 2003 7:01:37 AM]

Share this post


Link to post
Share on other sites
I''m making a dos based game. Is it possible to inlcude a .chr file? If so, how can i make a chr files. I''m sorry to tell you this. But I only have a little clue of what you''re saying.

Share this post


Link to post
Share on other sites
As long as your working in c++ you can load a file. Although I don''t have much experience with loading custom files I know you can find a good tutorial on it, just search around. Also the .chr file is just a text file that you save with that extension, its just a file that you save your data too. Look into files a little more and your probably get the hang of it.

Share this post


Link to post
Share on other sites
The file extension is arbitray. He just picked .chr because you said it was for a character. You could have put .per or .xyz. The extension doesn''t matter, it is what you are putting in the file that matters. You decide the format, you decide how to read it and you decide how to write it.



First make it work,
then make it fast.

--Brian Kernighan

"I’m happy to share what I can, because I’m in it for the love of programming. The Ferraris are just gravy, honest!" --John Carmack: Forward to Graphics Programming Black Book

Share this post


Link to post
Share on other sites