Posts | ||
---|---|---|
xml files for a c# text based game | Locked | |
Thread Options | ||
Aug 20 2016 Anchor | ||
I'm working on a text based game (similar to Zork) and I am currently writing the xml file. So far I've only worked on the rooms themselves. My question is do I need to put the inventory system in an entirely different xml file, or just in a different section? I've never used external files like this before so I'm still learning. Is it ok to have separate xml files? Is it preferred, like when you start a new class in c#? Thanks for any help! |
||
|
Aug 20 2016 Anchor | |
For clarity you should try and place things in different files imo - unless they belong. Edited by: Nightshade -- - My portfolio |
||
Aug 24 2016 Anchor | ||
ok so I should have an xml file for rooms and an xml file for inventory. that's makes sense. how do I actually take the xml file and turn the elements into objects? I've read some stuff on doing it but I'm still a little confused though. |
||
Aug 24 2016 Anchor | ||
You have to open and read the xml; then you have to parse the data accordingly. -edit- Of course all that should be done in a loop if there are many items. Edited by: Draakhex |
||
|
Aug 26 2016 Anchor | |
ethanCodes wrote: You use an XML-parser in the environment where you need to read the data. Some people even write their own but it can be too much work also. Then for saving, you need to read the objects and take the information there into data in the form of XML-tags. You do that step with an XML-composer. That step is easy and could be done by yourself without hassle in case you have no XML-composer in your library. But, imo JSON is a better format for data passing/storage - easier to read, prettier, easy to work with (imo). Edited by: Nightshade -- - My portfolio |
||
Aug 26 2016 Anchor | ||
Thanks for the info guys. I'm going to try some of this out, but I'm sure I'll be back with more questions! so I've been playing with this a little bit. I'm running to a small problem with setting up the reader. it's not taking my xml file path. I'm getting a runtime error with it. Also, in my research I've found some info on Linq. would this be a better option? |
||
|
Nov 6 2016 Anchor | |
Just bumping this to get back to you and hear how things have been going. -- - My portfolio |
Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.