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 Lenadros · Mar 26, 2014 at 04:57 AM · authoritative serverpredict

Player Rotation With Mouse Over Server

Hello,

I've been trying to solve this problem for days. I have an authoritative server and I've gotten player movement to sync up very well. But when I tried implementing rotating the player with the mouse (FPS Looking). The server and client become incredibly out of sync, even though they are running the same calculations. I pin pointed the problem to the client side prediction of the player rotation. But I'm not sure how the server and client can get different values when running the same calculations.

 public void RotatePlayer(float mX)
 {      
      xRot += mX * lookSensitivity;     
      transform.rotation = Quaternion.Euler(0, xRot, 0);
 }

This is how I rotate the player based on mouse input. Because the client and server are so out of sync, it results in jitters and misinterpretations. I feel like its because the abrupt changes of mouse movement can not be predicted the same was a keyboard movement. Any ideas or examples?

Comment
Add comment · Show 2
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 taylank · Mar 26, 2014 at 06:11 AM 0
Share

Okay, question: Do you really need the server to 'calculate' the rotation? Can you send the client's rotation to the server ins$$anonymous$$d of mouse position (which is what I assume you are doing)? Server authoritative doesn't necessarily mean you have to process player input server-side. You can do that client-side and have the server only decide on critical events.

You may also want to check if the difference is within an acceptable margin of error (i.e. if the rotation difference is less than 1 euler degree, don't bother correcting client)

avatar image Lenadros · Mar 26, 2014 at 04:02 PM 0
Share

$$anonymous$$akes sense and you were right, I was sending mouse position to the server. But what prevent players from hacking their rotation on their end (aimbot) and sending that to the server. Is this something that cannot be prevented?

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by fholm · Mar 26, 2014 at 08:17 AM

When it comes to rotation, you don't correct the client at all. You let the client decide its own rotation and just send the result of it to the server. Even in an authoritative setup, yes.

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

Answer by taylank · Mar 26, 2014 at 08:09 PM

Okay, I will answer this as a question about aimbot prevention, as that is really your main concern.

One thing you can do is to watch for unusual rotations that were triggered without corresponding mouse movement. You can do that check client-side (which can be hacked), or server side (in which case, you'd still beam the mouse position to the server, but just for comparison purposes), or both (if the client check fails, save yourself some bandwidth and don't bother sending it to the server).

It is possible to get false positives however if your game world includes interactions that can change a player's rotation without their own input (i.e. collisions, scripted events). In which case, you might wanna get smarter about it, like doing this check only in the event of a successful bullet hit, and maybe even tracking the incidence frequency and raising a red flag over a certain threshold.

And even that is not failsafe, as cheaters could also find a way to manipulate the input.

Take a look at this stackoverflow post for a thorough list (although I'm not sure how many can be applied to Unity): http://stackoverflow.com/questions/960499/how-to-prevent-cheating-in-our-multiplayer-games

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 · Mar 27, 2014 at 05:11 AM 0
Share

I would say that trying to prevent cheating by checking mouse rotation is to error prone, and even most AAA games don't do this.

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

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

Related Questions

Emulating authoritative-client behavior (like NetworkTransform) for SyncVars 0 Answers

How to predict where the ball will fall? 4 Answers

Authoritative Server / Player Communication 1 Answer

Unity networking collisions with client authority 1 Answer

How to make enemy try to predict were object is going and stand in its path ? 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