Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant archive_postsperpage - assumed 'archive_postsperpage' (this will throw an Error in a future version of PHP) in ..../archive/index.php on line 456
[Discussion] Speed Scaling [Archive] - Forums

PDA

View Full Version : [Discussion] Speed Scaling



DarkstaR
11-22-2012, 12:11 AM
So, some chatter in the shatxbix got me thinking about the current system which increases speed in a linear fashion as you level up. While this system was nice when the average level wasn't over 80 and top levels were below 200, it is outdated and leaves lower levels (even level 100's) at a huge disadvantage.

Let's discuss ways this can hypothetically be modified to better suit the increasing average level of the game.

My idea is below:

old (actually, current) formula = 220 + (2 * (level-1))
new (actually, proposed) formula = 220 + (1.4 * (level-1)) + (1000 - level) / 15

Level 1: {new: 286, old:220}
Level 25: {new: 318, old:268}
Level 50: {new: 351, old:318}
Level 75: {new: 385, old:368}
Level 100: {new: 418, old:418}
Level 125: {new: 451, old:468}
Level 150: {new: 485, old:518}
Level 175: {new: 518, old:568}
Level 200: {new: 551, old:618}
Level 250: {new: 618, old:718}
Level 300: {new: 685, old:818}
Level 350: {new: 751, old:918}
Level 400: {new: 818, old:1018}
Level 450: {new: 885, old:1118}
Level 500: {new: 951, old:1218}
Level 550: {new: 1018, old:1318}
Level 600: {new: 1085, old:1418}


From this, we can draw a few conclusions:
1. With the proposed system, a level 1 is definitely faster, now about the speed of a current level 30.
2. With the proposed system, a level 50 is noticeably faster, but only about the speed of a current level 60.
3. With the proposed system, a level 100 is exactly the same speed.
4. With the proposed system, a level 175 is the speed of a current level 150.
5. With the proposed system, a level 250 is the speed of a current level 200.
6. With the proposed system, a level 400 is the speed of a current level 300.
7. With the proposed system, a level 550 is the speed of a current level 400.

Farsa
11-22-2012, 06:24 AM
There isn't enough data so far, but, anyway, I looked into the information given by the update teaser and fitted these points(level/speed):


proposedPoints = [1, 220;
30, 1.25*currentFormula(30);
100, 1.13*currentFormula(100);
175, currentFormula(175);
200, 0.96*currentFormula(200);
300, 0.83*currentFormula(300)];


to this function:


speed(level)=a*log(b*level+c)/log(d)+e*level+f

using genetic algorithm optimization on MATLAB. These are the values I got for the coefficients [a..f]:


8.4011 0.9807 10.2916 1.1007 0.5820 7.3080

with a summed squared error of


44.1228

which is pretty decent considering the number of points used.

Comparison plot:
http://i.imgur.com/AKq74.png

Curious random fact about this error value:


mean squared error = 44.1228/6=7.3538
sqrt(7.3538)=2.7118
2.7118 is pretty close to e


MATLAB code:

speed_scaling.m


close all;
clear;

uptolevel=2000;
n_opt_attempts=50;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

level=1:uptolevel;
currentFormula=220+(2*(level-1));
darkstarFormula=220 + (1.4 * (level-1)) + (1000 - level) / 15;
proposedPoints = [1, 220;
30, 1.25*currentFormula(30);
100, 1.13*currentFormula(100);
175, currentFormula(175);
200, 0.96*currentFormula(200);
300, 0.83*currentFormula(300)];
ppX=proposedPoints(:,1);
ppY=proposedPoints(:,2);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

options=gaoptimset();
options.CrossoverFraction=0.8;
options.Display='iter';
options.FitnessLimit=0;
options.Generations=1000;
options.PopInitRange=[0;10];
options.PopulationSize=1000;
options.UseParallel='always';
options.Vectorized='on';
options.TolFun=10^-15;


X=zeros(n_opt_attempts,6);
FVAL=zeros(n_opt_attempts,1);

matlabpool(4);
parfor attempts=1:n_opt_attempts
display(['==============ATTEMPT N#' num2str(attempts) '==============']);
[X(attempts,:),FVAL(attempts)]=ga(@(x)obj_fun(x,proposedPoints,uptolevel),6,[],[],[],[],[],[],[],options);
end
matlabpool close;

best=find(FVAL==min(FVAL));best=best(1);
x=X(best,:);
fval=FVAL(best);
fitPoints=x(1)*log(x(2)*level+x(3))/log(x(4))+x(5)*level+x(6);

fprintf('SQE result: %f\n',fval);
display('Optimization results:');
display(x);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

hold on;
grid on;
plot(level,currentFormula,'r');
plot(level,darkstarFormula,'b');
plot(ppX,ppY,'ok');
plot(level,fitPoints,'g');

set(gca,'XTick',linspace(0,uptolevel,20));
legend('Location','NorthWest','Current','DarkstaR' ,'ProposedPts','FitPts');
ylabel('speed');
xlabel('level');


obj_fun.m


function sqe = obj_fun( x , proposedPoints,uptolevel)
sqe=zeros(size(x,1),1);
for ii=1:size(proposedPoints,1)
sqe=sqe+(mathFun(x,proposedPoints(ii,1))-proposedPoints(ii,2)).^2;
end
notinf=sqe~=Inf;


speeds=zeros(size(x,1),uptolevel);
for ii=1:uptolevel
speeds(notinf,ii)=mathFun(x(notinf,:),ii);
end

crescent=rowscrescent(speeds);
reals=rowsreal(speeds);

sqe(~(crescent & reals & notinf))=Inf;

end

function speed=mathFun(x,level)
%speed=a*log(b*level+c)/log(d)+e*level+f
speed=x(:,1).*log(abs(x(:,2)*level+x(:,3)))./log(abs(x(:,4)))+x(:,5)*level+x(:,6);
speed(speed~=real(speed))=Inf;
end

function r=rowscrescent(m)
r= all(m(:,1:end-1)<m(:,2:end),2);
end
function r=rowsreal(m)
r= all(m==real(m),2);
end

Sketchy
11-22-2012, 08:06 AM
Instead of changing the speed point formula you could alternatively change the formula used to calculate the walking step delay. Based on the current test server CIP appears to be making their step delay formula follow a logarithmic pattern, they are also keeping the speed point formula linear with half the value & rate of the current formula (ie: 110 + level - 1).

Blequi
11-22-2012, 11:16 AM
I think the current formula is good and doesn't need changes, but if they want some formula to do low level speed closer to high level speed, just setup a formula with a increasing injective function with concavity to down. Ex:

speed(level) = 220 + sqrt(level)
speed(level) = 220 + ln(level) (with base e)

I guess these two formulas are underneath the current formula. If possible, Farsa plot it please.

Maybe those formulas need math.floor or math.ceil if cipsoft doesn't want floating points.

@offtopic: Farsa, are you engineer? If no, where do you use MATLAB? I like programming in MATLAB, I never made some program on it, but its syntax looks like Lua.

Farsa
11-22-2012, 05:59 PM
Those are pretty lower speed values indeed, way too low in comparison with what Tibia has nowadays:
http://i.imgur.com/k8Bfw.png

@offtopic
*Almost* engineer lol, need to finish final project someday. I used MATLAB for research("iniciação científica") and my final project too, both in the field of machine learning.