ironpython support
curly-brace opened this issue · 5 comments
i've tried using IronPython, but seems like engine fails to execute the class.
so i've added a script to a node with class name 'Test'.
then i've created a python file with same class inside
i've also referenced the api assembly too
then i've compiled that file into dll assembly
i assumed that engine will pick the right code by class name in assembly, but nothing happens when i run the game.. i've even created a c# solution (because you've wrote that engine searches for it).
in terminal there is written that api assembly and my project's assembly, have no entry point. that's the same output as in working c# test project, so i think that engine loads my assembly, but gets no code executed from it.
what can i do to make IronPython work with godot?
If you can upload a example project I can check what's wrong.
In the future I plan to support other languages supported by mono or to make it easier to add support to them. The only issue is the following, suppose someone add Python scripting to Godot, how would be know if a ".py" file is for IronPython or Python. Same goes for Java which is also supported by mono.
yeah, sure. here it is
https://www.dropbox.com/s/eu6tesobxli3g6m/test_ipy.zip?dl=0
but i've already got the cause. it is caused by the fact that dll is formed in DLRCachedCode style (don't know how it is called, because i'm far from .net tech). but i'm going to try and find the way to compile the dll so the classes are exposed on top level
my conclusion is that it is impossible to support ironpython in this way, because ironpython compiles dlls as DLR library (dynamic language runtime) instead of CLR (where classes are top IL level) and seems like those DLRCachedCode dictionaries are only usable in 'import' statements in ironpython itself.
but i've heard that ironpython was used together with unity. but i'm unsure whether it was used instead of c# or just as runtime scripting engine for complex games.
so i'm unsure whether it is possible to use ironpython dlls with godot. may be it is, but requires fully rewriting importing code for game assembly. but i don't know in what way it needs to be rewritten, because i'm not very educated in terms of .net
there is also PythonNet project, which is a Python engine ontop of CLR, which allows to execute Python scripts just like an interpreter. May be you could add support for it at least?
Given this issue is about Godot and Python, I feel pertinent to notify that I'm working on providing Python as scripting language for Godot (see https://github.com/touilleMan/godot-python) ;-)
It is not yet usable, but I'm planning for a first demo version for February.
but i've heard that ironpython was used together with unity. but i'm unsure whether it was used instead of c# or just as runtime scripting engine for complex games.
Aren't you mixing with Boo (the pythonic language running on the CLR) which was among the supported scripting languages for unity (but eventually deprecated though) ?
@touilleMan I already noticed your work a few weeks ago, that's why I saw issues supporting .py
files (AFAIK one of the languages would override the other for these files).
Any ways, it's not possible to support IronPython. I've been reading a few articles (including this one) and it seems to have it's own engine, which means it's not possible to use reflection on it directly with the mono API.