unity3d Storage/data files type?

Started by
2 comments, last by Durakken 10 years, 1 month ago

Is there a reason why I should go and mess with these other formats to save store data?

I basically need to make a monster list, their stats. how they level, when they get their abilities, and what those abilities are.

It seems to me that using a regular text file would work and from what I know would be the smallest file size...

So is there a reason to use mysql, xml, or whatever other format other than preference?

Advertisement

Each format and method of storing information has advantages and disadvantages.

Plain text files are simple but your generally looking at custom parsing code that is developed for your particular application. Using the format in other tools would mean developing a similar parsing routine in the other applications. XML provides a means to exchange data between tools without having to write the parsing routines yourself. XML is also less brittle then a plain text file (you can add data to an element without making large changes to the parsing code). However XML does make for larger files then a plain text file. There are some other alternatives such as JSON or YAML.

A plain text file or an XML file can be stored internally to your application as a database (you can convert the records). Databases allow you to perform a query to return information about your dataset. One example might be if you needed a way to return all shields that had a strength less than 50. In general relational databases are not often used in game development, except in some limited contexts. The general opinion seems to be that relational databases (such as SQL) are too slow for real time games. However some web games and multi-player games do use relational databases for persistent data.

How you organize and store your information matters when it comes to maintainability, interoperability, data processing/look up time, and persistence.

Using XML with Unity is pretty easy. Refer: http://wiki.unity3d.com/index.php?title=Saving_and_Loading_Data:_XmlSerializer

In addition to the easy loading & saving, the stored data will closely resemble your class structure.

Thanks for the info

New Question - I am making a pokeclone game... so I need to make a file to list all the monsters, moves, and the leveling rates... Should I separate these into 3 files? 2? or 1?

This topic is closed to new replies.

Advertisement