LDraw.org Discussion Forums
Thoughts on animation scripting language - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html)
+--- Forum: LDraw Editors and Viewers (https://forums.ldraw.org/forum-11.html)
+--- Thread: Thoughts on animation scripting language (/thread-12368.html)

Pages: 1 2 3 4


Thoughts on animation scripting language - Roland Melkert - 2014-02-04

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.


Re: Thoughts on animation scripting language - Orion Pobursky - 2014-02-04

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.


Re: Thoughts on animation scripting language - Philippe Hurbain - 2014-02-05

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...)


Re: Thoughts on animation scripting language - Roland Melkert - 2014-02-05

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?


Re: Thoughts on animation scripting language - Philippe Hurbain - 2014-02-05

Maybe you could get some tips from Ralph Hempel...


Re: Thoughts on animation scripting language - Roland Melkert - 2014-02-05

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.


Re: Thoughts on animation scripting language - Orion Pobursky - 2014-02-05

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.


Re: Thoughts on animation scripting language - Roland Melkert - 2014-02-06

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:

Code:
msg=ldc.hoi()
ver=ldc.version
ldc.logInfo(msg, 'versie', ver)



Re: Thoughts on animation scripting language - Orion Pobursky - 2014-02-06

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.


Re: Thoughts on animation scripting language - Ben Supnik - 2014-02-06

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.