• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

Current usage of Eluna Lua Engine

vibe

Member
Hi guys,

I'm a software engineer, currently with zero experience in the wow emulation scene.

I have a couple of questions about Eluna, hope you could answer them...

From what i've read, i'm guessing it's possible to implement with Eluna almost everything (creature/npc behavior, event hooks, etc.).

Why is that, people continue to prefer scripting quests/dungeons/raids with SD2/EventAI than Eluna?

Isn't it easier to maintain Eluna scripts than SQL scripts?

Would there be any performance issues related to massively use Eluna scripts?

Thanks in advance.
 
Last edited:

Rochet2

Moderator / Eluna Dev
Hi guys,
I'm a software engineer, currently with zero experience in the wow emulation scene.
Hi. For the reason you are here I can only assume you have played wow then..

From what i've read, i'm guessing it's possible to implement with Eluna almost everything (creature/npc behavior, event hooks, etc.).
Why is that, people continue to prefer scripting quests/dungeons/raids with SD2/EventAI than Eluna?
Isn't it easier to maintain Eluna scripts than SQL scripts?
Anything possible by default - no. Possible to do a lot - probably.
There are many reasons for and against.

Lua may be easier to grasp than C++ and it can prevent crashing on badly written scripts.
It can be easy to come up, develop and/or test a concept in lua.
I know that some have implemented things in lua and later if there are performance issues they can convert them to C++.
Its sometimes not about performance and more about making something to show.
There are actually quite many that do use Eluna. You can see ppl asking for help pretty often and some tell that "you can do this with Eluna" when someone asks how to do something.

C++ is faster and more flexible because C++ has access to all of the API while Eluna does not.
However I can not say if this is the same in SD2. It seems that you are somewhat familiar with MaNGOS.
Eluna is a 3rd party addition to cMaNGOS and TrinityCore. For (most) MaNGOS it is integrated by default.
Usually ppl tend to steer clear of any 3rd party things. People might not know lua and SQL may be easier.
Eluna is relatively new and it may lack some features or convenience that is available to C++ or SAI/EventAI or some other system.
For example if you want a player to have an aura in an area, you dont do it in C++, Eluna or SAI/EAI - you do it through spell_area DB table.

I myself prefer C++ for a lot of things. One due to typesafety, second for the fact that the code can be run on base emulator, third for the core modifications I may need to do or the API I need to access in order to do something that is not possible on Eluna or SAI/EAI.
For SAI/EAI I also prefer to do some things for the fact that it works with the base emulator and it can be more easily doable due to some convenient events or actions available.
Something I do in lua is test scripts or things I want to make in C++. Testing stuff in C++ takes time and restarting server or reloading the script engine is a lot faster.
Sometimes making a script in lua can also be easier and faster, depending on the script. For example a teleporter is way easier to do than in SQL or C++. And later you can tweak it easier also.
For such scripts a scripting language feels more natural way to do it.

Would there be any performance issues related to massively use Eluna scripts?
Something will be the bottleneck at some point. Depending on what you do, it might be Eluna, might be something else.
However to say something about performance:
The impact of the system overall on the server when running a lot of (possibly trivial light weight) scripts has not been tested, though we do appreciate any feedback on that.
We have worked quite a lot on making the check for if an event exists for an event that just occurred to be fast to get rid of some overhead.
Eluna does not allow you to use more than one map update thread (which is the default).
Though lua is slower than C++ lua is still a fast scripting language.

Thanks in advance.
Never thank in advance. : )


Eluna is being slowly developed in different directions.
I myself have been developing a version that would allow the use of multiple threads without locking and would allow better creature and instance scripting capabilities.
However these features come with costs. For one the API and other behavior can change in places drastically. Also some hooks and functionality is lost.
People seem to keep seeking for more functionality to implement completely new systems in lua rather than making AI scripts and similar, something which would not be that much possible on the version I have worked on.
 
Last edited:

vibe

Member
Wow, thanks for that detailed answer.

Thing is, with eluna scripts it would be write once, run everywhere, across the server cores that eluna supports ofc.

From what i've read, implementing creature behavior using SD2/3, EventAI, SAI is messy. I just don't like those sql scripts...

I was asking these questions because i have a desire to contribute (mainly cmangos), the easiest way would be have been by developing eluna scripts.
 

Tommy

Founder
From what i've read, implementing creature behavior using SD2/3, EventAI, SAI is messy. I just don't like those sql scripts...

Most people can't grasp EventAI or SAI like they can Lua (or maybe C++). Not sure why, might be because people don't normally use those tables. Messy? That's possible since it is all bunched up in their respective tables, but they do serve a purpose - they are mostly used for simple creatures in the world that you wouldn't normally script in Lua or C++. For example; if a creature casts only one spell.
 
Top