Python Scripting
A friend and I are looking at the Doomsday Engine as the basis for some stuff we're playing with, and we'd like to be able to do some scripting in Python. We've had success embedding the interpreter in other engines in the past, but looking at Doomsday's modular architecture, we're not entirely sure where Python would best fit. Should we confine it to our game plugin, or would we be better off extending libcore?
Comments
You might want to give the interactive script console a try:
- open the taskbar
- click the > button on the far left
- enable Doomsday Script
Our motivation for using Python in this case is to gain access to Python's overwhelming library support. Reinventing the wheel is a bad idea, I understand, so perhaps we could expose Doomsday Script or its functionality to Python?
I will strongly consider it. If the documentation is out of date, even a brief overview of what's currently possible with this scripting will be very helpful. We're looking first and foremost to replicate map-level scripting like ACS, which I understand that Doomsday Script can easily do. Looking through the documentation and the proposal, these features are mentioned but never demonstrated. I'll look at the examples provided with the source and do my best to figure things out.
Please note that Doomsday Script is far from finished — I'm developing it further as needed based on where it is being integrated in the engine. One practical thing to note is also that it has very little in the way of optimization in the runtime: several operations do things less efficiently than they should (unneeded copies of values, etc.). Compared to Python with it years of optimization, this is a definite downside.
The best place for an overview of the features of the language is the kitchen_sink.de script in the tests/test_script app.
At runtime, with the console in Script mode, you can use the dir() command to get a list of all the currently provided built-in modules (because they are automatically imported into the console's process):
The packages net.dengine.stdlib and net.dengine.stdlib.gui contain the (very small) Doomsday Script standard library as it exists today.
Map-level scripting is already in our plans and its called "XG 2.0". (XG 1.0 was/is Doomsday's old way of "scripting" what functionality lines and sectors have in maps.) I see map-level scripting as a very valuable feature, so any help provided in this area would be quite welcome. In practice, I see the following tasks need doing:
I am happy to assist in any way if you wish to implement some of these features.