Hi Chris,
I’m following up to tell you that our python environment is implemented and we’re ready to start thinking about the MWorks interaction!
See below for details, but maybe it would be good to have a zoom chat about it? I’m mostly free tomorrow and most days next week, so whatever works for you is probably good.
It seems the biggest hurdle might be the rendering. Our PIL-based python renderer is moderately fast (~250 frames per second for 512x512, drops to ~150 fps for 1024x1024), but you were saying that sending image arrays from Python through MWorks for displaying might be slow, so rendering in MWorks would be better.
In that case, we can send a serialized state of the environment to MWorks. The raw state that the environment has is (easily converted to) a list of (polygon, color) pairs, ordered by z-layer. So it would be really easy to JSON-serialize the state as a list of ([vertices], (R, G, B)) pairs.
Can MWorks render a polygon given a list of vertices and a color?
If yes, then our lives will be really easy! If no, then how do you suggest we handle the rendering?
By the way, the environment codebase is here (it’s a private repo but I’ve added you as collaborator so you should have access):
https://github.mit.edu/jazlab/object_oriented_games
Most of the codebase isn’t very for the MWorks interaction, but there are some example tasks if you scroll down on that page and the python renderer is in there here:
https://github.mit.edu/jazlab/object_oriented_games/blob/master/oog/observers/pil_renderer.py
The actual rendering happens around line 100, where it iterates through the environment state’s sprites and draws their vertices filled with their color.
Thank you,
Nick