Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Yaza · Sep 26, 2015 at 10:26 AM · loadingxmldatastrategy

Unit Data in a Strategy Game

Hello people,

I'm working on a turn-based strategy game at the moment and I'm looking for the best way to store complex unit data. I'm using a basic unit class and one xml file per unit, and every time I instantiate one, I fill the Unit class with the xml data.

Is there a better alternative to xml files for this purpose (I'm worried the loading of xml files might affect the games performance)? What is your preferred way to manage unit data in a strategy game?

Comment
Add comment · Show 4
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 MakakWasTaken · Sep 26, 2015 at 10:36 AM 0
Share

Ins$$anonymous$$d of using a xml file per unit why not use one xml file which contains all the data?

avatar image flapperkewiet · Sep 26, 2015 at 02:47 PM 0
Share

Personaly i haven't used xml before, i use a binary streamer and save my data as a ".dat" file. I don't know how secure you want your data to be but i think the .dat files are easier to crack then the xlm files.What is the size of the xml files? .dat files hold a 128 by 128 int array and 2 other seperat int and have a size of under 10 kB.

avatar image Yaza · Sep 26, 2015 at 06:36 PM 0
Share

yes using only one xml file makes sense, and could improve the loading issue :) Xml files can be as long as I want, $$anonymous$$e have a size of under 1kb. I'm not at a point where I'm worried about security yet, but it will be important later on, when I start developing the multiplayer mode.

avatar image Legor6 · Jun 02, 2020 at 08:50 AM 0
Share

Hello Yaza, I also like you are fond of creating a turn-based strategy. How can I contact you? I want to ask you a few questions,Hello, Yaza, I am also interested in creating step-by-step strategies. how can I contact you on social networks???

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Baste · Sep 26, 2015 at 07:32 PM

Scriptable Objects

The ScriptableObject class defines objects that's stored in your Unity project. They have a bunch of advantages over XML:

  • They're directly importable. You don't have to use XML parsing libraries or write your own parsing code to create a usefull wrapper for your data - you just grab them as an object from the Resources folder, or link them to a prefab that uses them in the game, and you're good to go.

  • They're stored as text files in the YAML format, which is a lot easier to read than XML files, and behaves much better with source control.

  • You can write custom inspectors for them just as easily as you write custom inspectors for MonoBehaviours, so it's a lot easier to create powerful tools to work with your data - either by selecting the scriptable object and fiddling with it's values in the inspector, or by creating larger editor windows that lists a lot of them.

Scriptable Objects are provided by Unity to let you work with stored data easily, so I recommend that you use them over xml files.

Comment
Add comment · Show 1 · 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 Yaza · Sep 27, 2015 at 01:37 PM 0
Share

Thank you, I will look into ScriptableObjects then, sounds interesting :)

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

31 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

Related Questions

How do i load Xml and assign variables to player in C#? 1 Answer

Loading multiple files using js, importing a set of xml files 1 Answer

save/load cloned game object 1 Answer

Save data through xml Serialization on iOS 1 Answer

Retrieving basic Strings and Ints from XML Files (JS) 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