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 PrimeDerektive · Sep 10, 2014 at 12:36 PM · multiplayernetworkrng

Seed-based loot generation... what if I WANT a specific item?

I've developed a simple test loot generation system for my network game. My goal is to have every item reducible to the seed it was generated with so I can easily send items over the network with nothing but an integer, which I've managed to accomplish.

My issue is, there are a few cases, like monsters with specific loot tables, or vendors, where I want to be able to specify a particular item without knowing a seed that will generate it, but still be able to randomly roll the item's values, and still have it be reducible to an integer for network purposes.

I entertained the idea of using negative seeds to trigger a conditional for an array lookup instead of random generation, but I'm not sure how to roll the values the same after that?

Comment
Add comment · 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 VesuvianPrime · Sep 10, 2014 at 12:52 PM 1
Share

What is the advantage of sending the item seed over sending a copy of the item? It sounds like you've tried to be clever with your optimization and now you need to extend it you can't.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by orb · Sep 10, 2014 at 01:25 PM

If you have to use an integer, implementing the loot list as a custom asset list of fixed items might work. Then the integer is simply an index in the list, and lookup should be easy. If you can look up the index from the item's name, that is.

The way I'd prefer to implement it would be by generating code strings. One- or two-letter codes followed by either an index or value, combined to create an item description. There wouldn't be much need of storage for unique items, only a code that creates the object, its properties and holds its model.

Example: Let B be the base model asset (a class that holds a pointer to a model and a texture for the inventory symbol), D damage bonus, Rf fire resistance. A sword (index 8 in the model list) with +2 damage and 5% fire resistance could be coded as B8D2Rf5. More complicated use would be individual loot table scripts for different monsters that create items with attributes within ranges, trending towards certain resistances etc. The models and images would be simple custom assets.

On networking: You're best off using an authoritative server, which means the actual object is created server-side and copied to the players, and the string is shorthand for displaying the stats. Yes, there could be some hairy programming involved to implement this :)

See this blog post for a starting point with custom assets. They can make item generation a lot handier.

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 PrimeDerektive · Sep 10, 2014 at 08:37 PM 0
Share

I already have the authoritative networking and my current, rudimentary seed based item system working. I was hoping to avoid strings just because in uLink they are kind of expensive, bandwidth-wise (1 byte per character per string). Currently I'm only using half precision seeds, so I can send an entire character inventory in 72 bytes (30 items +6 pieces of equipment).

When someone changes a piece of a equipment, its nice that the server only has to send proxies a 2 byte integer vs. a potentially much larger string.

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

25 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

Related Questions

How I can convert data to Wifi/ Multiplayer/ Network 0 Answers

How to check for a host in a certain area in a open world game? 0 Answers

How to solve networking issues? 0 Answers

unity3d multiplayer respawn 2 Answers

Multiplayer. Destroying player object on Host/Server 2 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