Poll: Python useful with Torque?
by Prairie Games · in Torque Game Engine · 04/28/2002 (12:11 am) · 3 replies
I have devoted some time to learning Python www.python.org as I intended it to be the scripting language for my next engine... as Torque may be my next engine I have interest in hooking it up for use in Torque...
I have written an automatic C++ class to script binding system. This module gets rid of having to write (annoying) glue code and is very similar to Dungeon Siege's method: www.drizzle.com/~scottb/gdc/fubi-paper.htm ... it makes it TRIVIAL to export entire dll's for use in a scripting language... it also provides hiding of functions and classes... the system can be hooked up to Torque scripting, Python, Lua, you name it... unfortunately it only works on Win32 at the moment... it requires a small amount of assembly and some windows functionality to unmangle the C++ class/function definitions from the .dll... but it is wicked cool.. any Mac/Linux gurus would be more than welcome to have at :) Anyway... I mention this because binding code to Torque script and Python would get tedious very very quickly... with this you get both via automation...
I don't see any functionality that wouldn't translate... and Python has some really nice stuff including: loads of documentation, a very large and active userbase, decent execution speed, amazing cross platform libraries, very clean object oriented syntax, and something I am very keen on: Generators... there is also a Stackless module www.stackless.com which promises microthreading... something I have wanted for a very long time...
Please note I am not talking about REPLACING Torque script with Python...
I am curious what other programmers have to say on the subject... who knows Python?
-J
I have written an automatic C++ class to script binding system. This module gets rid of having to write (annoying) glue code and is very similar to Dungeon Siege's method: www.drizzle.com/~scottb/gdc/fubi-paper.htm ... it makes it TRIVIAL to export entire dll's for use in a scripting language... it also provides hiding of functions and classes... the system can be hooked up to Torque scripting, Python, Lua, you name it... unfortunately it only works on Win32 at the moment... it requires a small amount of assembly and some windows functionality to unmangle the C++ class/function definitions from the .dll... but it is wicked cool.. any Mac/Linux gurus would be more than welcome to have at :) Anyway... I mention this because binding code to Torque script and Python would get tedious very very quickly... with this you get both via automation...
I don't see any functionality that wouldn't translate... and Python has some really nice stuff including: loads of documentation, a very large and active userbase, decent execution speed, amazing cross platform libraries, very clean object oriented syntax, and something I am very keen on: Generators... there is also a Stackless module www.stackless.com which promises microthreading... something I have wanted for a very long time...
Please note I am not talking about REPLACING Torque script with Python...
I am curious what other programmers have to say on the subject... who knows Python?
-J
#2
The builtin scripting language is great for Torque and sufficient for most people. However, I would like to see Python support added at some point. Since its a more standard language it may be easier to for newcomers to learn Torque scripting with it. It supports a lot of powerful language constructs, notably object orientation. It has a big class library that can do a Lot of useful stuff.
To do it right, though, is a Big project. Torque shouldn't need python to build, and people who don't want to use it shouldn't have to fuss with it. You should be able to use both languages at the same time, and also reference variables/functions declared in the other language. Most (all?) language constructs support by the builtin language should be available in Python. You need to make sure it is secure so that scripts can't format the user's hard drive or snoop files.
In short I think it would be useful but its a lot of work.
04/28/2002 (12:27 pm)
One reason I bought Torque was because I wanted to see if I could hook up Python to it. :) I haven't done it and I have no plans to work on it now.The builtin scripting language is great for Torque and sufficient for most people. However, I would like to see Python support added at some point. Since its a more standard language it may be easier to for newcomers to learn Torque scripting with it. It supports a lot of powerful language constructs, notably object orientation. It has a big class library that can do a Lot of useful stuff.
To do it right, though, is a Big project. Torque shouldn't need python to build, and people who don't want to use it shouldn't have to fuss with it. You should be able to use both languages at the same time, and also reference variables/functions declared in the other language. Most (all?) language constructs support by the builtin language should be available in Python. You need to make sure it is secure so that scripts can't format the user's hard drive or snoop files.
In short I think it would be useful but its a lot of work.
#3
This Lua I keep mentioning can be found at www.lua.org ... it is a really nice SMALL language(used in Baldur's Gate, Grim Fandango, etc)... which is incredibly easy to bind to...
Anyway, I agree that outside of automation, binding to Python is a bit of a hassle(this isn't Python specific).. though think about this... it would be possible to use the TorqueScript methods of binding to hook in Python... kind of a wrapper that takes input and exposes the native to both languages... routing between as well.. this isn't nearly as complex as it may sound...
The security issue is quite real, I haven't researched Python security... but I know it exists and is probably quite robust...
-J
04/28/2002 (12:44 pm)
I do wish the automatic script binding system mentioned above worked for all platforms... this would be useful for glueing C++ to TorqueScript as well as Python, or Lua..This Lua I keep mentioning can be found at www.lua.org ... it is a really nice SMALL language(used in Baldur's Gate, Grim Fandango, etc)... which is incredibly easy to bind to...
Anyway, I agree that outside of automation, binding to Python is a bit of a hassle(this isn't Python specific).. though think about this... it would be possible to use the TorqueScript methods of binding to hook in Python... kind of a wrapper that takes input and exposes the native to both languages... routing between as well.. this isn't nearly as complex as it may sound...
The security issue is quite real, I haven't researched Python security... but I know it exists and is probably quite robust...
-J
Torque Owner Bryan "daerid" Ross
Torque Scripting already does everything you need it to. What do you need python for?
Not trying to belittle python, I just see no need for adding a second scripting language.