• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
Question by DAAMCO · Jul 30, 2017 at 03:32 PM · databasejsonxmlitemssqldatabase

Whats the best option for an item database for a single player game

I was going to use SQL as I know how to use it and that it can do everything I'd want it to do but I read online that you need an internet connection and to connect to a server for it to work which if true rules SQL out as I want this to be an offline game.

I need the item database to be able to be filtered through, i.e. if an Ice enemy is killed I want them to only drop an item which has the "Ice" element or if a "gunner" is killed I'll want them to only drop a gun and/or a ice gunner dropping only items which have both the "ice" and "gun" attributes.

I would also need it in separate tables/ lists so that columns which aren't applicable to different items aren't assigned a value to them. I.E. I might want in a table for bombs a column for the blast radius of the bomb, whereas obviously a helmet wouldn't have a variable for a blast radius. So it would make sense having them both in separate tables to be more efficient.

TL;DR

Should I use SQL, XML, JSON or other format to create my item database for an offline game in which the database can be filtered through by one or multiple different criteria to return a specific item and can be split into different tables relating to the different objects. I.E. if bombs need a blast radius variable and helmets don't, and there are 100 different helmets, it seems pointless and a waste of data writing out that each helmet has 0 blast radius.

Comment

People who like this

0 Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Spaniel · Nov 13, 2017 at 11:41 PM 0
Share

Please check my answer. SteenPetersen's is definitely the wrong way to do it.

2 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by SteenPetersen · Jul 30, 2017 at 03:33 PM

You may want to take a read through this:

https://docs.unity3d.com/ScriptReference/PlayerPrefs.html

if its offline you can store all sorts of things there instead.

Comment
DAAMCO

People who like this

1 Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DAAMCO · Jul 30, 2017 at 03:37 PM 0
Share

Is it applicable for creating a database with such filtering options that I need? If so thank you and even if not thanks for the quick response!

avatar image SteenPetersen DAAMCO · Jul 30, 2017 at 03:39 PM 0
Share

dependant on your architecture you can store anything as it simply store floats and ints and strings. so it should be easy to simply convert that information to whatever you want. much like a database would.

Remember to mark the question as correct, if it was, so others know this has been resolved. and , anytime, glad to help!

avatar image DAAMCO SteenPetersen · Jul 30, 2017 at 03:42 PM 0
Share

Okay thank you Steen! Final thing before I mark it as correct; would PlayerPrefs be preferable over SQL, XML and JSON in the instance I'm talking about. If so I will mark this as correct then take some serious time learning about it before I start coding it. Thanks again :)

Show more comments
avatar image Spaniel · Nov 13, 2017 at 11:28 PM 0
Share

@SteenPetersen @DAAMCO This is a really bad idea.

Check my answer below

avatar image

Answer by Spaniel · Nov 13, 2017 at 11:26 PM

I know this is old but SteenPetersen's answer is really incorrect. You want an item database. How on earth do you suggest effectively storing that in PlayerPrefs? PlayerPrefs is good for single values. Hell, you could serialize an entire class into it as I have done before, but it's not super effective and it's single threaded. Storing a huge item database in there is a terrible idea.

I've done an offline game and have used SQLite and had great success. You treat it like a database and can query it like one but it's all offline.

Check out: https://github.com/codecoding/SQLite4Unity3d

Comment
MrN_Says_Hi

People who like this

1 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

114 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to add item to inventory with these scripts 0 Answers

Unity Inventory Database ID Error 1 Answer

How do delete the lowest value on my list? 0 Answers

leaderboard data - xml, database or PlayerPrefs 0 Answers

Classifying item types without inheritance 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges