LDraw.org Discussion Forums

Full Version: Thoughts on animation scripting language
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Hi all, while LDCad 1.3 is still in beta I'm already playing with 1.4 things....

One of those things will be animation, I want to take the all scripting road with this. So the thing I'm trying to decide at the moment is to ether create my own language (based on the one from LD4DStudio) or tie in an existing language (e.g. LUA).

The scripts will do little more then describe relations between groups. For example in case of two gears with the attached axles etc the script will do something like 'a.angle:=-2*b.angle'. A script could also manipulate the group placement matrix directly etc.

While LUA or pearl might be very powerful, it also will be difficult for non programmer users ( I Think) to get started with. A simple custom language on the other hand will be much easier to learn but limited to basic single function formulas etc. Although I could expand the language over time.

In short I find it difficult to decide at the moment, so I was hoping for some additional thoughts.
I think an existing language (Lua, Tcl, Python) is the way to go rather than reinventing the wheel and rolling your own. It will also be easier for you as the project maintainer to plugin an exiting framework rather than writing all the code that would be required to implement your own design.
I agree with Orion. Lua seems a good candidate to me, elementary use is not too frightening even for a novice like me (I played quite a bit with pbLua for NXT...)
I've been looking more into LUA and it seems relatively easy to embed in a c++ program. Only thing I'm worrying about is how to handle matrix math which must be shared with the C++ matrix/vector objects (although I'm thinking using handles would probably work)

It would save alot of dev time if I could embed LUA in say couple of days and spend the rest of my time fine tuning the animation api toolset/interface, so at the moment I'm leaning towards LUA.

Does anyone here have experience embedding LUA, of knows of a better alternative?
Maybe you could get some tips from Ralph Hempel...
Actually it's surprisingly easy, I downloaded , compiled (into .a) and statically linked lua against the dev version of LDCad in under 15 mins.

Now I have to learn the lua C api, and setup some nice wrapper (management) class for it, which will take far more time Smile

On a side note, if anyone has ideas / suggestions for the general animation api for LDCad I'm open to all suggestions.
Roland Melkert Wrote:Actually it's surprisingly easy, I downloaded , compiled (into .a) and statically linked lua against the dev version of LDCad in under 15 mins.

Hmm, when I get back up on the LDDP horse, I'm considering moving plugins to Lua or similar scripting language so I'm glad that integration is easy.
Wasn't LDDP a Delphi program? If so you might need to do some more work to get it working through a DLL for example.

Anyway I'm definitely going the LUA way for LDCad 1.4 cause after only one evening of playing around I've got it to put

Quote:Script output: Hallo wereld versie 1

In the log file using this LUA script/chunk:

ldc.logInfo(msg, 'versie', ver)
Yah. But I'm in the process of converting over to Lazarus/FreePascal since I don't feel like paying the extortionary prices to keep current on Delphi and it's cross platform with native widgets. Plus there are Lua-Pascal libraries out there.
To echo what others have said, Lua is a solid choice for this -- it seems to be popular with non-programmer artist types in the game-dev world, so I wouldn't worry too much about initial hurdle. In the long term Lua will scale up for larger scripts, and you can move to LuaJIT for better performance.
Pages: 1 2 3 4