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
1
Question by garrettar · May 24, 2012 at 09:02 PM · serverclientsyncnpcnpcs

Server + Client NPC Syncing issue

So currently I have an MMORPG in the works. I have it set up so the Game loads a TextAsset called NPCList.txt. In the npc list it loads up the NPC ID, the position, rotation, the walkable area, and the amount in each area.

The thing is, even when I add a Network View, the Instantiated NPCs are not synced together, and are in different places. Also the bytes sent over the server are huge when it comes to a network view per NPC. (Also the NPCs wander around within the space).

I instantiate the NPCs from a Prefab in Resources, using Resources.Load. I apply the NetworkView to the prefab itself. In the coding of NPCWander and SpawnNPC there are no codes that relate to the networkview.

How would I go about syncing them together?

I think i would prefer it where the server dos the pathfinding for the NPCs, sends out the Position, rotation, animation and such. I don't want the pathfinding and set destination done on each client.

Comment
Add comment · Show 11
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 garrettar · May 24, 2012 at 09:12 PM 0
Share

B U $$anonymous$$ P ?

avatar image whydoidoit · May 24, 2012 at 09:30 PM 0
Share

On Unity Answers people are looking for tightly defined questions and/or - you are better off posting on the forum if your question is wide ranging

avatar image garrettar · May 24, 2012 at 10:04 PM 0
Share

well I was looking for a response like "Set the network view to do this to that, and instantiate the npcs with a script that does this... etc

avatar image whydoidoit · May 24, 2012 at 10:08 PM 0
Share

It's hard to do that without something to look at. The FAQ for this site is worth reading before posting a question.

Are you creating your objects from prefabs, how are you adding networkViews to them, how do you tell the other players about the networkViews or are you relying on Network instantiate? If you have something specific, edit your question and post it.

avatar image whydoidoit · May 25, 2012 at 12:18 AM 1
Share

So if you add your own network views then you need to be calling functions to associate them on different computers. You need a master controlling object somewhere that gets RPCs to tell it to create local copies and associate them. Without seeing your code I am guessing though.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Bunny83 · May 27, 2012 at 09:46 AM

Basically there are two ways of handling objects synchronization:

  • Only the Server / Master instantiates the prefab with Network.Instantiate. This will send a buffered RPC to all player to tell them to also create this prefab and it will link the NetworkViewID of the NetworkView so the objects are linked together. Since it's a buffered RPC, a new client will get this RPC as soon as he joins the server. Note that you have to handle all important things with buffered RPCs in this case. The LoadLevel command has also be sent with a buffered RPC so a new client first loads the level and then it creates the other objects.

  • The second way is more flexible but a bit more complicated. You instantiate the objects manually. The server / master send the NetworkViewIDs via RPCs to the clients and they have to match them up with the corresponding object. You have to keep track of all objects manually on the server and tell new players about them manually. In a complex game with a lot of objects i would go this way.

Comment
Add comment · Show 10 · 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 garrettar · May 27, 2012 at 03:19 PM 0
Share

Thank you VERY much. It's going to be an $$anonymous$$$$anonymous$$ORPG, with well a lot of NPCs. I have different Islands. (Each island with a town and forests etc for monsters. What if i had a seperate NPC Case for each island and used the first method with Network.Instantiate? That would let me do the simple way, yet keep the NPC Count low. (Each NPC Case would appear upon teleporting to each island.

avatar image garrettar · May 27, 2012 at 03:21 PM 0
Share

One last thing, with the Network.Instantiate do i need to attach a NetworkView to the individual NPCs?

avatar image whydoidoit · May 27, 2012 at 03:22 PM 0
Share

Yep, you do.

avatar image garrettar · May 27, 2012 at 03:38 PM 0
Share

Ok the NPCs spawn accordingly, but don't Wander accordingly. Im adding in the NPCWander script a code that basically is, if server, RPC.gotodest = decided destination. Also whats the difference between RPC$$anonymous$$ode.All and AllBuffered?

avatar image whydoidoit · May 27, 2012 at 03:49 PM 1
Share

AllBuffered = sent to players even if they connect later, All = only players connected now.

Check networkview.is$$anonymous$$ine and don't path find if it is false

Show more comments

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiplayer syncronisation 1 Answer

Network sync complicated server-client relationship 1 Answer

How do I use uNET to send client data to server (SyncListBool goes the wrong way)? 1 Answer

Server and Network no communication 1 Answer

I don't know difference between interpolation and non-interpolation 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