www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - What scripting language should I use

reply =?ISO-8859-1?Q?Jari-Matti_M=E4kel=E4?= <jmjmak utu.fi.invalid> writes:
I've decided to create my next big game in D. It will be a rpg using D
in the lower level stuff and an integrated scripting language for the
game logic. Now, the only thing I'm not sure about is the scripting
language. It needs to be object oriented / functional and somewhat
portable (linux & windows).

I've searched the dsource site. There is already more or less complete
support for
 - python (pyd)
 - ecmascript (dmdscript, walnut)
 - minid
 - lua (bindings lualib, dlua)
 - squirrel (bindings)
 - euphoria (freudo)
 - lisp (dlisp)

Maybe there are other production ready implementations not listed here?

It seems the pyd, minid and dmdscript projects are well maintained.

The best option would be to fully integrate the scripting engine to my
game. Using it via the C ABI should be ok, but requires a bit extra work.

Which one should I take. I don't want to end up using vaporware. The
miniD projects looks interesting. I know dmdscript works, but I think
those other languages might be better suited for my game.
Dec 14 2006
next sibling parent Derek Parnell <derek nomail.afraid.org> writes:
On Fri, 15 Dec 2006 03:07:54 +0200, Jari-Matti Mäkelä wrote:

 I've decided to create my next big game in D. It will be a rpg using D
 in the lower level stuff and an integrated scripting language for the
 game logic. Now, the only thing I'm not sure about is the scripting
 language. It needs to be object oriented / functional and somewhat
 portable (linux & windows).
 
 I've searched the dsource site. There is already more or less complete
 support for
  - python (pyd)
  - ecmascript (dmdscript, walnut)
  - minid
  - lua (bindings lualib, dlua)
  - squirrel (bindings)
  - euphoria (freudo)
  - lisp (dlisp)
 
 Maybe there are other production ready implementations not listed here?
 
 It seems the pyd, minid and dmdscript projects are well maintained.
 
 The best option would be to fully integrate the scripting engine to my
 game. Using it via the C ABI should be ok, but requires a bit extra work.
 
 Which one should I take. I don't want to end up using vaporware. The
 miniD projects looks interesting. I know dmdscript works, but I think
 those other languages might be better suited for my game.
Go with miniD. The freudo's Euphoria is a good six-months away from being usable and the Euphoria from RDS doesn't integrate well as a scripting language (IMHO). -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocrity!" 15/12/2006 12:19:11 PM
Dec 14 2006
prev sibling next sibling parent reply Kirk McDonald <kirklin.mcdonald gmail.com> writes:
Jari-Matti Mäkelä wrote:
 I've decided to create my next big game in D. It will be a rpg using D
 in the lower level stuff and an integrated scripting language for the
 game logic. Now, the only thing I'm not sure about is the scripting
 language. It needs to be object oriented / functional and somewhat
 portable (linux & windows).
 
 I've searched the dsource site. There is already more or less complete
 support for
  - python (pyd)
  - ecmascript (dmdscript, walnut)
  - minid
  - lua (bindings lualib, dlua)
  - squirrel (bindings)
  - euphoria (freudo)
  - lisp (dlisp)
 
 Maybe there are other production ready implementations not listed here?
 
 It seems the pyd, minid and dmdscript projects are well maintained.
 
 The best option would be to fully integrate the scripting engine to my
 game. Using it via the C ABI should be ok, but requires a bit extra work.
 
 Which one should I take. I don't want to end up using vaporware. The
 miniD projects looks interesting. I know dmdscript works, but I think
 those other languages might be better suited for my game.
There are perhaps three things to be aware of if you're considering using Pyd: 1) Linux support is still missing. I get the impression a new GDC release is close, and it is my hope that this will change at that time. It's worth pointing out that CeleriD (Pyd's build system) already works in Linux for building extensions written to the raw Python/C API. 2) At the moment, Pyd is written from the standpoint of writing extensions to Python in D, rather than embedding Python in D. This is not to say Pyd wouldn't be helpful if you wanted to embed Python in your D code (at the very least, Pyd has the most up-to-date bindings for the Python/C API), but your code will essentially just be using the raw C API for many things. 3) I'm still cramming features into Pyd at a decent clip. I don't expect the existing API to change much, but be aware that new features are being added about as fast as I can think of and implement them. -- Kirk McDonald Pyd: Wrapping Python with D http://pyd.dsource.org
Dec 14 2006
next sibling parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
Kirk McDonald wrote:
 Jari-Matti Mäkelä wrote:
 I've decided to create my next big game in D. It will be a rpg using D
 in the lower level stuff and an integrated scripting language for the
 game logic. Now, the only thing I'm not sure about is the scripting
 language. It needs to be object oriented / functional and somewhat
 portable (linux & windows).

 I've searched the dsource site. There is already more or less complete
 support for
  - python (pyd)
  - ecmascript (dmdscript, walnut)
  - minid
  - lua (bindings lualib, dlua)
  - squirrel (bindings)
  - euphoria (freudo)
  - lisp (dlisp)

 Maybe there are other production ready implementations not listed here?

 It seems the pyd, minid and dmdscript projects are well maintained.

 The best option would be to fully integrate the scripting engine to my
 game. Using it via the C ABI should be ok, but requires a bit extra work.

 Which one should I take. I don't want to end up using vaporware. The
 miniD projects looks interesting. I know dmdscript works, but I think
 those other languages might be better suited for my game.
There are perhaps three things to be aware of if you're considering using Pyd: 1) Linux support is still missing. I get the impression a new GDC release is close, and it is my hope that this will change at that time. It's worth pointing out that CeleriD (Pyd's build system) already works in Linux for building extensions written to the raw Python/C API. 2) At the moment, Pyd is written from the standpoint of writing extensions to Python in D, rather than embedding Python in D. This is not to say Pyd wouldn't be helpful if you wanted to embed Python in your D code (at the very least, Pyd has the most up-to-date bindings for the Python/C API), but your code will essentially just be using the raw C API for many things. 3) I'm still cramming features into Pyd at a decent clip. I don't expect the existing API to change much, but be aware that new features are being added about as fast as I can think of and implement them.
Yes after enthusiastically recommending Python, I should add the disclaimer that I've never used PyD. ;-) Nor was I aware of points 1 & 2 above. Kirk -- I would definitely encourage you to think about how to make Pyd more useful for embedding as well. I think that's one place where Python advocates tend to be unrealistic. Sometimes embedding is just a better fit, like when you want to add a bit of external scripting capability to an app. Probably one of the best known examples of Python use is in Blender, which embeds. I wonder what's missing in Pyd? Pyd must have a way to let you call a Python function from D, otherwise your D extension module's ability to interact with python is quite limited (no callbacks to Python for instance). Is it just the python startup code? --bb (who was hoping to use Pyd for embedding python at some point)
Dec 14 2006
parent Kirk McDonald <kirklin.mcdonald gmail.com> writes:
Bill Baxter wrote:
 Kirk McDonald wrote:
 Jari-Matti Mäkelä wrote:
 I've decided to create my next big game in D. It will be a rpg using D
 in the lower level stuff and an integrated scripting language for the
 game logic. Now, the only thing I'm not sure about is the scripting
 language. It needs to be object oriented / functional and somewhat
 portable (linux & windows).

 I've searched the dsource site. There is already more or less complete
 support for
  - python (pyd)
  - ecmascript (dmdscript, walnut)
  - minid
  - lua (bindings lualib, dlua)
  - squirrel (bindings)
  - euphoria (freudo)
  - lisp (dlisp)

 Maybe there are other production ready implementations not listed here?

 It seems the pyd, minid and dmdscript projects are well maintained.

 The best option would be to fully integrate the scripting engine to my
 game. Using it via the C ABI should be ok, but requires a bit extra 
 work.

 Which one should I take. I don't want to end up using vaporware. The
 miniD projects looks interesting. I know dmdscript works, but I think
 those other languages might be better suited for my game.
There are perhaps three things to be aware of if you're considering using Pyd: 1) Linux support is still missing. I get the impression a new GDC release is close, and it is my hope that this will change at that time. It's worth pointing out that CeleriD (Pyd's build system) already works in Linux for building extensions written to the raw Python/C API. 2) At the moment, Pyd is written from the standpoint of writing extensions to Python in D, rather than embedding Python in D. This is not to say Pyd wouldn't be helpful if you wanted to embed Python in your D code (at the very least, Pyd has the most up-to-date bindings for the Python/C API), but your code will essentially just be using the raw C API for many things. 3) I'm still cramming features into Pyd at a decent clip. I don't expect the existing API to change much, but be aware that new features are being added about as fast as I can think of and implement them.
Yes after enthusiastically recommending Python, I should add the disclaimer that I've never used PyD. ;-) Nor was I aware of points 1 & 2 above. Kirk -- I would definitely encourage you to think about how to make Pyd more useful for embedding as well. I think that's one place where Python advocates tend to be unrealistic. Sometimes embedding is just a better fit, like when you want to add a bit of external scripting capability to an app. Probably one of the best known examples of Python use is in Blender, which embeds. I wonder what's missing in Pyd? Pyd must have a way to let you call a Python function from D, otherwise your D extension module's ability to interact with python is quite limited (no callbacks to Python for instance). Is it just the python startup code? --bb (who was hoping to use Pyd for embedding python at some point)
Embedding is of great interest to me. It's on the short list of things I want to do. (Also on that list: Improve the way CeleriD handles object files; and a custom type conversion registry.) Callbacks are easy: delegates are a convertible type. This means that Pyd can convert any callable Python object into a delegate, and any delegate into a callable Python object. Supporting embedding requires two things: First is wrapping the pertinent sections of the Python/C API. The PydObject class (which was actually the first thing I wrote in Pyd) is the first swipe at this. It wraps any PyObject*, and overloads a whole bunch of operators, so that using a PyObject in D acts as much like using it in Python as possible. PydObject is only the first step; there are a number of helper functions needed to really make it useful. (The 'py' template function is the most important: it accepts any arbitrary D item and returns a PydObject.) Another important class (which I have started writing, but which is not in SVN yet) is one that wraps the Python interpreter itself. This class would have methods like 'Import' (for importing Python modules) and 'Run' (for running strings with Python code in them, as in PyRun_SimpleString), and would control initialization and finalization of the interpreter. Yet another thing to support is extending the embedded interpreter. That is, exposing your D functions and classes to the Python code being run in your embedded interpreter. I have already added some support in this vein, though I haven't documented or tested it, yet. For the most part, this is just like writing a regular extension. The second thing required in order to support embedding is working out the build method. This is probably easier than the first thing. When used in this way, Pyd becomes just another library to link against and directory to put on the library search path. (In fact, you'd have to link against the Pyd library -- which doesn't exist, yet -- and the Python DLL.) -- Kirk McDonald Pyd: Wrapping Python with D http://pyd.dsource.org
Dec 14 2006
prev sibling parent reply =?ISO-8859-1?Q?Jari-Matti_M=E4kel=E4?= <jmjmak utu.fi.invalid> writes:
Kirk McDonald wrote:
 Jari-Matti Mäkelä wrote:
 I've decided to create my next big game in D. It will be a rpg using D
 in the lower level stuff and an integrated scripting language for the
 game logic. Now, the only thing I'm not sure about is the scripting
 language. It needs to be object oriented / functional and somewhat
 portable (linux & windows).

 I've searched the dsource site. There is already more or less complete
 support for
  - python (pyd)
  - ecmascript (dmdscript, walnut)
  - minid
  - lua (bindings lualib, dlua)
  - squirrel (bindings)
  - euphoria (freudo)
  - lisp (dlisp)

 Maybe there are other production ready implementations not listed here?

 It seems the pyd, minid and dmdscript projects are well maintained.

 The best option would be to fully integrate the scripting engine to my
 game. Using it via the C ABI should be ok, but requires a bit extra work.

 Which one should I take. I don't want to end up using vaporware. The
 miniD projects looks interesting. I know dmdscript works, but I think
 those other languages might be better suited for my game.
There are perhaps three things to be aware of if you're considering using Pyd: 1) Linux support is still missing. I get the impression a new GDC release is close, and it is my hope that this will change at that time. It's worth pointing out that CeleriD (Pyd's build system) already works in Linux for building extensions written to the raw Python/C API. 2) At the moment, Pyd is written from the standpoint of writing extensions to Python in D, rather than embedding Python in D. This is not to say Pyd wouldn't be helpful if you wanted to embed Python in your D code (at the very least, Pyd has the most up-to-date bindings for the Python/C API), but your code will essentially just be using the raw C API for many things. 3) I'm still cramming features into Pyd at a decent clip. I don't expect the existing API to change much, but be aware that new features are being added about as fast as I can think of and implement them.
1) Thanks for the info. Linux support is one of the most important requirements. 2) ok 3) yes, I have noticed <g>. You've done excellent job with Pyd. Hopefully it (the template stuff) can serve as a basis for other scripting languages too, e.g. Ruby.
Dec 15 2006
parent Kirk McDonald <kirklin.mcdonald gmail.com> writes:
Jari-Matti Mäkelä wrote:
 3) yes, I have noticed <g>. You've done excellent job with Pyd.
 Hopefully it (the template stuff) can serve as a basis for other
 scripting languages too, e.g. Ruby.
I've looked at writing something like Pyd for Ruby, but I don't have the patience to write bindings for the Ruby API. (Deja Augustine and David Rushby had already done most of the work behind writing the Python/C API bindings before I started Pyd.) The Ruby API is also more poorly documented than the Python API. Finally, I just don't know Ruby that well. :-) I fully believe that the "hard bits" of Pyd would translate well to pretty much any other scripting language. Someone just needs to do it. :-) -- Kirk McDonald Pyd: Wrapping Python with D http://pyd.dsource.org
Dec 15 2006
prev sibling next sibling parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
Jari-Matti Mäkelä wrote:
 I've decided to create my next big game in D. It will be a rpg using D
 in the lower level stuff and an integrated scripting language for the
 game logic. Now, the only thing I'm not sure about is the scripting
 language. It needs to be object oriented / functional and somewhat
 portable (linux & windows).
 
 I've searched the dsource site. There is already more or less complete
 support for
  - python (pyd)
  - ecmascript (dmdscript, walnut)
  - minid
  - lua (bindings lualib, dlua)
  - squirrel (bindings)
  - euphoria (freudo)
  - lisp (dlisp)
 
 Maybe there are other production ready implementations not listed here?
 
 It seems the pyd, minid and dmdscript projects are well maintained.
 
 The best option would be to fully integrate the scripting engine to my
 game. Using it via the C ABI should be ok, but requires a bit extra work.
 
 Which one should I take. I don't want to end up using vaporware. The
 miniD projects looks interesting. I know dmdscript works, but I think
 those other languages might be better suited for my game.
If you don't have any sort of a low-memory requirement, then I'd say go with Python. Kirk seems to be cranking away quite diligently at PyD, and D templates just keep getting better and better allowing PyD to do more stuff. It looks to be in a virtuous cycle to me. Python also has tons of libraries available for it, though I'm not sure that will make much difference in the game context, where pretty much everything you need will be specific to your game. But for instance a quick search turned up an implementation of the ever-popular A* path planning algo: http://www.pygame.org/projects/9/195/ --bb
Dec 14 2006
parent =?ISO-8859-1?Q?Jari-Matti_M=E4kel=E4?= <jmjmak utu.fi.invalid> writes:
Bill Baxter wrote:
 Jari-Matti Mäkelä wrote:
 Which one should I take. I don't want to end up using vaporware. The
 miniD projects looks interesting. I know dmdscript works, but I think
 those other languages might be better suited for my game.
If you don't have any sort of a low-memory requirement, then I'd say go with Python. Kirk seems to be cranking away quite diligently at PyD, and D templates just keep getting better and better allowing PyD to do more stuff. It looks to be in a virtuous cycle to me. Python also has tons of libraries available for it, though I'm not sure that will make much difference in the game context, where pretty much everything you need will be specific to your game. But for instance a quick search turned up an implementation of the ever-popular A* path planning algo: http://www.pygame.org/projects/9/195/
I've already implemented A* in D :). I'm going to do much of the cpu/memory-intensive stuff in native code so that the scripting engine does not form a bottleneck there. Have to benchmark those languages a bit more, though. I guess it's just a matter of taste, which language should I pick. The hardware requirements aren't crucial. Much of the game logic will be AI and decision making logic, and I'm going to study it myself along the way. So no need for existing libraries. High level language constructs are more important. I'll take a closer look at miniD and Lua. Unfortunately it seems that Pyd is out of the count for now.
Dec 15 2006
prev sibling next sibling parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Jari-Matti Mäkelä" <jmjmak utu.fi.invalid> wrote in message 
news:elssha$npp$1 digitaldaemon.com...
 I've decided to create my next big game in D. It will be a rpg using D
 in the lower level stuff and an integrated scripting language for the
 game logic. Now, the only thing I'm not sure about is the scripting
 language. It needs to be object oriented / functional and somewhat
 portable (linux & windows).

 I've searched the dsource site. There is already more or less complete
 support for
 - python (pyd)
 - ecmascript (dmdscript, walnut)
 - minid
 - lua (bindings lualib, dlua)
 - squirrel (bindings)
 - euphoria (freudo)
 - lisp (dlisp)

 Maybe there are other production ready implementations not listed here?

 It seems the pyd, minid and dmdscript projects are well maintained.

 The best option would be to fully integrate the scripting engine to my
 game. Using it via the C ABI should be ok, but requires a bit extra work.

 Which one should I take. I don't want to end up using vaporware. The
 miniD projects looks interesting. I know dmdscript works, but I think
 those other languages might be better suited for my game.
Maybe I'm biased, but I'd use MiniD if I were you ;) As it stands, though, MiniD isn't finished quite yet, and I plan on making some rather big changes to it over Christmas break. However, I hope to have a "version 1.0" of some sort -- i.e. a stable release -- out in conjunction with D 1.0 (i.e. January 1st). That will hopefully also include a Pyd-like binding library. Not sure about coroutines, but if I can get those implemented as well, that would be a great bonus. Pretty much the main motivation for using MiniD is that it's an entirely D project, and as such, can evolve along with D and support D constructs and types natively. Not to knock Pyd because it's an amazing system and is/will be a great inspiration for what the MiniD binding lib will be like.
Dec 14 2006
parent =?ISO-8859-1?Q?Jari-Matti_M=E4kel=E4?= <jmjmak utu.fi.invalid> writes:
Jarrett Billingsley wrote:
 "Jari-Matti Mäkelä" <jmjmak utu.fi.invalid> wrote in message 
 news:elssha$npp$1 digitaldaemon.com...
 I've decided to create my next big game in D. It will be a rpg using D
 in the lower level stuff and an integrated scripting language for the
 game logic. Now, the only thing I'm not sure about is the scripting
 language. It needs to be object oriented / functional and somewhat
 portable (linux & windows).

 I've searched the dsource site. There is already more or less complete
 support for
 - python (pyd)
 - ecmascript (dmdscript, walnut)
 - minid
 - lua (bindings lualib, dlua)
 - squirrel (bindings)
 - euphoria (freudo)
 - lisp (dlisp)

 Maybe there are other production ready implementations not listed here?

 It seems the pyd, minid and dmdscript projects are well maintained.

 The best option would be to fully integrate the scripting engine to my
 game. Using it via the C ABI should be ok, but requires a bit extra work.

 Which one should I take. I don't want to end up using vaporware. The
 miniD projects looks interesting. I know dmdscript works, but I think
 those other languages might be better suited for my game.
Maybe I'm biased, but I'd use MiniD if I were you ;)
Ok, I'll try it on a mini project first. It looks very interesting.
 As it stands, though, MiniD isn't finished quite yet, and I plan on making 
 some rather big changes to it over Christmas break.  However, I hope to have 
 a "version 1.0" of some sort -- i.e. a stable release -- out in conjunction 
 with D 1.0 (i.e. January 1st).
No hurry. :) I think I'll start working with the scripting in 3-5 months, i.e. after the core engine is functional.
 That will hopefully also include a Pyd-like 
 binding library.  Not sure about coroutines, but if I can get those 
 implemented as well, that would be a great bonus.
Great.
 Pretty much the main motivation for using MiniD is that it's an entirely D 
 project, and as such, can evolve along with D and support D constructs and 
 types natively.  Not to knock Pyd because it's an amazing system and is/will 
 be a great inspiration for what the MiniD binding lib will be like. 
Yup.
Dec 15 2006
prev sibling parent reply David Medlock <noone nowhere.com> writes:
Jari-Matti Mäkelä wrote:
 I've decided to create my next big game in D. It will be a rpg using D
 in the lower level stuff and an integrated scripting language for the
 game logic. Now, the only thing I'm not sure about is the scripting
 language. It needs to be object oriented / functional and somewhat
 portable (linux & windows).
 
 I've searched the dsource site. There is already more or less complete
 support for
  - python (pyd)
  - ecmascript (dmdscript, walnut)
  - minid
  - lua (bindings lualib, dlua)
  - squirrel (bindings)
  - euphoria (freudo)
  - lisp (dlisp)
 
 Maybe there are other production ready implementations not listed here?
 
 It seems the pyd, minid and dmdscript projects are well maintained.
 
 The best option would be to fully integrate the scripting engine to my
 game. Using it via the C ABI should be ok, but requires a bit extra work.
 
 Which one should I take. I don't want to end up using vaporware. The
 miniD projects looks interesting. I know dmdscript works, but I think
 those other languages might be better suited for my game.
I am only vaguely familiar with MiniD but I would(and do) choose Lua. Lua is rock solid,has lots of capabilities (coroutines, closures, good C-API),is bytecode compiled and is used in many professional games (Farcry, World of Warcraft, NWN). Check Programming Languages shootout (and the Win32 one) and Lua5 beats all the other scripting languages pretty handily: http://dada.perl.it/shootout/craps.html It comes just after GCC and just before Bytecode Objective CAML. -DavidM
Dec 14 2006
parent =?ISO-8859-1?Q?Jari-Matti_M=E4kel=E4?= <jmjmak utu.fi.invalid> writes:
David Medlock wrote:
 Jari-Matti Mäkelä wrote:
 I've decided to create my next big game in D. It will be a rpg using D
 in the lower level stuff and an integrated scripting language for the
 game logic. Now, the only thing I'm not sure about is the scripting
 language. It needs to be object oriented / functional and somewhat
 portable (linux & windows).

 I've searched the dsource site. There is already more or less complete
 support for
  - python (pyd)
  - ecmascript (dmdscript, walnut)
  - minid
  - lua (bindings lualib, dlua)
  - squirrel (bindings)
  - euphoria (freudo)
  - lisp (dlisp)

 Maybe there are other production ready implementations not listed here?

 It seems the pyd, minid and dmdscript projects are well maintained.

 The best option would be to fully integrate the scripting engine to my
 game. Using it via the C ABI should be ok, but requires a bit extra work.

 Which one should I take. I don't want to end up using vaporware. The
 miniD projects looks interesting. I know dmdscript works, but I think
 those other languages might be better suited for my game.
I am only vaguely familiar with MiniD but I would(and do) choose Lua. Lua is rock solid,has lots of capabilities (coroutines, closures, good C-API),is bytecode compiled and is used in many professional games (Farcry, World of Warcraft, NWN).
What library project should I use for interfacing with Lua. I've noticed there are some API/ABI issues wrt 5.0.x -> 5.1 transition. There are also some issues with shared libraries in Linux.
Dec 15 2006