Thursday, June 14, 2012

Python scripting with a java based engine

This is actually a very old post that I just forgot to publish, the engine that is mentioned is open source at:
http://code.google.com/p/cosmic-engine/

I had a very good experience integrating Jython with the java based engine I'm working on.
It is fairly straight forward to execute dynamic scripts that can receive java objects, create java objects and utilize existing java API... the first thing I used it for was embedding interaction scripts in objects.

(character behaviors triggered by a script that is embedded in objects: floor - go to, chair - go sit)

Picking (clicking with the mouse and checking collision with a ray shot form the camera) an object is a very natural way of interaction, embedding the script in the picked object makes the system very extensible, a message source (I use a class type) and message data (generic java object) that are passed to the script along with additional information about the pick serves as a form of a "loose hand shake" between the code that initiated the pick and the picked object script.

Initialization scripts could enable the team to set up testing environments and improve productivity,

No comments:

Post a Comment