- Home /
Best practices for multiple databases
What are the best practices for using multiple SQLite databases? I'm thinking about an item database and a mob database using SQLite.
Just use one database, with multiple tables, one for each..
Answer by Dave-Carlile · Jun 14, 2017 at 12:41 PM
A database generally encompasses an app. Different types of data within an app are generally stored in different tables. So you'd have a single database "MyGameDatabase", and multiple tables, "Items" and "Mobs" that live in that database.
Yet items would require more than a single table because you'd have consumables, weapons, armor, missile weapons, etc. Each would have different information and so with mobs. You'd have their stats or abilities, etc. I must be missing something...
Not really, for the Item table you would have specific values that an item can have maybe one could be 'item type' and you could specify in that value if it is a consumable, weapon etc, and fill in the rest of the item data
Why are multiple tables a problem? Weapons, Armor, $$anonymous$$issileWeapons, etc. Or as @ShadyProductions said, a single Weapons table with weapon type and such.
Here's question for you, is a database even the direction you want to go with this? $$anonymous$$uch of the time this sort of thing is handled with JSON or Xml or something. You can set up editors within Unity to edit the items directly. I use JSON in my game and I have dozens of files holding different types of data.
But you're asking about best practices for databases. I've been a database programmer for 18 years. And for something as small as a game, create a single database for the app, and different types of data goes within different tables inside that database. I've worked in databases containing thousands of tables. It's what you do.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
SQLite and Lists in C# 1 Answer
How to get a database with information in it to be usable in a build 0 Answers
Unity 4 Android Game cannot access SQLite DB (C# Script) 1 Answer