pyirrlicht - python ctypes binding

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
_maxim_
Posts: 54
Joined: Thu May 27, 2010 11:05 am
Location: Russia
Contact:

Post by _maxim_ »

I have already received such criticism a month ago here http://sourceforge.net/projects/pir/for ... ic/4526104 and I repeat my answer here: I totally agree with her. The only question is who can do the job quickly? I do not have enough time now to do so, perhaps in future something will change.

Regarding C++ parser: it always exists in the project, h2ctypes.py (C++ -> py helper generator), h2bi.py (FreeBASIC wraper generator).

Regarding the PyPy: the results of my tests
Collision.py and ctypes version pyirrlicht
Intel Pentium Dual-Core CPU T4300 2.1GHz (without SSE2, if I understand correctly)
Windows 7 64-bit

pypy-1.5.0a0-win32: FPS 55-125; memory usage ~70mb
Python 2.6.6: FPS 145-175; memory usage ~20mb

Not compatibility with official ctypes module, not understand ctypes constructions and always give me this message "RuntimeWarning: C function without declared return type called".
PyPy have very big size, libpypy.dll - 23 424 000 bytes.

It would be interesting to see the results of tests with a CPU with SSE2.
roxaz
Posts: 575
Joined: Tue Jan 23, 2007 8:35 pm
Location: LT

Post by roxaz »

yep, it consumes more memory - a tradeoff for better performance. There is some benchmark data for you:

using benchmark from http://blog.dhananjaynene.com/2008/07/p ... by-groovy/

(data from that site)
c++: 3 microseconds per iteration
CPython 2.5.1: 192 microseconds per iteration
CPython 2.5.1 with psyco: 33 microseconds per iteration

(my own tests)
CPython 2.6: 142 microseconds per iteration
PyPy: 5 microseconds per iteration

pretty good increase in performance i should say.

I didnt notice parser, thanks for info. ill try playing with it in my spare time
_maxim_
Posts: 54
Joined: Thu May 27, 2010 11:05 am
Location: Russia
Contact:

Post by _maxim_ »

With psyco must be very careful, sometimes it has the opposite effect. If you want the accelerator, look at http://code.google.com/p/shedskin/. I think the maximum speed will be with your own Python to C++ helper converter.
roxaz
Posts: 575
Joined: Tue Jan 23, 2007 8:35 pm
Location: LT

Post by roxaz »

i put in psyco just as an example, its not maintained any more and developer joined pypy. thing with shedskin is that it does not allow to use full power of python, where pypy does allow that. also pypy has its own shedskin-like translator that can compile rpython (restricted python, rules much like of shedskin) apps to native executables. if interested you can read http://www.rfk.id.au/blog/entry/compili ... -programs/
_maxim_
Posts: 54
Joined: Thu May 27, 2010 11:05 am
Location: Russia
Contact:

Post by _maxim_ »

roxaz wrote:thing with shedskin is that it does not allow to use full power of python, where pypy does allow that.
if there is something lacking, you can always add the necessary, as this is an open source project.
roxaz wrote:also pypy has its own shedskin-like translator that can compile rpython (restricted python, rules much like of shedskin) apps to native executables. if interested you can read http://www.rfk.id.au/blog/entry/compili ... -programs/
Thanks, but I'm more interested in my own pyirrlicht to Irrlicht C++ helper converter.
_maxim_
Posts: 54
Joined: Thu May 27, 2010 11:05 am
Location: Russia
Contact:

Re: pyirrlicht - python ctypes binding

Post by _maxim_ »

_maxim_
Posts: 54
Joined: Thu May 27, 2010 11:05 am
Location: Russia
Contact:

Re: pyirrlicht - python ctypes binding

Post by _maxim_ »

next edition game builder
some bugs fixed
added animations, destroy objects
_maxim_
Posts: 54
Joined: Thu May 27, 2010 11:05 am
Location: Russia
Contact:

Re: pyirrlicht - python ctypes binding

Post by _maxim_ »

game builder 0.5
added C++ game source
_maxim_
Posts: 54
Joined: Thu May 27, 2010 11:05 am
Location: Russia
Contact:

Re: pyirrlicht - python ctypes binding

Post by _maxim_ »

http://shanto.ru/gb/en/gb_faq.html - small FAQ for Game Builder
superpws
Posts: 18
Joined: Mon Mar 31, 2014 6:47 am
Contact:

Re: pyirrlicht - python ctypes binding

Post by superpws »

Have you tried Cython for binding C++ classes? I noticed it's faster and more maintainable. I was actually thinking of making Python wrapper using Cython from scratch. Let me know if you are interested.
IRC: #irrlicht on irc.freenode.net
Github: https://github.com/danyalzia
Homepage: http://danyalzia.com
_maxim_
Posts: 54
Joined: Thu May 27, 2010 11:05 am
Location: Russia
Contact:

Re: pyirrlicht - python ctypes binding

Post by _maxim_ »

please see your private messages
roxaz
Posts: 575
Joined: Tue Jan 23, 2007 8:35 pm
Location: LT

Re: pyirrlicht - python ctypes binding

Post by roxaz »

wrapping entire lib manually will take forever. maybe you should look at shiboken. it is wrapper generator for PySide (python wrapper for Qt). Now Qt is big and complex lib meaning that shiboken works. i pastebin'ed my little experiment that generates some wrappers. did not get to building ant testing yet though.
http://pastebin.com/0mT15hJs
http://pastebin.com/XAY6d3XH
Post Reply