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 MalikDrako · Oct 12, 2017 at 12:37 AM · multiplayermultiplayer-networkingprocedural-generation

Transferring procedural map to clients

I am working on a simple multiplayer game that uses a map generated by the server. How can I transfer the map to clients when they join? The map data is an array of heights, currently float[], and about 300,000 points (approx 1.2MB). The map is generated from information only available on the server, so I cant just send a seed and re-generate the map on the client. The absolute minimum would be packing the data for two points into a byte, for a total of 150kB.

I have tried using a ClientRpc to send the data, but that freezes the editor when it is the server, and causes an out of memory error when a (32 bit) standalone build is the server. The standalone server normally uses just over 150MB of RAM, so the RPC is adding at least another 2GB. Further testing revealed a limit somewhere between 5000 and 10000 elements in the array

 [ClientRpc]
 public void RpcUpdateTerrain(float[] heights) {
     Debug.LogError("Got heights, len: " + heights.Length);
 }

What is the recommended way for transferring the map data?

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 Bunny83 · Oct 12, 2017 at 02:28 AM

Well, RPCs (remote procedure calls) aren't ment to submit a large amount of data. However i don't see a reason why it shouldn't work. Obviously that amount of data doesn't fit into a single packet so it has to be splited into several packets.

One solution might be to send the data in several smaller chunks. Depending on the nature of those values you might be able to use some sort of delta compression. Apart from that any kind of compression would of course help to reduce the amount of data you have to send.

I doubt that 1.2MB of data can cause an out of memory exception. You may do something wrong, somewhere which might cause this problem.

Keep in mind that any kind of network game should have runInBackground set to true.

Comment
Add comment · Show 2 · 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 MalikDrako · Oct 12, 2017 at 04:49 AM 0
Share

Is there a way to check how many slots are left in the send queue? When I switched to sending it in chunks, I got errors and warnings about dropped packets.(I'll check what the actual error was tomorrow) After setting the chunk size low enough that the errors stopped (500/frame), it takes much longer than I'd like to send.

I'm not sure if something else is contributing to the OO$$anonymous$$ exception, but just switching from sending new float[10000] to the actual array caused it.

avatar image MalikDrako MalikDrako · Oct 12, 2017 at 04:17 PM 0
Share

With the array size set at 5000, I got two logs no free events for message in the queue, two errors Failed to send internal buffer channel:1 bytesToSend:16, an error ChannelBuffer buffer limit of 16 packets reached., and a warning ChannelBuffer recovered from overflow but data was lost.

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

121 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

What is the maximum feasible number of players in a procedural-generated, top-down 2D MMO? 1 Answer

Unity Multiplayer Design. Is it complicated to implement and learn? 1 Answer

Code Wont Work? 0 Answers

Questions about Multiplayer and Networking? 1 Answer

What do I need to implement web-server for multiplayer without Unity services? 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