Therefor it needs to be easy to change and it needs to be easy to understand what everything is. To contain data, there are a few different methods. You can use a database or save to a file(using a data type). Pro and cons of them both comes here.
Database
Pros
- Its easy to withdraw data and search for data.
- There is an existing GUI for it.
- Has good support for many entries, without it getting messy.
Cons
- Have to use a GUI, can't edit the file directly.
- Most existing GUI's don't deliver a good enough editing and reading experience.
- Its a hassle to work with(we think).
File
Pros
- Its easy to edit directly from the file.
- We can develop a GUI easier.
Cons
- Have no existing GUI's. We have to write our own, or edit directly in the files.
- Can quickly get messy, if you edit directly in the file, and there are lots of entries.
We wanted to make a custom GUI, that was a breeze to use. Saving via a file, was the best way to do that.
There are also multiple options for how you can save. We considered xml and json. We went with xml, since we liked its syntax better, which is the main difference between all the different data types. There are small other differences, but what really matters is the syntax.
We were a little lost as how you should import the values from the xml into the game. We had no experience with importing xml. Because of this we chose a sub optimal solution. We had to rewrite it, when we started designing our custom GUI. Its was not flexible enough and there was duplication all over it.
With our previous experience with importing xml, we took to designing a new and better design.
The new design is much simpler and works much better.
Our current system |
When you want something in the xml file, you call the class XmlPath's constructor with parameters describing your path to your desired node. Then you can get all the data you want via the XmlPathData, which XmlPath returns. The previous XmlSeacher class, still exists but does far less and is used by XmlPathData and XmlPath.
Its now much easier too work with system and we can design our GUI easier. We hope some of this was useful and makes it easier for you to work with importing xml.
That was all for this weeks blog post! Return next Tuesday for another.
Ingen kommentarer:
Send en kommentar