Setting up JoySens for geeks
After some people having questions about JoySens and the way it controls the analog stick, I felt the need for a more clear tutorial. So here it goes.
1. The deadzone
As many might know, the PSP’s analog stick suffers from a pretty huge ‘deadzone’ that varies from PSP to PSP. This deadzone is the range in which the analog stick does not give reliable values, because they jump around even if the analog is not touched at all. This can be very frustrating with games, when your character starts to move even though you didn’t touch the analog.
So how to control that deadzone with JoySens? That’s what the adjust parameter is for. It controls the deadzone in a very clever way, that avoids jumps in the movement when you move the analog stick out of the deadzone range. I found 3.0 to be a pretty good value, as that gives a deadzone of ~ +-26 (meaning values in that range get translated to 0), which is a good estimate of the average error of the common faulty analog stick.
However, in case your PSP has a different deadzone, you need to adjust that parameter to fit your needs. You can either do this on a trial and error basis – or alternatively, with the help of a little math, calculate a near-perfect adjust parameter yourself. Don’t shy back on that maths point though, as it’s really easy and can be done with your computers calculator application easily.
(NOTE: If you’re lazy abouth maths – really lazy – you can just skip the following paragraph)
The formula to calculate a good adjust parameter x is: , where
is your maximal absolute amplitude you get from your analog stick when you don’t touch it. Normally this is somewhere in the range of 20-30. To solve that equation, all you have to do is use the log on both sides and reduce towards x. This will lead to:
(1)
which can be reduced to
(2)
and using the binary logarithm this would further get down to
(3)
In case your favourite calculator doesn’t support the binary logarithm, you’re left with formula (2), which isn’t much harder to type in though.
With this formula you’ll probably get something like (deadzone = 31) so what do you choose as the parameter? Well, 3.4 might be sufficient though 3.5 will be more on the safe side (the adjust parameter only has one decimal precision and that’s far enough). Actually, it normally doesn’t matter too much to be off by 0.1 as the difference is next to unnoticeable.
However, probably this value isn’t what you really want. Maybe you want your analog stick to react much later than the actual deadzone (you’re insensitive with the analog movement), so you probably might want to increase that value even further. The maximal value you can set is 32, which gives an effective deadzone of 110-111 making the analog nub behave pretty much like a digital pad.
A value of 1 will not change the behaviour of the analog stick at all and any value < 1 (apart from 0) will make the deadzone bigger (which you probably won’t want to use).
A value of 0 simply disables the analog stick alltogether.
2. The sensitivity
The sensitivity might very well be the least used option of this plugin, as I doubt a lot of people will want to slow down their analog stick (< 100%) and anything bigger than 100% will only make the stick more reactive, but not ‘faster’ (the maximal amplitude of the stick is still -128 to 127, as this is a software limitation which is unavoidable – you’d have to patch all games available). I found it’s main purpose in setting it to something higher than 100% when you want to control the way the stick reacts to movements outside your deadzone. With a sensitivity of 100% the adjust function behaves like this:
| real range | : | returned range |
| 0 – deadzone | : | 0 |
| deadzone – 128 | : | 1 – 128 |
so in effect you’ll probably have to push the stick more than the deadzone so that any game actually reacts (most games/apps already downscale the sticks amplitude so that values < scale don’t get recognized). With a higher sensitivity you’ll get an earlier response and this stays linear. I still keep it at 100% for my personal use, as I prefer the stick to not react too soon.
3. Smoothing
Probably the most important parameter to get a smooth control over the analogs movement without jumps. The problem for jumping behaviour is that the the physical amplitude of the analog movement is relatively short in comparison to the values represented (-127 to 128), ie the resolution is too high. A short measure showed the analog to have a range of 1cm (0.4″), where some space on the outer range is already the outer “deadzone” where the analog amplitude doesn’t change anymore. So assume it’s still something along 0,7cm (0.28″) effective range (and that’s not subtracting the inner deadzone!), that means that the resolution is . This means that a movement of 1mm (0.04″) of the analog will already change the returned value by ~36.
You have to be pretty sensitive to get a smooth movement with that, and I at least am not sensitive enough to be able to move crosshairs in PSP games in a way that I can aim efficiently (I used to be a pretty good CounterStrike player though, so it’s not just that I’m incapable). Unfortunately, we cannot extend the physical area of the analog stick with software, so we are left with finding something else.
Simply scaling down any changes in movement won’t work either, because then you’d not get the full range of the analog stick (similar to sensitivity < 100%), which we don’t want most of the time.
Now away from this theoretic talk, back to the practical use of the smooth parameter. Changing the smooth value to something < 100% kind-of delays the response of the analog stick to movements. A value of 50% means that a change of the analog will take roughly 5-7 times as long to be applied (normally each change gets recognized instantly, meaning within0,0167s – assuming 60 FPS – at 6 fold delay this is already 0,1s), smoothly fading between the values.
The formula that describes the effect is the following (mathematically intimidated people may skip the following paragraph again – this one is getting really ugly):
Assuming A is the absolute of the amplitude of the change that was given that frame (which is somewhere in the range 1-255), s is the smoothness factor in percent, then it takes n+1 frames to get to that amplitude, where
We can further reduce this to the following:
or
we can approximate a solution to this by checking for the difference of n and n+1 being smaller than a small epsilon (which is best chosen as 1/A as from there, the change won’t have any influence on the result due to integer precision).
From the sum changes by
so we can evaluate a good approximate n with summing up starting from l=2 until this is smaller than
, where
. The
term also accounts for the fact that a bigger amplitude needs longer to get applied. The resulting n needs to be increased by one to get a final result. As an example let’s calculate the number of steps (frames) it takes with an amplitude of 32 and a smooth factor of 50%:
so for n = 5 we have a solution, meaning that it takes n+1 = 6 frames for a movement of 32 to be applied.
What this means is that you have more time to react on the rough input you give and react on that to adjust it. So the value for that parameter depends on your reaction time and preference. In games where you want to get very fast turns, higher values are better (though IMO anything > 150% is insane – getting back to the theoretic aspect it would mean that a difference of 1mm in movement would already change the analogs value by ~54 – that’s one third of the maximal amplitude in one direction!) and in games where you want smooth turns (racing games anyone?) values < 100% tend to give better results.
4. Calibration
The most important (and hardest to set correctly) factor for avoiding ghost-movement of the analog stick. If you haven’t ever had any “ghosting” of the analog (the stick suddenly moving in one – always the same – direction), you probably don’t need to setup this parameter.
If you have had this experience, you might know how annoying it is. It can really ruin your game. The biggest problem with this illbehaviour is that it’s pretty much unpredictable – and it’s exactly as hard to fix in software as it is to predict.
My solution to it is a better calibration of the stick, in the sense of finding the ‘correct’ center point. For the people that might wonder why this is necessary, since there is already a ‘hidden’ calibration functionality in the PSP software > 2.7 (going to settings – system information and moving the analog stick around in circles a few times) – the firmwares calibration only finds the maximum amplitudes of the stick in every direction and scales the return values appropriately to be in range -127 to 128. It doesn’t in any way change the behaviour of the stick when untouched – and that’s exactly the point where the stick just plain sucks.
So how do you find the proper center point of your stick?
Short answer: There’s no way to find the real center, as there isn’t one – this beast just keeps jumping around in different ranges whenever it’s left alone after moving it around slightly.
Long answer: Try finding the average minimum and maximum amplitude in every direction, then center it at . To do this, move the stick to it’s extremes, then let it go back to the center slowly. While there, watch the values that the plugin gives as the first coordinate pair in the first line (“Adjusted analog axes: <x,y> -> <x’,y’>”).
Try to either find the min/max values yourself, or use the automatic detection function by pressing NOTE + SQUARE. Repeat this step several times to find a good average. Finally, you may have found some value distinct from <0,0> which tells you that your analog stick is off-centered. If the values are <-13, 10> for example, this would mean that the analog stick tends to move towards the left-bottom. Check if this is true (you can do this by setting the adjust parameter to ~2.5-3, smooth to 100 and sensitivity to 400, then see if the analog stick moves in that direction very often and never in the opposite) and if so, set the center parameter to that value. Then check again and see if the stick stopped moving randomly around like that or repeat and adjust the center until you have a good enough position that avoids most of that ghosting.
Unfortunately, I could not yet find a method that works 100% since the behaviour is just too random and the amplitude of the ghosting jumps around as well – especially when other buttons especially the D-Pad are pressed. So once you’ve found a ‘good enough’ center position, your only way of completely shutting down the remaining ghosting (which hopefully now at least tends to go into random directions) is increasing the adjust parameter.
5. Summary
So what have we learned now?
1. I’m a total maths and analyzation geek (and either me or wordpress suck at page formatting).
2. Sony totally screwed up the PSP’s analog stick (and only gave us one of them… is this better or worse?).
3. This plugin does much better at fixing those issues than most people think at first, using the proper settings.
4. There is no soft solution to hard problems.
First I would like to congratulate you on your excellent work on this plugin (still my favourite to date).
Second I would like to tell you about bug you probably already know of: When adjusting the parameters in the joysens gui on the xmb sometimes the contents of the memory stick appear corrupt, although they are not. A reboot as to be applied in this case.