Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 /
avatar image
0
Question by 2.7boxer6 · Apr 24, 2012 at 05:23 PM · prefabsdatabaseweaponsstoragecrafting

What is the best method of storing data for a weapons crafting system?

Hello all,

I have been trying to figure out the best method of doing a weapons crafting system (where a user uses parts to build a weapon). However, barring using DBs or having a giant array of possible combos, there are not many options for storing necessary relationship data.

I was thinking that maybe if I prefab all of the weapons with a parts list attached to it I could check against that and the player's inventory. However, I have not been able to decipher a way to check details about a prefab BEFORE it is instantiated. Is there a way of doing this? Is there a better method all together (or am I left with options stated in the first paragraph)?

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by 1337GameDev · Feb 13, 2013 at 05:08 AM

I don't believe you are able to check properties about prefabs before instantiation. I could be wrong though.

The database problem is only very inefficient if the user can craft weapons they don't know about by combining materials and seeing what's created. If the users has to select the "recipe" to make, you can do a simple check for it's ingredients against the player's inventory or ingredient storage. Each recipe would have a list of separate ingredients (either by string id's or integer id's in an array) and these are checked when the user wants to create such an item. Not terrible hard however.

You can also use more efficient data structures, such as hash tables, binary search trees, AVL trees, or a linked hash map to store your data. If it's for desktop, you don't have to optimize here however, as this won't be that performance hogging of a check to do on a desktop. If it's for mobile i would probably try an AVL or binary tree if you can, but data base searching is still not horrendous as the user isn't going to be doing a crap ton else while crafting these guns.

Comment
Add comment · 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.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Where to store data about location 0 Answers

How to store profile data in unity with firebase 0 Answers

Store item images in database or on device? 0 Answers

Custom Editor Window to Create and Store Item Data 1 Answer

Data Storage 5 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