The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 11 of 11

Thread: saving variables problem

  1. #1

    saving variables problem

    im working in Visual Studio right now and im wanting to know
    Im making a program based game


    What i was wanting to know was, how should i save the stats and everything?
    should i save them in a txt(i tried, it might take a loooooong time)
    should i save it to a MySql Database
    should i have it upload to a txt on a server?

    Which one should i do?
    and whichever one, do u know how i do it?
    [Insert Generic Signature Message Here]

  2. #2
    If you won't have an unreasonably large list of saved data, I'd go with XML files. They are easy to write to and read from

  3. #3
    Well I haven't used Visual Studio but surely you can add code somewhere to save to a txt file using the standard C++ method right? (I'm sure visual studio is C++ but if I'm wrong then slap me )

    something like:
    // Include for file input and output
    #include <fstream>
    ...
    // create an ofstream object to manage output
    ofstream fout("filename.ext");

    // outputing text to filename.ext is as simple as using the cout now.
    fout << "Text to save output to file";

    Although I take it you are making an online rpg (are you?) by the looks of it. I suggest you go with a MySQL database. Connecting to an online MySQL server is sadly something I've never done in C++ (only PHP and few other languages), BUT I reckon http://tangentsoft.net/mysql++/ or http://www.sqlapi.com/ might do the job for you.

    Let me know how you go, might do something like this myself, looks fun.

    PS: Make sure you don't give the program the ability to change directly stats of the player like health or attack/defence. The way most RPG's work is to have the game clients send through input (eg: attack) and the server works out how that input affects variables. It's just a little bit of security to prevent cheating, it's best to impliment it from the start or else it'll be harder to put in later on.

  4. #4
    Quote Originally Posted by kirupa View Post
    If you won't have an unreasonably large list of saved data, I'd go with XML files. They are easy to write to and read from
    But have them as an embedded resource so that people cannot change the values manually?
    Web Design and Web Development blog
    Designer Notice: Browser List for design compatibility

  5. #5
    im going to try the XML first, how would i set it up and then have my program read it?
    Last edited by silverneo188; December 29th, 2007 at 04:53 PM.
    [Insert Generic Signature Message Here]

  6. #6
    I'd also like to know of any good tutorials for this.
    Web Design and Web Development blog
    Designer Notice: Browser List for design compatibility

  7. #7
    kirupa, how would i do the XML way?
    [Insert Generic Signature Message Here]

  8. #8

  9. #9
    ok, i got this and the tutorial u gave doesn't tell me how to read me from Visual Studio
    Last edited by silverneo188; December 29th, 2007 at 06:12 PM.
    [Insert Generic Signature Message Here]

  10. #10
    Sorry forgot you were using VB, I use C#
    Web Design and Web Development blog
    Designer Notice: Browser List for design compatibility

  11. #11
    oh, its ok, im just going to save everything to a hidden txt file
    [Insert Generic Signature Message Here]

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012