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 iSleepzZz · Jun 16, 2014 at 07:37 AM · c#networkphoton

Is this bad for the network?

Hello everyone!:)

So, I am currently developing my own online multiplayer shooter on Unity engine and am currently using Photon Networking as my server + networking of the game. Now, I have an enemy which loops playing an idle animation and if a player gets within 10 feet of him, I want him to play his walking animation but, of course, I want everyone to see his animation is now walking so I must sent it over the network. This is what I am doing for that:

 if (Vector3.Distance(player.transform.position, this.transform.position) < 10) {
             transform.LookAt(player.transform.position);
             transform.position += transform.forward * 0.8f * Time.deltaTime;
             //transform.Translate(0.8f * Vector3.forward * Time.deltaTime);
             transform.GetComponent<PhotonView>().RPC("PlayWalkAnimation", PhotonTargets.All);
         }
 
     }
 
     [RPC]
     public void PlayWalkAnimation() {
         animation.Play("walking_3");
     }

This is all in the Update void and if someone is next to the enemy then it will constantly call "walking_3" animation with a RPC network call every Update void so would this be too intense for the Photon Network? And if so, how can I make this work but not so poorly coded to stress the network ?

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 Xitech_ · Jun 16, 2014 at 08:07 AM 0
Share

Just a side note. The Update() function is called as much as possible. I think you should at least place this in a FixedUpdate(). This function is only called 60 times a second. I can unfortunately, not help you any further as I've never used the network. Please see Unitys video about it here: Update and Fixed update

2 Replies

· Add your reply
  • Sort: 
avatar image
-1

Answer by fholm · Jun 16, 2014 at 08:31 AM

Yes this is very bad for the network.

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 Benproductions1 · Jun 16, 2014 at 10:20 AM 0
Share

It's not actually bad for the network. The amount of data sent would be off by a factor of hundreds when compared to video strea$$anonymous$$g and FTP. I'm going to have to -1 for simply being wrong.

avatar image
0

Answer by Benproductions1 · Jun 16, 2014 at 10:19 AM

While not technically "bad", ie. it won't overload your network (or even come close), it's not even near optimal. Unless you're doing this thousands of times per second, you're not actually sending that much data. But note that it does stack up, and while "not bad for the network" will stay true, the CPU overhead of serializing, packaging, unpackaging, deserializing, reflecting and calling can definitely become a bottleneck.

You should only call animation.Play once, meaning you should also only call your RPC once.

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 fholm · Jun 16, 2014 at 10:21 AM 0
Share

Honestly, the CPU will never be bottlenecked on something like this, you will crash the network before you overload the CPU

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Tying to parent objects in game with Photon.PUN OnPhotonSerializeView 0 Answers

Photon Network Problems 1 Answer

Photon wont sync for the masterclient. 1 Answer

Unity3D Photon movement synchronization 0 Answers

Multiple Cars not working 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