Archived

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

Ashandir

RPG Text adventure with XML

Recommended Posts

I am making a RPG text game with C#. I have an xml file that saves the players name password and the class they choose. I want to create a child node in the XML file so that I can make an item collection to keep track of the items that the player has. But I cant figure out how to create a child to a player attribute in an XML file. Can anyone explain the syntax for that to me. Thank You

Share this post


Link to post
Share on other sites

XmlDocument doc = new XmlDocument();

XmlNode n = doc.CreateElement("node");
doc.AppendChild(n);

XmlElement e = doc.CreateElement("type");
e.InnerText = type.ToString();
doc.DocumentElement.AppendChild(e);



MSDN! GOOGLE!

Hope this helps,

Edo

[edited by - edotorpedo on November 18, 2003 5:06:51 AM]

Share this post


Link to post
Share on other sites
Personally, I feel that XML is a good choice for data storage in a text adventure... unless. you are concerned about your players opening the ''plaintext'' xml and tampering to alter their games. Perhaps a binary reader/writer might be sufficient with some baselevel encryption added to it to ward off the casual gamer hacker.

Unless you are defining schemas and actually using a service that can encrypt the data from the XML. I believe that XML is a great choice, personally for your data format, as content databaseing was one of its original reasons for existance. You just need to make sure that the proper level of security is addressed.

KYLe

Share this post


Link to post
Share on other sites