- Home /
Game Database. SQLite, XML, JSON or PlayerPrefs?
Hi guys! Basically the question is in the title: What is the best way to store game data if:
It is levels data
Items data
Initial game settings
Player profiles
Social data cache
and
Data should be updatable via network (new levels, new items)
There should be some kind of pro-level editor for this database.
There should be way to link (somehow) game resources to DB items. For example new level prefabs and item textures should be easily linked to DB fields.
It's mobile project (iOS/Android)
Any ideas or even may be live examples
I feel forum is more appropriate for these kind of questions.
Lovrenc, done! Here is forum thread: http://forum.unity3d.com/threads/193909-Game-Database-SQLite-X$$anonymous$$L-JSON-or-PlayerPrefs
I've created a feature request http://feedback.unity3d.com/unity/all-categories/1/hot/active/3537--native-game-database-engine-and- Vote if you want it too!
Answer by Deeweext · Aug 01, 2013 at 05:11 PM
Hi Artfabrique,
It depends a lot on how flexible you want it, what platform and what scale.
1) PlayerPrefs are very fast, native and easy to use, they just save some values, strings or such along with the game, but they are not very database alike, but it works well for things like 'remember my username' on login screens for example. Also on web-player they are limited in size.
2) XML is written out as a text document, not quite the database yet, but it is easy to implement, and easy to import/export values to, there's an example of the wiki just google xml + unity, there's both a js and c example you can backwards engeneer. XML is good for configuration files, that you can change outside of the game, in a slightly good way. Json is slightly the same as this though there are some native differences. Also XML can be tricky on phone, you need to use some xml-lite libs, but it's do-able.
3) SQL is the online, real database solution. But it require a lot more work to implement, and it require you to actually know what you're doing, there's no easy drag n drop solution. But for large databases, it is the best of these options, and it is good for lookups.
Hi @Deeweext, As i said it's mobile project (iOS/Android) and System.X$$anonymous$$L is not a good solution for that (size + bugs on iOS) PlayerPrefs are very hardly editable place. I have 12630 in-game items and quite huge qeo-data for levels. And as for "SQL" - it's SQLite but not SQL. It's not online. It's local DB engine.
So may be there is some ready-to-go all-in-one solution? $$anonymous$$oney is not the problem. Time is the problem )
Your answer
Follow this Question
Related Questions
Project feasibility 1 Answer
Datasource for C# Android game 0 Answers
Embedded mobile database with server sync 0 Answers
how to make the build in android which can access the local database sqlite 0 Answers