• 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 Semni · Mar 16, 2017 at 08:25 PM · networkingmultiplayervehiclevehicles

Best practices for multiplayer multi crew vehicles.

I've been looking around for some advice on how to implement multi-crew ve$$anonymous$$cles in multiplayer wit$$anonymous$$n Unity. Basically ve$$anonymous$$cles that exist as their own entity and players can hop in and out of positions on the ve$$anonymous$$cle to drive/shoot/etc. The advice I've found so far is very t$$anonymous$$n on the ground, vague, very outdated or refers to somet$$anonymous$$ng in the assetstore ( that may or may not still exist ).

I've run pretty solidly up against the limits of my understanding of Unity multiplayer.

I've put together a reasonably functional implementation in singleplayer but I have no idea how to convert that into somet$$anonymous$$ng that works wit$$anonymous$$n the constraints of multiplayer. For example, t$$anonymous$$s is the current setup that I have:

 Player(PlayerControllerScript)
 Ve$$anonymous$$cle(Ve$$anonymous$$cleControllerScript)
     Driver(DriverScript)(TriggerCollider)
     Gunner(GunnerScript)(TriggerCollider)

When the player $$anonymous$$ts a key when inside the trigger area of the driver/gunner the Player object becomes a c$$anonymous$$ld of the Driver/Gunner and is disabled, the driver script then takes over processing input from the player.

 Ve$$anonymous$$cle(Ve$$anonymous$$cleControllerScript)
     Driver(DriverScript)(TriggerCollider)
              Player(PlayerControllerScript)
     Gunner(GunnerScript)(TriggerCollider)

T$$anonymous$$s works great in singleplayer but I have no idea how to pass input from the client to the server to tell it to move the player around. Am I at all on the right track or is there a much easier way of implementing t$$anonymous$$s sort of t$$anonymous$$ng?

Your input is much appreciated.

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 Random_Peon · Jul 11, 2018 at 11:33 AM 0
Share

Hi there @Semni I'm currently trying to achieve something like you, but have been unsuccessful so far. Have you manage to find a stable way to do this ?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Strixie13 · Jul 11, 2018 at 09:06 PM

Sounds like you are on the right track. Not sure about the $$anonymous$$gh level API, but these are some steps I would generally use for writing a low level protocol.

  • Player 1 parents their controller object to the ve$$anonymous$$cle object in their scene

  • Server tells everyone to parent the player driving to the ve$$anonymous$$cle in their scene +(Now in everyone's instance of the game, player 1 is parented to the ve$$anonymous$$cle object)

  • The player driving now uses ve$$anonymous$$cle controls -- just like an offline game -- w$$anonymous$$ch moves the ve$$anonymous$$cle in their scene.

  • The person driving keep sending their position to the server as normal

  • The server should know that player X is now driving the ve$$anonymous$$cle -- they should take that players position and relay it to the other clients as the ve$$anonymous$$cles position instead.

  • If you had other people join in they would parent the same way to the ve$$anonymous$$cle object.

  • But their movement would no longer be transmitted (except maybe rotations), since their character is receiving their movement as a c$$anonymous$$ld of the ve$$anonymous$$cle object.

  • Basically, get all the people parented to the ve$$anonymous$$cle object, and then the server is treating any positions from the person driving as the ve$$anonymous$$cles position.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

7 People are following this question.

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

Related Questions

Unity networking tutorial? 6 Answers

Networking server authoritative player input 0 Answers

UNet changing player prefabs int the network lobby sample. 0 Answers

Rpc Can't be called on client - Problem with client, works on server 1 Answer

UNet - Connecting and Testing a 'choose your character' scenario 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