Jump to content
  • Advertisement

Archived

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

Gimlin

Data

This topic is 5660 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am new to this and to this forum. I am creating a very simple text based game. I would like to know the best way of storing data like player stats, monster stats, item stats etc. Thanks

Share this post


Link to post
Share on other sites
Advertisement
the easiest way :
use text data,
and create tool in order to help you to fill these datas.

the Seby

Share this post


Link to post
Share on other sites
quote:
Original post by Gimlin
when I get the data, do I put it in an array?

You have to decide yourself how best to organise the data within your program. Generally, you should organise related data into structures, which involves figuring out identifying the different types of objects your game will have (you already mentioned player, monster, item), and then deciding what attributes each of those objects will contain. From there, you can create structures corresponding to all the different object types. You need to do that before you decide the best way to store the data between different runs of the program.

Share this post


Link to post
Share on other sites
I would personally use a struct or a class for such things, with a class you can call each thing specifically with a func. designed to store or retrieve what you need. the my opinion at least, im sure others might do it differently

Share this post


Link to post
Share on other sites
If you are new at this this would help u.


struct player
{
char Name[32];
int Posx,Posy;
};

player Players[] = {{"Leadorn",10,10},{"Leldorin",11,20}}

cout << Players[0].Name << Player[0].Posx << Player[0].Posy << endl;


cout << Players[1].Name << Player[1].Posx << Player[1].Posy << endl;

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Thanks that helped alot

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!