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 · Dec 15, 2010 at 05:23 PM · movementnetworkingaisyncnetworkview

Simple networked AI works if only one, but freaks out client-side if more than one

I've been banging my head against a wall for a few hours now, and cannot for the life of me figure out why this won't work.

I have a networked AI that works fine when there is only one, but when I add two, they freak out on the client side.

All the AI does is move around randomly, its a wandering script. I'm trying to do it authoritatively, so all the wandering code is only run on the server ( if (Network.isServer){ ). The AI object is a rigidbody, so I'm using a network view that is observing NetworkRigidbody, from the networking example on the Unity docs. However, I also tried RPC'ing the position/rotation updates to all clients in Update() on the AI script (the code in Update() to send the RPC if the position or rotation changed was also only run on the server).

Anyone have any ideas why this is not working?

Comment
Add comment · Show 5
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 Statement · Dec 15, 2010 at 05:33 PM 0
Share

This isn't really an answer but; make sure you are not using global state that you might mess up with, or that you do something like GameObject.Find("AI") if both are called AI. What do you mean happens when you say the AI "freaks out"? For all I can see, it could just beed Debug.Log("Frrrrreaaak"); :)

avatar image Statement · Dec 15, 2010 at 05:34 PM 0
Share

Does the AI work when playing offline while having two of them?

avatar image PrimeDerektive · Dec 15, 2010 at 08:11 PM 0
Share

I'm not doing anything with global states, as far as I can tell. When I say freak out, I mean they bounce all over the place, spaz, and one of them doesnt move at all.

avatar image PrimeDerektive · Dec 15, 2010 at 08:11 PM 0
Share

Yes, it works when played offline, or as just a server with no clients.

avatar image PrimeDerektive · Dec 15, 2010 at 08:12 PM 0
Share

I tried switching the spawning from RPC's to Network.Instantiate, and the Enemies actually work fine now, except they all spawn as soon as a player connects, completely ignoring the code on the spawner that calculates the distances between the spawners and the players before spawning anything (they should only get instantiated if an object tagged player gets within a certain distance of the spawner, in the server's instance of the game).

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by EliteUnity3D · Mar 09, 2013 at 03:30 AM

@Prime, can you tell me how you got your AI enemy to detect you presense online?

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

1 Person is following this question.

avatar image

Related Questions

How would I continue an object's movement in the same direction as per last user input? 1 Answer

How can I make a smooth movement for sync transform 0 Answers

One user controls all of them on network 1 Answer

Trying to make AI travel (and face) a waypoint 0 Answers

AI movement bug ("teleporting" after certain Platforms) 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