Well, after some maths and discussion with Skasi, I came to the conclusion that
the current OD gadget is actually wrong the way it works.Why?
In the example Skasi showed in the bugtracker, the ideal solution would be to give
no energy to the smaller mex!
I recreated a similar situation (most likely not exactly the same energy, but it matters little). First mex has 3.67 metal, smaller mex has 1.43 metal. The amount of energy the OD gadget spends on OD (which depends on the amount of E you have stored) in this particular example is 1.84 energy, both mexes sit on separate grids that have sufficient max energy.
The amount of OD is proportional to (sqrt(1 + e/4) - 1), the -1 is there because I subtract the base amount. Check this:
maximize 3.67 (sqrt(1 + a/4) - 1) + 1.43 (sqrt(1 + b/4) - 1) with a+b = 1.84If the formula held true for negative energy investment, it would be best to get energy out of the smaller mex and let it produce even less metal! Now, this obviously isn't allowed but with that boundary, the maximum is clearly found for b=0 and a = 1.84...
Only if the energy invested here becomes bigger than somewhere above 23 will it actually be beneficial to invest any energy into overdriving the small mex!
That sounds like a clear contradiction to how the OD gadged works at the moment.
Skasi then pointed out that "if you divide bonus metal from OD by energy invested, it will become infinite for 0 energy invested". That sounds logical, but maths has something to say about this:
plot 10 (sqrt(1 + x / 4) - 1) / x, 10 (sqrt(1 + x/4) - 1), 1 / xI plotted the "od metal", "per cost" and "od metal per cost" functions here. You can see that, as the energy approaches 0, the amount of metal also approaches zero, and you can't put a value on 0/0, so you have to use limits:
limes x -> 0 (a (sqrt(1 +x/4) - 1) / x)It turns out that, if you invest close to 0 energy, you get a maximum of 12.5% of the base metal per point of energy invested. But 12.5% of a small base value per point of energy can be (a lot) less than a lower percentage of a big base value, which is why not investing into the smaller mexes at all can make sense.
This is the "OD per point of energy" (as fraction of the base metal income of the mex):
You can see it starts at 12.5% (1/8) and then becomes less and less the more energy you invest.
How big of a problem is this for more realistical/important energy investments?Well, as you invest more and more energy into your mexes, the algorithm of the OD widget becomes "more right", that is, the energy distribution for (theoretical) maximum OD metal gets closer and closer to the one the game uses. However, let's take the example of 100 energy for the 2 mexes (that's a lot I'd say, if you hold 20 mexes that would be 1000
unused energy income):
Theoretical maximum: 15.37 OD metal.
If I recall the current algorithm correctly, it will distribute energy proportional to the square of the base income. This would result in
15.35 metal. To be honest, that's less difference than I'd have expected...
Another example: 10 energy for the 2 mexes:
Optimum: 3.255 metal from OD
Current: 3.083 metal from OD
1 energy for the 2 mexes (yeah, that's really not a lot):
Optimum: 0.808 m
Current: 0.402 m
Well, that's 1 more bandit of the span of 3.3 minutes. Doesn't sound like much but this
can actually make a difference.
Although the effect is kind of marginal overall, i have to say, since it only ever occurs with bigger mexes in the first place (and most maps having only equal mexes).
I'll look into bigger amounts of smaller mexes in a moment. Or tomorrow.
Now the challenging part will be devising an algorithm that can actually work out how to properly distribute the energy to all grids for maximum OD. Well, food for thought, I'll give it a shot. Although it's likely not very high-priority.