playMaker

Author Topic: Input from controller affected by FPS? Higher performance = higher sensitivity?  (Read 2424 times)

daniellogin

  • Full Member
  • ***
  • Posts: 215
My rotation sent to objects via an Xbox stick seems to change based on the FPS (or at least the performance) the game is running at. I found this by testing the game on a system that could barely handle it, then seeing the result of the controller sensitivity in a mini game which I doubled or even tripled the performance in.

So I started to think about it and maybe it's because things are done Every Frame, so if the system is running more frames, it does it more? It reads the input from the controller more per second?

So how do I balance this? I could create a master sensitivity (multiplier) float so players could change to suit during the game... but that would F ing suck. I mean to be practical, I would also need to add the ability to pause the game in all of it's mini games and etc, along with the menu to adjust the sensitivity with. Way too much work. Also each mini game and the main game will run at different performance levels, so would require constant adjusting.

I've attached an image showing roughly how I'm doing some first person aiming in a mini game. It only shoes some but the rest is more of the same.

I get the Input Axis (using InControl to map), multiply it by either -1 or -1 (was previously on 1.2 during last build), I add left and right floats, as well as up and down floats, so I have 2 combined floats, then I feed those in to a Set Rotation as the X and the Y angle done Every Frame.

Looking at it now as I'm writing, I see the settings; Per Second and Fixed Update. Could one of those be the answer?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Hi.
Did you test in a build or inside unity?

as far as i know Physics and FixedUpdate() are done with a fixed time step.
So try setting FixedUpdate

See Edit/Project Settings.Time and hover over Fixed Timestep.

also look to Quality settings.

if Vsync Count is active it will limit the refresh rate.

For most games you should minimum have a steady 60fps or higher.

For sprite based 2d games you can get away with 30fps.

if your machine does not reach this, your minimum required should be higher than that.
or you can try to optimize your game so you can reach a minimum of 30/60 fps.

Use the profiler to see what uses a lot of resources.

For example on cpu usage, see if rendering or Physics are very high. the look if you can change to get better performance.

Like for example if you would move an object with force (every frame) it can use a lot of resources, then look if you can use 'Set Velocity' instead

daniellogin

  • Full Member
  • ***
  • Posts: 215
Hi.
Did you test in a build or inside unity?

as far as i know Physics and FixedUpdate() are done with a fixed time step.
So try setting FixedUpdate

See Edit/Project Settings.Time and hover over Fixed Timestep.

also look to Quality settings.

if Vsync Count is active it will limit the refresh rate.

For most games you should minimum have a steady 60fps or higher.

For sprite based 2d games you can get away with 30fps.

if your machine does not reach this, your minimum required should be higher than that.
or you can try to optimize your game so you can reach a minimum of 30/60 fps.

Use the profiler to see what uses a lot of resources.

For example on cpu usage, see if rendering or Physics are very high. the look if you can change to get better performance.

Like for example if you would move an object with force (every frame) it can use a lot of resources, then look if you can use 'Set Velocity' instead

I found using Per Second in the rotate action seemed to be the solution. I tried it on my slow laptop and the rotation sensitivity is like my good computer.

Thanks for the other tips. I am aware of most of it though. This particular project has Vsync off for all profiles. I don't see any tearing so seems fine like that.

I did see while trying to figure out what those other options are that people recommend using Fixed Update for physics, however for this case it's just the input and rotation vector.

The framerate is good on my best computer and the other fairly good system I have, but the laptop struggles. I can get it to around 30 fps stable if I use the default Low Quality profile (no real time shadows and other stuff), as well as turn off the AO and Bloom. Weirdly enough, the SSAA I'm using (Mad Goat asset) seems to be practically free, with maybe only 1 fps difference (just roughly monitoring FRAPS) between completely off and on 4x + FXAA.

That laptop is a 7700HQ (2.8ghz) + GTX 1050 (laptop version of course). That's a fairly weak system, right? What do you reckon about that as a minimum for a 3d game that's meant to look pretty (still does on those low settings, in my opinion at least).

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Hi.
gtx1050 is not that weak.

Have you looked with profiler what uses the most cpu?

daniellogin

  • Full Member
  • ***
  • Posts: 215
This project started as just a personal thing for the family to play, but the more it's come along the more seriously I'm taking it. So originally it only had to work on my two good computers, one being an i5 7600k and the other being an i7 7700k, and both in the past using a 1080, but since the start of this year I'm using a 2080ti on the better system. I just checked the Steam hardware survey and realised how out of touch I am, and yeah something like a 1050 is apparently still widely used.

I don't really know how to use the profiler properly. I just look at the data and have no idea what I'm meant to take from it. I attached a screenshot, but of course that only some of the data and I don't know what anyone would want to see. This is done in the editor preview, not in a build.

The biggest CPU use, at 52%, is rendering? With Profiler.CollectGlobalStats second at 28%.... but does that mean the actual profiler I'm measuring with??

And what about that 5.3% EditorOverhead? That's Unity Editor? Something missing in build?

Everything else is individually tiny and only accounting for about 15% collectively.

daniellogin

  • Full Member
  • ***
  • Posts: 215
Oh I should mention that the lighting isn't baked. It's so slow and such a pain that I just haven't done it yet. The scene with that profile is just using 2 directional lights, one of which has real time shadows and the other other has none. No baked anything.

It is using Occlusion Culling.

I figure baking could help take some load off.

daniellogin

  • Full Member
  • ***
  • Posts: 215
Looks like this:

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Hi.
To learn about the profiler you can google or youtube 'unity profiler tutorial'

I don't have a lot of experience either, but it did help me already finding some issues.