Why aren't mods in C++?
So I've been reading through the forum, and here are some of the claims people have made:
Why Lua instead of C++?
Why C++ instead of Lua?
Are there any other plausible options?
Your Answers:
- C++ is better suited than Lua for things like mobs.
- Lua is good enough--for adding nodes and items.
- Everything else is slow or inconvenient.
Why Lua instead of C++?
Why C++ instead of Lua?
Are there any other plausible options?
Your Answers:
benrob0329 wrote:If mods were written in C++, you would have to compile every one of them, increasing the startup time. Also, C++ apps can mess things up more than Lua scripts. [...]
duane wrote:[...] Part of the reason why any higher-level language runs faster is that it's more convenient. I hate working with C because I have to spend much more time thinking about how to store data and free up memory afterward. I have to spend more time testing. Lua gives you easy to use list structures that never write over the rest of your program. Convenience and safety take extra time. [...]
Ferk wrote:[...] I guess the only one who can really answer your questions is celeron55 since it was his choice. But C++ / Lua seems like a good combination to me. C++ is a popular well known low level language and Lua is a simple, easy to learn high level extension language.
SegFault22 wrote:[...] There are tasks for which Lua is the most efficient option, but things like AI mob entities and power/data/item/fluid transmission are definitely not examples. Lua could be very efficient for registering items, nodes, AI mob entities and nodes which conduct transmission of power/data/items/fluids; but it would be very inefficient to use Lua for implementing the functionality of those things, because it would end up being just too slow and very hackish in nature.
JSwigart wrote:[...] Encouraging engine patching might make sense for some things, but I think doing so also has the drawback that the engine then becomes specialized to a specific way of doing things, and with it the limitations of those chosen approaches, with little ability to mod outside the box so to speak. As a core mod, there could be multiple solutions to different problems. [...]
domtron vox wrote:Ferk wrote:[...] You can already patch the engine if you wanted. It's open source.. if you want to code an AI in C++ that can be enabled from within Lua you can just write it in the current engine codebase.. [...]
[...] there is *always* politics when trying to get a PR accepted: someone doesn't like the way you did it, another person says it breaks compatibility so shouldn't be added, ect. This like you said causes forks which is ok, but that makes the features less accessible to the "masses" and harder to find. [...]