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 Anymeese · Oct 27, 2013 at 07:30 AM · movementmultiplayercontrols

(LOCAL) Multiplayer controls?

Hey guys! I'm making a small game for our bi-monthly LAN parties, but this is my first attempt at a Multiplayer game, so I'm not too sure how to take each player's input

My idea was to add a "p1" at the beginning of the names for the current "horizontal" and "vertical", then add a p2, p3, and p4 version of both, then in the code, say:

 if(p1 horizontal != 0 OR p1 vertical != 0)
     move p1;
 else if (p2....)  etc

However that creates a lot more checking for EVERY frame, in update and Idk if that will be too much, if it would be okay but there's a more optimal way that I'm not thinking of, or if perhaps there is already set code/features to handle this situation that I just don't know about yet!

So... what's the best way to handle local multiplayer (4-person max) up/down and left/right (4way) movement controls?

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by ragnaros100 · Oct 27, 2013 at 09:32 AM

If you're using controllers you can use unitys built in Joystick1, 2, 3 and 4 Inputs and check for that. I would recomend xinput if you're using xbox 360 controllers.

If you're not using controllers, but are using keyboard(s). You should do what you are doing now. Unity's a powerfull tool and a couple of for loops wont crash it.

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 Anymeese · Oct 27, 2013 at 02:26 PM 0
Share

Joistick 1,2,3, and 4 Inputs are perfect :D How does Unity go about deciding which one is #1, 2, 3, and 4? Is it the order they're plugged in, certain ports, or wha?

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

17 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Movement speed of 2 players not matching 1 Answer

I cant figure out how to change my simple Movement controls to touch, can anyone help? 1 Answer

Unexpected LAG :\ 1 Answer

Using different inputs for different objects 0 Answers

[UNET] Arbitrary movement on client side. 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