Sign in to follow this  

Lua or AngelScript?

This topic is 4280 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am planning to implement scripting features in a small game I am writing (yes, when something will be playable I will let you know), so I have given a look on the web and I got the below question: Is AngelScript better than LUA? Let's be clear, I like a lot AngelScript and I think I will use it in the end, but I have to complain about the static library file size I compiled.
Quote:
The library will be as light-weight as possible, this means that it will not have a lot of built-in functionality that only a few applications use.
I compiled AngelScript with my vc6 (win32) compiler, defining ANGELSCRIPT_EXPORT,BUILD_WITHOUT_LINE_CUES,AS_C_INTERFACE I couldn't see any optional modules to turn off before compiling to reduce the code size, so I got an angelscript.lib output file sized 670106 bytes, 654 KB!! The default compiled LUA static lib is 443212 bytes (432 KB), a smaller code size. Why? I know that 654 KB is not a huge size...however it is relevant to me. Maybe older AngelScript versions are smaller? Are they enough usable? Another question: what about performance? Is AngelScript faster than LUA? Without having benchmarked them, I think that technically AngelScript should be faster because of its typed variables. If AngelScript is faster than LUA, I think that the bigger code size is an excellent compromise. But if it is not, then there is some efficiency issue... [Edited by - legolas558 on March 26, 2006 11:36:15 AM]

Share this post


Link to post
Share on other sites
Is AngelScript better than Lua?

This question has no answer. AngelScript has its advantages and Lua has its own. It inevitable comes down to what your needs are, and which one suits your needs the best will have to be evaluated by yourself.

The size of the static library is larger than Lua because AngelScript is a lot more complex than Lua. This doesn't mean that AngelScript is better or worse than Lua, it just means that the concept is different. As an example, since Lua uses dynamic types all expressions looks the same to the Lua compiler, whereas in AngelScript the compiler has to be able to handle all combinations of types that are supported.

When I said light-weight, I meant that I will not include a lot of complex built-in object structures, such as maps, dictionaries, hash trees, etc. Only the absolutely necessary objects. The complex structures will be added through add-ons which can be easily customized for each application. One example is the string type, it is not built-in to the library, instead you register your own class that works best with your application. There is of course a standard add-on available, see asCScriptString in the add-on folder.

In the future, when AngelScript is feature complete, I may make a little brother to the library. It would cut out a lot of the features that are not exactly necessary, such as the for-loop, switch statement, classes, support for native calling conventions, object operator overloads, compound assignments, etc. This will likely cut down library size by a lot.

From what I've heard AngelScript is quite faster than Lua. But I haven't made any benchmarking myself so I cannot guarantee that this is a valid statement. I have worked hard to optimize the speed of AngelScript, but I know there is even more performance that can be squeezed out of it and I intend to do that when I get the time.

Don't forget that AngelScript is still under heavy development, whereas Lua is already complete (although some improvement continues to be made). This too has it's advantages and disadvantages. An advantage is that you can influence the development of AngelScript, a disadvantage is that sometimes you'll have to rework your code to adapt to changes. I try to minimize the latter, but it has happened before, and it may happen again.

No one can tell you what library to use, at least not without knowing the exact needs you have.

Still, I hope that you'll go with AngelScript. :)

Regards,
Andreas

Share this post


Link to post
Share on other sites
Thank you for your reply!


Quote:
Original post by WitchLord
The size of the static library is larger than Lua because AngelScript is a lot more complex than Lua. This doesn't mean that AngelScript is better or worse than Lua, it just means that the concept is different. As an example, since Lua uses dynamic types all expressions looks the same to the Lua compiler, whereas in AngelScript the compiler has to be able to handle all combinations of types that are supported.

Yeah, I already got that, sorry for not specifying it in the first post

Quote:
When I said light-weight, I meant that I will not include a lot of complex built-in object structures, such as maps, dictionaries, hash trees, etc. Only the absolutely necessary objects. The complex structures will be added through add-ons which can be easily customized for each application. One example is the string type, it is not built-in to the library, instead you register your own class that works best with your application. There is of course a standard add-on available, see asCScriptString in the add-on folder.

And this looks to me as the best approach for scalability.

Quote:
In the future, when AngelScript is feature complete, I may make a little brother to the library. It would cut out a lot of the features that are not exactly necessary, such as the for-loop, switch statement, classes, support for native calling conventions, object operator overloads, compound assignments, etc. This will likely cut down library size by a lot.

Better thinking I am much more scared by eventual speed slowdowns in further versions rather than the bigger code size; however if the basic internal structure keeps unchanged, the slowdowns should be irrelevant.

Quote:
...but I know there is even more performance that can be squeezed out of it and I intend to do that when I get the time.

This looks very interesting...

Quote:
Don't forget that AngelScript is still under heavy development, whereas Lua is already complete (although some improvement continues to be made). This too has it's advantages and disadvantages. An advantage is that you can influence the development of AngelScript

I would be happy to influence! I will send my comments as soon as I integrate and use it (within 3 months :-( )

Quote:
... a disadvantage is that sometimes you'll have to rework your code to adapt to changes. I try to minimize the latter, but it has happened before, and it may happen again.

No problem, I would be happy to rework all the code to fit the changes if the performance is priviledged with new versions. I like small and fast programs as you can deduce... ;-)

Quote:
No one can tell you what library to use, at least not without knowing the exact needs you have.

Still, I hope that you'll go with AngelScript. :)

I am planning to use it for AI scripting, and I already made my choice ;-)

Share this post


Link to post
Share on other sites
if this can help you, i've search for days which were the best scripting engine that i could embed in my programs for exposing my main core objects outside of the real application and not recompile it every time i make small changes to its logic. i've come up with python, lua, gamemonkey and angelscript.
the first is a very big bloated engine, with a lot of classes, well tested and used in lot of commercial games out there, fast and complete. the drawback is the complexity of making it linking against your code, and you finally end duplicating your functions twice making a lot of wrappers for let the engine understand your objects and functions. also i don't like it's coding syntax.
lua and gamemonkey have a similar syntax, all is table based, and you don't get strong type checking when writing scripts, so is really unsafe for my usage. they have a lot of tools to easily make functions and classes exposed top the scripts, but you will sure end of duplicating and making wrapper functions everywhere (using gmBind for gamemonkey, for example, seems to save you a lot of work... but when the complexity of the objects starts to grow, i finally gave up because i was creating table objects in every functions, and the size of the wrapper object was bigger than the original class !).
then i tried angelscript. and hey! i deleted forever the other directories, and keep that. i'm sure i can't go back. it's easy to use, easy to understand when u came into it, fast enough for my purposes, type checked (finally!), supports operator and behaviours on objects, and the better thing it have is the easy ability to let you publish functions and objects without rewriting the whole, but only a minimal part of them. this is gr8. when something like hundreds of objects mutually interacting each other, and want to publish them to be used by a script, u can't write a wrapper class for every class and method of them.
andreas tell us that it is under heavy development, but he is here and he is expecting support, feedback, problem reports and todo suggestions that he will listen to and accept if they're good for the grow of the library.
in the other libraries you don't have this "human touch".
anyway i can tell for sure that angelscript is llllllot better than any other scripting library you can find around, even if there is improvements! (think when it will be improved what it can be!)

Share this post


Link to post
Share on other sites
Quote:
Original post by kunitoki
andreas tell us that it is under heavy development, but he is here and he is expecting support, feedback, problem reports and todo suggestions that he will listen to and accept if they're good for the grow of the library.
in the other libraries you don't have this "human touch".

yeah, I got some difficulties finding certain informations about other libraries, and indeed Andreas is a really really kind guy...it's a pity I cannot contribute actively at the moment because I have to focus on other parts of my game development project, but I promise that when it will come the moment, I will creatively comment about the AngelScript engine I will be using.
Quote:
anyway i can tell for sure that angelscript is llllllot better than any other scripting library you can find around, even if there is improvements! (think when it will be improved what it can be!)

Already 2 thumbs up for AngelScript then!





[Edited by - legolas558 on March 30, 2006 6:49:48 AM]

Share this post


Link to post
Share on other sites

This topic is 4280 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this