AIInterface:Python: Difference between revisions

From Spring
Jump to navigationJump to search
Abma (talk | contribs)
Flozi (talk | contribs)
m Category:AIInterface
 
(22 intermediate revisions by one other user not shown)
Line 1: Line 1:
Important note: in current spring/master it is currently disabled because of an recently big merge (pureint), it will be fixed soon!
== Spring PyAI ==
== Spring PyAI ==
The Spring PyAI Interface can be used to write skirmish AIs in Python.  
The Spring PyAI Interface can be used to write a skirmish AI in Python.
Look at the [[AI:Development:Lang:Python|Development Page of Python]] if you want write an AI.


=== Code ===
=== Code ===
Line 7: Line 10:
=== Building ===
=== Building ===


From the [http://github.com/spring/Python/blob/master/README.markdown README]:
The Python Interface is in spring/master, just git clone it, run "git submodule init" and you can compile/install it!
 
Howto setup
 
1. Get the clean spring sourcecode:
  git clone git://github.com/spring/spring.git spring cd spring
 
2. Get the Python AI Interface code into the right folder
  git clone git://github.com/spring/Python.git AI/Interfaces/Python
 
That's it. When Python is detected, the AI Interface will be compiled with spring:
  cmake .
  make
 
== Quick Setup Windows ==
download + install:
  http://buildbot.eat-peet.net/spring/installer/spring_0.81.0-888-g4813344.exe
download + extract to install-folder
  http://abma.de/builds/pyai-current.zip
download + install python:
  http://www.python.org/ftp/python/2.5.4/python-2.5.4.msi
Download a mod + map.
 
It doesn't work with the currently stable spring release.
Would be nice if someone could pick the source and compile it and test it.
 
If you want test it, [b]you need spring from the current git master[/b]!
What is currently untested:
 
*compile with windows (mingw / visual studio + co)


==Known Issuses/TODO==
==Known Issuses/TODO==
*there is currently no type-checking, if you send wrong data through the interface to the engine, bad things happen! (crash/hang/...)
*rewrite for pureint
*make thread-safe http://docs.python.org/release/1.5.2/api/threads.html
*ai's cant force a specific python version, add an setting into aiinfo.lua
*only one specific python version can be used, loading different ais using different python versions is currently impossible
*the init event can be replaced by a function / add release function
*there are no docs, look into interface.py if you search a function
*there are no docs, look into interface.py if you search a function
*the interface is linked with python, so you have to use the same version of python as it was when compiled, on windows python2.5 has to be installed, it is also needed to install the .py libs.
*logging could be improved
*try to load the python lib and bind dynamic to allow different python versions


As a note: most of the Interface is generated by a python script.
As a note: most of the Interface is generated by a python script.
For windows there is a (cross-compiled) package here:
http://abma.de/builds/pyai-current.zip


=== Status ===
=== Status ===
Most functions and Datatypes should work. However, there is no typechecking at this point and the interface may crash if you use a wrong type. All classes and functions are generated and because of this, there is no further documentation available.
Most functions and Datatypes should work. All classes and functions are generated and because of this, there is no further documentation available.


There is also a branch with the interface included avaiable:
At github you find the main repository for the Interface:
http://github.com/spring/spring/tree/pyAiInt
http://github.com/spring/Python


Check the NullPythonAI for something to start with.
Check the NullPythonAI for something to start with.
[[Category:AIInterface]]

Latest revision as of 18:43, 8 March 2013

Important note: in current spring/master it is currently disabled because of an recently big merge (pureint), it will be fixed soon!

Spring PyAI

The Spring PyAI Interface can be used to write a skirmish AI in Python. Look at the Development Page of Python if you want write an AI.

Code

http://github.com/spring/Python

Building

The Python Interface is in spring/master, just git clone it, run "git submodule init" and you can compile/install it!

Known Issuses/TODO

  • rewrite for pureint
  • make thread-safe http://docs.python.org/release/1.5.2/api/threads.html
  • ai's cant force a specific python version, add an setting into aiinfo.lua
  • only one specific python version can be used, loading different ais using different python versions is currently impossible
  • the init event can be replaced by a function / add release function
  • there are no docs, look into interface.py if you search a function
  • logging could be improved

As a note: most of the Interface is generated by a python script.

Status

Most functions and Datatypes should work. All classes and functions are generated and because of this, there is no further documentation available.

At github you find the main repository for the Interface: http://github.com/spring/Python

Check the NullPythonAI for something to start with.