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 Elric · Dec 12, 2012 at 06:46 PM · rpcbandwidth

RPC.Others vs multiple RPCs

I want to send RPC with some data only to players that are close enough to current player. For example, we have 100 players.

 function Update(){
     networkView.RPC("Function", RPCMode.Others, someData);
 }



vs

 function Update(){
     for(var player : NetworkPlayer in PlayersList){
         if(range < 100){
              networkView.RPC("Function", player, someData);
         }
     }
 }

Question: sending RPC with RPCMode.Others is cheaper by performance or bandwidth than sending multiple personal RPCs, or in fact RPCMode.Others is the same as 99 times send RPC("", somePlayer : NetworkPlayer)?

Comment
Add comment · Show 2
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 Julien-Lynge · Jan 08, 2013 at 08:55 PM 0
Share

Just a comment: If you're trying to do large environments like that, RPC may not be the right technology to do so. You're entering $$anonymous$$$$anonymous$$O territory, and may want to consider technologies like SmartFox and Photon to handle the communications. There are ways of integrating them with Unity, either yourself (if you're an expert; there are many examples) or with 3rd party code like Jibe.

We've used SmartFox, and you can easily send a single message to the server, then write a simple extension there to take the player positions and deter$$anonymous$$e who to send the message to - one message to the server, and one message from the server to every player that needs it.

avatar image Elric · Jan 11, 2013 at 10:16 PM 0
Share

Thanks for your comment Julien. I have read SmartFox documentation and tutorials. It's very flexible and functional, but I didn't find sugnificant features that can't be implemented by unity scripts. Javascript's functionality is enough for my purposes - to create rooms, groops, authoritative server and so on. But am I missing something? Is there some limitations to concurrent users number, or sugnificant performane loss when CCU number exceeds several hundreds? What does SF and Photon have that can't be made by unity tools?

Right now my communications looks like this: - Update 15 times/sec. - Users send their inputs to server(only those that have been changed) - Server sends positions, rotations and few other bytes of all users as one byte array using single RPC.Others.(only those bytes included that have been changed) Calculated traffic for player at 100 connected users is 1.26$$anonymous$$B/sec up and 10.20$$anonymous$$B/sec down including headers and security bytes.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Elric · Jan 08, 2013 at 09:55 PM

Made some quick testings. Created simple scene with no graphics, only GUI. Server and 10 clients on local machine. In Update:

 if(mode == "Others"){
     networkView.RPC("Do", RPCMode.Others, Data);
 }
 else if(mode == "Each"){
     for(var player : NetworkPlayer in Network.connections){
         networkView.RPC("Do", player, Data);
     }
 }
 var scsvsw : StreamWriter = File.AppendText("test.csv"); 
 scsvsw.WriteLine(mode+";"+1/Time.deltaTime); // mode and FPS
 scsvsw.Close();

Function "Do" does nothing. Var "Data" is byte[4096]. Results: 68.5812 FPS in Others mode vs 64.2191 FPS in Each mode. But most times FPS is 60 in both cases, and it jumps to 280 about once every second in Others mode and to 260 about once every 4 seconds in Each mode.

Does anyone knows the reason of this peaks of FPS? Also is there any way to get Actual bytes send/recived in script?

I'll post more testings after implementing both modes in game.

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

10 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

Related Questions

RPC and State Synchronization bandwidth decreasement 2 Answers

Really quick/easy question about RPCs 1 Answer

RPCMode.All Question 1 Answer

How to send BUFFERED RPC calls to specific player? 0 Answers

RPCMode.AllBuffered Basic Question 1 Answer


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