1 |
In [url=http://zero-k.info/Forum/Thread/7478]this thread[/url] it has been revealed by @Skasi (actually already 2011) and proven by mostly @TheEloIsALie that current overdrive energy distribution is not ideal. Currently OD energy is distributed proportional to squared mex rates as far as the grid allows it. Connecting mexes can reduce total metal rate, which should actually be avoided by the system in any case.
|
1 |
In [url=http://zero-k.info/Forum/Thread/7478]this thread[/url] it has been revealed by @Skasi (actually already 2011) and proven by mostly @TheEloIsALie that current overdrive energy distribution is not ideal. Currently OD energy is distributed proportional to squared mex rates as far as the grid allows it. Connecting mexes can reduce total metal rate, which should actually be avoided by the system in any case.
|
2 |
\n
|
2 |
\n
|
3 |
[color=green][b]1. Ideal Solution[/b][/color]
|
3 |
[color=green][b]1. Ideal Solution[/b][/color]
|
4 |
\n
|
4 |
\n
|
5 |
@TheEloIsALie calculated the ideal distribution of OD energies (e_1,...,e_n) in a grid with n mexes with base rates (m_1,...,m_n) and OD energy E. (I use the same variables as @TheEloIsALie and add some more.) Total mex rates are M_i=gamma(e_i)*m_i with the "Lorentz-factor" gamma(e_i)=sqrt(1+e_i/4).
|
5 |
@TheEloIsALie calculated the ideal distribution of OD energies (e_1,...,e_n) in a grid with n mexes with base rates (m_1,...,m_n) and OD energy E. (I use the same variables as @TheEloIsALie and add some more.) Total mex rates are M_i=gamma(e_i)*m_i with the "Lorentz-factor" gamma(e_i)=sqrt(1+e_i/4).
|
6 |
Current distribution is e_i=E*m_i²/p, where p=sum_i(m_i²). If the grid doesn't provide as much energy as it "wants", it gets its maximum and the rest has to be recalculated.
|
6 |
Current distribution is e_i=E*m_i²/p, where p=sum_i(m_i²). If the grid doesn't provide as much energy as it "wants", it gets its maximum and the rest has to be recalculated.
|
7 |
The
easiest
representation
of
@TheEloIsALie's
ideal
solution
is
e_i
=
m_i²*q/p
-
4,
where
q
=
E
+
4n.
I
have
proven
that
it
is
correct,
so
if
you
want
to
see
a
proof.
.
The
problem
is
now
that
it
can
produce
negative
e_i.
Those
e_i
have
to
be
set
to
0
and
the
rest
must
be
recalculated.
Thanks
to
@TheEloIsALie
the
recalculation
is
not
needed,
when
"you
go
through
the
mexes
in
ascending
order
of
base
income
and
(
.
.
.
)
(
i)
f
that
e_i
is
negative,
you
subtract
m_i²
from
p
and
4
from
q
and
continue.
"
If
a
mex'
e_i
is
not
negative,
you
can
be
sure
that
all
following
mexes'
e_i
are
not
negative,
too.
The
current
recalculation
when
grid
is
maxed
is
also
needed.
Former
concerns
about
the
algorithmic
efficiency
of
the
ideal
solution
because
of
many
square
roots
or
recalculations
have
been
eliminated.
|
7 |
The
easiest
representation
of
@TheEloIsALie's
ideal
solution
is
e_i
=
m_i²*q/p
-
4,
where
q
=
E
+
4n.
I
have
proven
that
it
is
correct,
so
if
you
want
to
[url=http://zero-k.
info/Forum/Thread/7478#114117]see
a
proof.
.
[/url]
The
problem
is
now
that
it
can
produce
negative
e_i.
Those
e_i
have
to
be
set
to
0
and
the
rest
must
be
recalculated.
Thanks
to
@TheEloIsALie
the
recalculation
is
not
needed,
when
"you
go
through
the
mexes
in
ascending
order
of
base
income
and
(
.
.
.
)
(
i)
f
that
e_i
is
negative,
you
subtract
m_i²
from
p
and
4
from
q
and
continue.
"
If
a
mex'
e_i
is
not
negative,
you
can
be
sure
that
all
following
mexes'
e_i
are
not
negative,
too.
The
current
recalculation
when
grid
is
maxed
is
also
needed.
Former
concerns
about
the
algorithmic
efficiency
of
the
ideal
solution
because
of
many
square
roots
or
recalculations
have
been
eliminated.
|
8 |
\n
|
8 |
\n
|
9 |
I had a look at [url=https://github.com/ZeroK-RTS/Zero-K/blob/master/LuaRules/Gadgets/unit_mex_overdrive.lua#L689]the source code[/url] and it seems as if overdrive does obey emp and disarm, but not slow dmg. Something like "orgMetal*=spGetUnitRulesParam(unitID,"slowRate")" or else should be written there in line 725 and 755 and maybe others. How can allyTeamMexes be sorted by orgMetal after emp, disarm and slow have been applied and then used in another for-structure? Then you only need to replace current "mexE = allyE*(orgMetal * orgMetal)/ allyMetalSquared" by the ideal solution and check if you have to change p and q. Maybe you can save a little if you first check if orgMetal of current mex = orgMetal of previous mex, because this will often be true. Then you can just use e_i of previous mex and if it's 0, change p and q.
|
9 |
I had a look at [url=https://github.com/ZeroK-RTS/Zero-K/blob/master/LuaRules/Gadgets/unit_mex_overdrive.lua#L689]the source code[/url] and it seems as if overdrive does obey emp and disarm, but not slow dmg. Something like "orgMetal*=spGetUnitRulesParam(unitID,"slowRate")" or else should be written there in line 725 and 755 and maybe others. How can allyTeamMexes be sorted by orgMetal after emp, disarm and slow have been applied and then used in another for-structure? Then you only need to replace current "mexE = allyE*(orgMetal * orgMetal)/ allyMetalSquared" by the ideal solution and check if you have to change p and q. Maybe you can save a little if you first check if orgMetal of current mex = orgMetal of previous mex, because this will often be true. Then you can just use e_i of previous mex and if it's 0, change p and q.
|
10 |
(Btw why is there "1+mexE/5" instead of "energyToExtraM(mexE)" in lines 761 and 795?)
|
10 |
(Btw why is there "1+mexE/5" instead of "energyToExtraM(mexE)" in lines 761 and 795?)
|
11 |
\n
|
11 |
\n
|
12 |
[color=green][b]2. Underdrive[/b][/color]
|
12 |
[color=green][b]2. Underdrive[/b][/color]
|
13 |
\n
|
13 |
\n
|
14 |
When I thought about how to reduce recalculations and sortings due to negative OD energies e_i in @TheEloIsALie's solution, a really crazy idea came to my mind: Why not leave negative e_i as it is? Call it underdrive. This would only require replacing
|
14 |
When I thought about how to reduce recalculations and sortings due to negative OD energies e_i in @TheEloIsALie's solution, a really crazy idea came to my mind: Why not leave negative e_i as it is? Call it underdrive. This would only require replacing
|
15 |
"mexE = allyE*(orgMetal * orgMetal)/ allyMetalSquared" by
|
15 |
"mexE = allyE*(orgMetal * orgMetal)/ allyMetalSquared" by
|
16 |
"mexE = (allyE+4*allyTeamMexes.number())*(orgMetal * orgMetal)/ allyMetalSquared - 4" (not sure about .number())
|
16 |
"mexE = (allyE+4*allyTeamMexes.number())*(orgMetal * orgMetal)/ allyMetalSquared - 4" (not sure about .number())
|
17 |
In most cases it would make no difference. Only when small and big mexes are connected in a grid with low energy, small mexes would be underdriven to provide a little OD energy for the big mexes. The theoretical maximum for the underdrive energy a mex can provide is 4, but usually it will be lower. This could give pylons a little more use, but building generators instead will still be better.
|
17 |
In most cases it would make no difference. Only when small and big mexes are connected in a grid with low energy, small mexes would be underdriven to provide a little OD energy for the big mexes. The theoretical maximum for the underdrive energy a mex can provide is 4, but usually it will be lower. This could give pylons a little more use, but building generators instead will still be better.
|
18 |
\n
|
18 |
\n
|
19 |
[color=green][b]3. Symmetrization[/b][/color]
|
19 |
[color=green][b]3. Symmetrization[/b][/color]
|
20 |
\n
|
20 |
\n
|
21 |
Negative e_i is only possible, because negativity of e_i is not equivalent to negativity of the OD Lorentz-factor's radicand gamma(e_i)=sqrt(1+e_i/4). This can be changed with a symmetrization of the OD function gamma_b(e_i):=1+b*sqrt(e_i), where b is a constant factor that determines the effectivity of OD, for example b=0.3. I found the ideal solution for this and it is exactly the currently implemented solution independently of b! So you would only have to change
|
21 |
Negative e_i is only possible, because negativity of e_i is not equivalent to negativity of the OD Lorentz-factor's radicand gamma(e_i)=sqrt(1+e_i/4). This can be changed with a symmetrization of the OD function gamma_b(e_i):=1+b*sqrt(e_i), where b is a constant factor that determines the effectivity of OD, for example b=0.3. I found the ideal solution for this and it is exactly the currently implemented solution independently of b! So you would only have to change
|
22 |
"return -1+sqrt(1+(energy*0.25))" in line 256 to
|
22 |
"return -1+sqrt(1+(energy*0.25))" in line 256 to
|
23 |
"return b*sqrt(energy)" with a certain b.
|
23 |
"return b*sqrt(energy)" with a certain b.
|
24 |
This would also solve the problem of extreme OD being too effective atm as it would make low OD more effective and high OD less effective than currently without introducing more complex functions than sqrt (like log). b could also be changed at any time for balance reasons. The break even point of energy, where current OD becomes equally efficient as symmetric OD for a single mex, is at e_i= 4b²/(b²-1/4)² or b=(sqrt(1+e_i/4)-1)/sqrt(e_i).
|
24 |
This would also solve the problem of extreme OD being too effective atm as it would make low OD more effective and high OD less effective than currently without introducing more complex functions than sqrt (like log). b could also be changed at any time for balance reasons. The break even point of energy, where current OD becomes equally efficient as symmetric OD for a single mex, is at e_i= 4b²/(b²-1/4)² or b=(sqrt(1+e_i/4)-1)/sqrt(e_i).
|
25 |
\n
|
25 |
\n
|
26 |
[color=green][b]4. Quantum Mechanics[/b][/color]
|
26 |
[color=green][b]4. Quantum Mechanics[/b][/color]
|
27 |
\n
|
27 |
\n
|
28 |
The whole calculation and especially how adding an assymetry term to the energy (which means the existence of mass in a relativistic sense) creates antimatter (underdrive) reminds me a lot of relativistic quantum mechanics. In the early times of quantum mechanics people also struggled a lot for eliminating the negative energy (underdrive) until they finally had to accept that antimatter exists. The symmetrization is the non-relativistic approximation. It is interesting that the current solution solves the "non-relativistic" approx.
|
28 |
The whole calculation and especially how adding an assymetry term to the energy (which means the existence of mass in a relativistic sense) creates antimatter (underdrive) reminds me a lot of relativistic quantum mechanics. In the early times of quantum mechanics people also struggled a lot for eliminating the negative energy (underdrive) until they finally had to accept that antimatter exists. The symmetrization is the non-relativistic approximation. It is interesting that the current solution solves the "non-relativistic" approx.
|
29 |
\n
|
29 |
\n
|
30 |
So which of the 3 systems do you prefer? The lower a system's number, the less elegant and more difficult to implement (if not too much) it is, but closer to the current system.
|
30 |
So which of the 3 systems do you prefer? The lower a system's number, the less elegant and more difficult to implement (if not too much) it is, but closer to the current system.
|