Hmmm,
What about using a far easier Interface... a potential Python one?
Some time ago I talked to hoijui about building a Python Interface. Took me some time to understand what should be done to get the thought down to reality. Well my first approach was Interfacing with Cython. Turned out to be quite a hassle at the point of externalizing the AICallback instance.
Yesterday I started the same idea, but this time with a different and much friendlier approach... Boost.Python (libboost-python). Since the Engine already makes use of the libboost libs, I figure its easier to get requirements (at first optional) of an additional boostlib upstream.
====================================================
Now the entire idea has a few pros and contras:
Pros:
1) Python is a extremely powerful language. The coderatio C/C++:Python is about 10:1 to achieve the same goal. And its just sweet/powerful.
2) In case of performance bottlenecks you can always extend Python with C++ libs (libboost-python) or even direct C code (Cython). It is done very fast and easily. If you do it cleverly you might even only use Python as Algorithm prototyping and glue for different objects without having the type handling/converting overhead bashing at your performance.
3) You will be running 1 Interpreter to get the Interface and subsequent SkirmishAI running... through spawning of further Interpreters (multiprocessing lib as of py2.6) you have a easy multi-core support up and running. Even useful in case you want to use the SpringRTS Engine for AI research purposes, just plug your private renderfarm behind it
4) I intend to bring in also some source code from EVE online (Yep, written in Stackless Python), which makes possible to develop your AI on the fly. It works with a testing cycle (syntax and other errors), and on passing the test, plugging in of the freshly edited module. Spring in windowed mode, and you see the changes realtime.
5) No compile times... the worst of all drawbacks on developing something that relies heavily on prototyping like AIs
6) A little more Shugar: take a look at the self enabling approach of "Metaprogramming" (note the quotes) in Python... its just beyond of cool. You don't use Python, you feel Python... I've become a fan of this language since I came into contact with it mere 4 months ago.
Contras:
1) Additional Language in an already 3 Language Environment. We already have C/C++, then comes Lua as scripting language and there is also Java involved in the JavaAI Interface. It is a good thing to support everything, but it also makes things one step messier and more heterogeneous.
2) Performance of pure Python is not known as the best out there, don't worry, its quite performant though (Im currently using it mainstream at a research project revolving around 3d voxel clouds of laser scanners... lots of 3D data). For someone who uses Python as a tool of prototyping or similar purposes, being a capable C/C++ developer, this is THE honeypot (without the trap behind). As of Python3k with the upstream coming UnladenSwallow from Google, it should get serious performance improvements (the most important of improvements is the newly implemented JiT capability). Furthermore there is PyPy coming within the next 3-8 Years, which is a serious hack... want to see it in action, should be closely as fast as C by then. Not really sure if performance is something to be mentioned here at the Contras... but well for sake of completeness.
3) Someone might be asking himself... well we already have a Java Interface and the JVM is known to support Jython... why the pure Python. To be honest, I don't know, what I know is that the wont fully support the PSL (Python Standard Library) before Py3k, and that could take another year or two. And the other aspect that in my opinion has always killed Java for me is the JVM... it behaves like garbage. As a linuxler I know one thing for sure... if you have a PC or Server, the last thing you want on it is anything that needs the JRE, mainly because of the JRE and not of the package. Same with Mono from MS. If one of mentioned VM's would close just ONCE cleanly... it would be great. Big difference is the PVM, at least I haven't experienced a problem even once.
====================================================
This post has 3 objectives:
1) Want to hear about the "Go to Hell's" or "Cool's" from side of the Engine devs, and the potential AI devs out there.
2) Want to know if I'm not running into already occupied territory.
3) Suggestions and Ideas, Wishes and the like (Actually the most important of the 3)
I'm going to do this either way, mainly because I want to play around with AI's myself. Clearly the better if this gets upstream.
Would the Developers think this could get a ticket upstream... ^^!?
If anyone wants to contribute, please say so.
---------
~WeberGunso
~WeberShogun