Hello. I have a few thoughts / ideas / questions concerning the planned Python interface.
* we don't want scripts to mess the server. Therefore, we need to check parameters the script will send to "core", and such (like: move_unit(7) when you can do only 0-5, 6 tiles). Question becomes, do we want a Python-specific API, or a layer between server "core" and Python interface? So: Python -> C++ / Python binding function -> core or Python -> C++ / Python binding function -> checking function -> core First is more straightforward. Second lets create more interfaces with other languages (LUA? Perl? PHP? You name it :p) without redoing the checks, may enable library plugins (ie checked at runtime). We can of course do 1) first, then move to 2) later on when we want other languages. * in the same idea, maybe we want a script to run while player is thinking, but we don't want a script to run infinitely or for too long (to not make the reaction time slow). So there must be a way to timeout. So we got a few ways: 1) separate thread. We then run in the multithread issues, like locks & such. 2) have a function called when player is idle and return after a really short time, "on idle". Still must be able to force the function to exit after some time, though, and "thinking" function must be designed to run by small increments. 3) maybe make the binding functions check elapsed time, and force return after a short time to handle player input. 4) have the script run only when it's the player's turn, would make things easier but maybe less challenging? Easiest is of course 4) from the implementation POV. * script will probably need a way to persist values between runs if called only at each turn, to maintain some state. Also all initial values must be stored in order for replay to work (think random seed for the Python random function). Nicolas
