Comment 3 for bug 858517

Revision history for this message
SirVer (sirver) wrote :

> I have to say that I find the code a bit untidy, but that may be because I'm new to Lua. For example, most calculations are done once for individual players, and once for teams - not quite concise. But that's more a matter of style.
it is - please feel free to clean it up - maybe you can come up with an iterator like approach that can make the distinction between team and player go away. Patches are very, very welcome.

> *The code assumes a constant land mass. Don't know if that could be a problem outside of the Atlantean campaign.
Only the atlantean campaign changes the land mass for now - i think it is safe to assume this inside a regular game.

> *In a corner case, it's -probably- possible to fall below the 50% threshold and exceed it again in one sample period. Gotta be fast though.
Then the win condition is slightly incorrect - seems not to matter to me that match. It would not be game breaking, would it?

> *Like in Autocrat, if you've (almost) won, the game can take some time before it sends you that message.
Could you elaborate what you mean here - I do not get it.

> These problems could be solved by using hooks. Would that be worth it?
Yes - hooks would be the correct approach but require coding and documenting them. If you would want to work on this it would be awesome. I can help you out with information wherever needed.

> Last question: is the amount of conquered land indicated in the graph the same as that calculated in this script? If not this may lead to frustrated player strategies...
I am not sure what you mean - the leftmost statistics button (land conquered) is calculated in c++, but the one this script uses is calculated in Lua. So even when they started out to be the same, they might have diverged. Of course using the one from inside the c++ code would be better - but it is also more coding work to be done. Again, feel free to fix this :)

> Oh yes, another question: is it possible to debug the win condition in Lua? I can't seem to reach the appropriate variables in the console.
yes, there is only one lua namespace in which everything is running - so you should be able to access anything that is not created with the local keyword in Lua. Note that when you use print() in the console, the output will go to the terminal and not appear in the console. So maybe this is the problem?