idea: do a match and after get a "sensitivity" that maximazes your accuracy.
#1
lately i've got interested into optimization algorithms
and i thought that it would be possible to use them on AC...
i think that when we choose a sensitivity parameter we not are maximazing our real weapon control but only the perception of it (which most of the times is wrong)
i'm aware that after a long time playing with the same config one is going to get used to the choice taken long before (the sensitivity and mouse accel)

so what if it would be possible to estimate our best sensitivity in a mathematical way?

i made an attempt at this:
modification to AC that gets this data and writes it to a logfile:
Mouse-DX , Optimal-DX, curtime

then after playing a few minutes:
i quit AC and i run my optimization algorithm (sthocastic hillclimber) on the dataset with the objective
of getting a sensitivity and a mouseaccel parameter that minimizes the difference between my aim and what would have been "the perfect aim" in that instant.

and after milliseconds or so of computation on the dataset i get those two parameters:

my original sens was: 1,8 and i got 34% accuracy with SMG on a ac_desert bot deathmatch on medium difficulty in the training game

then i decided to try the estimated parameters
sensitivity 2.58
mouseaccel 0 (strangely the algorithm found that mouseaccel for me is best left at 0)
and i got a 41% accuracy on the same mode map nbots ecc. (my percieved control over the weapon was less than before but getting used was very fast!)

conclusion i got a free almost 7% boost on accuracy with this. (it's too soon to say it's actually that way but i still got VERY surprised, i was suddenly tracking moving bots with much more easy, kinda obvious you would say the sens is higher now)
so is anyone with coding experience and good intention interested?

edit..
after making more tests it looks like it doesnt settle near some sensitivity it jumps whener i recreate the dataset with another starting sensitivity...
--
RE-EDIT: reformulated the problem, and fixed the above bug!! :D



Download link and readme : http://forum.cubers.net/thread-3814-post...l#pid66465
Thanks given by:
#2
OMG. fantastic idea. Good work.
But how would you code it?
Cubescript? o.O
Thanks given by:
#3
C++ is the only option
since i had to make an external program to analyze the data i captured in AC.
Thanks given by:
#4
I'm interested in seeing how you do this, and trying for myself.

You want help with coding, but it seems finished? What kind of help do you want exactly?
Thanks given by:
#5
it's not finished it's mostly an attempt and now i fixed a few bugs in the algorithm...
tell me where and i send you the modifications to both the AC source and the external program, and i'd like someone with math experience to find where i made the bogus because i know for sure there is some problem in it
Thanks given by:
#6
Well, I (probably) cannot help you, but I still am curious.

As long as the external program is cross-platform (meaning, works on mac), you can send it to the address in your PMs.
Thanks given by:
#7
nope it's not cross platform.. i can only offer the source code
but it's not working like it should, it kind of finds the direction where to improve but it fluctuates wildly
after the extensive tests i made...

edit.
the above bug seems to be completely fixed by the new problem formulation
Thanks given by:
#8
I am a bit confused, for clearing it up, you are mapping
inputs:
Mouse-DX
current yaw
yaw where the closest enemy lies
TimeFrame
sensitivity

outputs:
/sensitivity
/mouseaccel

minimalize:
senisitivity in input

i don't see that function for mapping with which you are working

If you don't know that functions, it is possible to get them from data ... then you will learn a model (hidden parameters) and then it can be dynamic online ... so if you know that functions, you can use them for dynamic changes...

ps. i understand you are painting graph from inputs and outputs, then you find optimal path in graph and then you report values in this optimal path, but i don't understand where you get mapping for various outputs
Thanks given by:
#9
actually alien i'm not minimizing sensitivity i'm minimizing the sum of the squared differences from the player aim from what would have been the perfect aim in that instant.

anyway alien it looks like you know a lot about this stuff and i'm interested in what would be your way of finding the perfect sensitivity in a mathematical fashion...
my method (if i can call it that way) is unstable and it's just an attempt...
if you want to see the source code i can mail it to you
i dont know if i am allowed to post the code here since part of it could be adapted into an aimbot by the malevolent...
Thanks given by:
#10
(21 Aug 11, 02:17PM)Alien Wrote: outputs:
/sensitivity
/mouseaccel
minimize:
....input
*
... from data ... then you will learn a model (hidden parameters)
... and then it can be dynamic online ... dynamic changes...
optimal path

this entire concept is incredible :D lots of potential.
?'s
minimalization?
hidden parameters?
dynamization?
all open questions.. tell me everything you know (rofl..)

*edit, also: limiting error is one goal, speed is another. These must be calculated separately?
Thanks given by:
#11
They should be calculated as individual factors. Then integrated in the model. Also mouse dpi is a factor.
Thanks given by:
#12
Yesss! by reformulating the problem, i simplified the dataset structure to:

DX PDX CurTime
where:
DX = mouse delta X
PDX = perfect aim mouse delta X
CurTime = TimeFrame

this fixed almost all of the issues i was having

so now the inputs are:
DX PDX CurTime

and the outputs are:
sensitivity mouseaccel

now the objective function to be minimized is this:
sum from 0 to n of: pow(DX(n)/33.0*e_sens-PDX(n)*CurTime(n)/9,2)
with e_sens being the estimated sensitivity plus the maccel component.

*CurTime/9 this is needed because PDX value is an instantaneus complete adjustement which a human cannot make so it has to be normalized to obtain a useful sensitivity value
anyway that /9 constant has to be reviewed and set to more accurate values,
the best thing for that would be to run a modded server and see what the mean mouse movement velocity is, but i think i got it very close anyway (i obtained it doing the inverse problem, trying to make the PDX as close as possible to the DX and in this issue i used my best sensitivity).

now the algorithm is converging to the same sensitivity value when started on datasets that had different sensitivitys (atleast for me)
now i need someone to test it :) and to tell me if they get improvements in their accuracy.

@Viper: dpi is not needed in the model since it's approximately a scalar applied to DX and the optimization is made to bring DX to PDX as closely as possible using one scalar "sensitivity" and a non linear adjustement "mouseaccel".

premise:
my best sensitivity is around 2.6 (and in the first version of the algorithm i was lucky enuff to get to that value)
RESULTS:
using a dataset produced with sens=1: sens:2.65596749951308 maccel:7.37441540697647e-15
using a dataset produced with sens=2.5: sens:2.67095337700015 maccel:2.79989582531623e-16
using a dataset produced with sens=4: sens:2.55510040757476 maccel:4.19500044802589


in the first two maccel = 0
in the one pruduced at sens = 4:
the sensitivity is the same but accel = 4.2??? well i think that's actually a measure of the uncertainty my hand had, it was very hard controlling the aim at sens =4 for me so i produced a dataset with a lot of noise and that noise has been "absorbed" by the non linear component of the model.

i would like to know if i can post the source code directly here...
there are some lines in it which produce the PDX value those lines could be used to produce a aimbot (a very stupid one but still... i dont want to take risks with the mods)

i saw a many intelligent posts in here, if someone steps in PM i would be gratefull i need a tester :)
PS.
if i dont make any sense please try to correct me, i'm new on this subjects :)
Thanks given by:
#13
I haven't studied this problem as much as you have (by a long shot) but it seems to me that you would be best off with always using a mouseacceleration of 0, and just finding the optimal sensitivity. It might just be a personal feeling, but I think that maccel just makes you less accurate as you are more likely to "overaim" when using it, especially with higher values.
Thanks given by:
#14
http://www.megaupload.com/?d=MHKUVOPU
EDIT... the link above is for the old version for the new version look on page 2


here's a link to the source code for any explanation ask here directly :)

very small README:

compile the external optimization algorithm first using this command
g++ -O3 sensopt.cpp -o sensopt

then copy physics.cpp in AC source src folder and overwrite (this is ver 1.1.0.4)
compile

RUN AC play one or two matchs

copy the mousedata.txt from the AC folder into the sensopt folder
and run ./sensopt < mousedata.txt

this procedure is for linux and possibly for mac

the sensopt output is similar to this
~/workspace/sensopt/Release$ ./sensopt < mousedata2.5.txt
2.67095337700015

with 2.67095337700015 being the estimated sensitivity
Thanks given by:
#15
Nice work, man!
I will check it as soon as I find time :P
Thanks given by:
#16
tl;dr, but sounds like a cool potential official feature!
Thanks given by:
#17
(21 Aug 11, 09:27AM)Ronald_Reagan Wrote: I'm interested in seeing how you do this, and trying for myself
yes
Thanks given by:
#18
Everything should work like that for mac, except you might need to do some hunting to find the txt file.

Finished my first game just now. And cannot find the txt file, doing some checks to see why.
May of actually used the wrong copy of AC :|
Edit: Found.
Thanks given by:
#19
Round 1:
Sens 6
Acc 54.1
0 12.0141
1 11.7735
11.2525

Coefficients Found: in the form a*x+b*y....+bias
4.31282142857142


Round 2:
Sens 4.31
Acc 54.9
0 9.49776
1 9.40082
9.20709

Coefficients Found: in the form a*x+b*y....+bias
5.1916806722689


Round 3: (w/o nades)

Sens 5.19
Acc 55.4
0 6.20236
1 5.99026
5.61178

Coefficients Found: in the form a*x+b*y....+bias
3.5002569373073

I will do some more shortly, and just update this post.

Also, I added a couple lines to your code.
if(d->state!=CS_ALIVE) continue;
        if(!player1->attacking) continue;
        if(player1->weaponsel->type == 8) continue; //This one is added
And to help debug a bit:
        std::ofstream a_file ( "mousedata.txt" ,std::ios::app);
        conoutf("writing to mousedata.txt"); //This one is added
        a_file << x << " " << player1->yaw << " " << dyaw << " " << sensitivity << std::endl;
        a_file.close();
Thanks given by:
#20
R_R download the new version from the link i posted it is far superior the algorithm is more stable now :)
your test showed what i found yesterday, the previous version is just jumping around your ideal sensitivity, with the latest you should consistent results
and yes it should only capture data from automatic weapons
Thanks given by:
#21
I'll start on that tomorrow.

Maybe some of this code could make a better accuracy formula? Meaning that it doesn't account for rifle sprinting in its equations.
Thanks given by:
#22
yes we could use the "Aimbot" part to make it detect whether there's an enemy close to the aimpoint or not :)
Thanks given by:
#23
and again huge improvement!!
inputs are the same
output now is only sensitivity since after extensive testing i saw that maccel was either 0 in good datasets or a useless huge value.

so before i was using the cumulate of the Squared differences as a estimator
now i'm using cumulate of the Absolute differences which is much more resistant to outliers

and the optimization algorithm now uses bisection which is now possible since i'm estimating only sensitivity (bisection is much faster than stocastic hillclimbing, and this simplified the source code a lot, now it is much simpler to integrate the whole thing into AC but first i wanna make sure i polish every aspect of it before making that)

now the convergence is completely accurate (atleast on the tests i was able to make)
sens 3.2 dataset -> 2.59
sens 2 dataset -> 2.31
sens 2.31 dataset -> 2.34

this last results are very promising since the algorithm settled on 2.33 and is not jumping around anymore

ah and for those interested in how my accuracy improved with the last changes i would say before the first algo version i had 34% now 54% on SMG

20% boost part of it is due to the fact that i played a few games to test the algo so my hand-eye coordination partially returned to it's original values but still even in my best moment i didnt reach 54% my max was around 47%

updated DL link in this post:
http://forum.cubers.net/thread-3814-post...l#pid66465

edit. fixed physics.cpp in the DL
Thanks given by:
#24
Wait so... this is for Mac and Linux only eh...? lol. :p
Thanks given by:
#25
nope if you are capable of compiling it it will work on windows too. download visual c++ express and compile it yourself :)

and there's nothing "lol" about it.
Thanks given by:
#26
(22 Aug 11, 11:25AM)Fate Wrote: Wait so... this is for Mac and Linux only eh...? lol. :p
About time eh.
Thanks given by:
#27
the code is cross-platform if you are interested compile it!
i'm not going to offer binaries for any platform for this version.

i will for the integrated version.
EDIT.
i'm working on the integrated version
Thanks given by:
#28
i checked code of AC ...
sqrt(dx*dx + dy*dy) * dx * 1/t * a/v * c = dphi

phi = yaw or pitch
a = mouseaccel
v = sensitivity
c = constants

sqrt(dx*dx + dy*dy) * 1/t - the length of vector in time unit
dx - move in x direction
dy - move in y direction
a ~ influence dx or dy
v ~ influence time unit ~ since vector unit

correct me if i am wrong ..
Thanks given by:
#29
you got it almost right :) (unless i made some mistakes in reading your reworking of the formula's)

yaw(t) := yaw(t-1) + dx/k2*(k1*sqrt(dx*dx+dy*dy)*a / deltaT +v)

deltaT = time passed between t and t-1
a = mouseaccel
v = sensitivity
k1 & k2 constants
k2=33
k1=0.002

but i dont see the point of this last post of yours?!?

i believe i once asked in this thread how would you solve this problem:
estimating best performance sensitivity from data captured inside the game
Thanks given by:
#30
Beautiful!
I'm sorry I wasn't around to ease the mathematical burden earlier...

I was busy babysitting drunk people
Thanks given by: