XNA Creators Club Online
Page 1 of 1 (5 items)
Sort Posts: Previous Next

RPG Start Kit: Player Data / Player Save Data

Last post 9/2/2008 8:42 AM by bixel. 4 replies.
  • 8/25/2008 11:08 PM

    RPG Start Kit: Player Data / Player Save Data


    I am finding a hard time trying to figure out what is exactly holding and saving the data for the player(s) in the party.

    seems to me StatisticsValue.cs seems to create
    HitPoints
    MagicPoints
    Offense
    Defense
       but all of this is arbitrary and not recorded yet

    then along comes FightingCharacter.cs, which seems to create
    DamageRange
    DefenseRange
    MagicDefenseRange
    Experience
    and recalculates the StatisticsValue values depending on Equipment equipped

    then there is Player.cs which is only used when adding or removing characters to the Party, it seems to record and read
    gold; the amount of gold this player has when it joins the party.
    and thats it

    However at CombatEngine.cs, combat ended; it wraps all this together and Arbitrarily saves it - somewhere....

    then PartySave.cs seems to save all the data, but how to get the data???

    my problem is:
    at any point if I wanted to say retrieve the value of a Player I get so confused because I cannot simply say

    int getTotalEXP = player.Nykkas.exp;

    depending on where I am (which class I am calling from) I can never rely on a single location for the data to be stored. I am thinking I should create separate classes for the players, and write and save data to them instead. That way where ever I may be asking for data from that player I can get it.

    player.Nykkas.expRecent == experience points saved from last battle
    player.Nykkas.exp == experience points saved from last save point

    Please give me your thoughts. Also is anybody else finding data tracking difficult??
  • 9/2/2008 2:28 AM In reply to

    Re: RPG Start Kit: Player Data / Player Save Data

    I just started this tutorial and haven't really looked at much, but I plan on it. I am a database developer and have been programming for almost 4 years now. 3 Years vb, 1yr C#.

    This sounds like a place for XML to take over.  At our company we save alot of large file segments to an xml document that has no need to connect. It is in VB which makes it hard to convert.

     

    I will look into it more, and hopefully find it, LINE BY LINE :)

  • 9/2/2008 2:31 AM In reply to

    Re: RPG Start Kit: Player Data / Player Save Data

    Ok I found it. Use the find command(ctrl+f)

     

    type in SaveSessionResult

     

    Once you find this, you should see alot of code to save to an xml file. It was a lucky guess on my part.

  • 9/2/2008 3:02 AM In reply to

    Re: RPG Start Kit: Player Data / Player Save Data

    From what I have noticed, or missed. I noticed that once you overwrite a saved game that it jumps into the xml streamwriter. But if you save for the first time it doesn't do that. I could be wrong, but for future development, it should allow you to enter a name to save as.
  • 9/2/2008 8:42 AM In reply to

    Re: RPG Start Kit: Player Data / Player Save Data

    Here is the most important part

     

                         // write the party data
                            new XmlSerializer(typeof(PartySaveData)).Serialize(xmlWriter,
                                new PartySaveData(singleton.party));

    but then its get crazy from then on - check PartySaveData - which is storing some values, the check PlayerSaveData which is storing values from Player, FightingCharacter, CharacterClass, and...maybe one other class file. Yikes! Just trying to track down where the updated Statistics and Exp was painful enough. Which is why I may try to simplify things - like someplace holder - however that would mean constant reading and writing from the harddrive - which we probably want to avoid. Its the wild goosechase of the stored variables that is confusing me.


Page 1 of 1 (5 items) Previous Next