I am working on a project where I want users to be able to modify and customize as much as possible.
Open source might be a good choice but not due to the fact that I want to keep a few internal classes closed.
Two other options that I thought about were plug-ins as external libraries and Lua scripting.
The problem with libraries (DLLs) are that cross-platform compatibility is a must-have because it is some kind of a game server and it is mainly designed for use on dedicated servers (often Linux) yet many people will also use it on their local machine (mostly Windows).
Due to the fact that it's a game server application that should be able to handle lo开发者_开发问答ts of connections and actions related to the game performance is very important so I have doubts with Lua scripts.
Are my doubts reasonable or would Lua be a good solution? Also can you think of any better / other option for my concern?
To sum up the important aspects:
- cross-platform compatibility
- good performance (-> online game)
- plug-ins / scripts that anyone can create as long as he/she knows about the language, may it be Lua, C or whatever
- option for closed source plug-ins / scripts (not so important, but would be fine :)
I'm afraid the only one who can answer if Lua will be fast enough for you is... you. We have no idea what exactly are you doing and how are you implementing it. My suggestion is to prototype and measure. Write a small, but relevant, part of your system in both Lua and C/C++, measure the performance of both and decide if Lua is fast enough. Having WoW as a case study, Lua seems to be fast enough for the client/UI part of the game, but I cannot say anything about the server. But anyway, I doubt there's language out there that's faster and easily embeddable compared to Lua (disclaimer: I haven't measured Lua performance myself, especially not against other similar languages, so take this with a grain of salt)
You mention something about DLLs not being cross-platform, so just FYI: if you want to use DLLs for plugins and load them dynamically, the same functionality exists on Linux. The "DLLs" are called "shared libraries" or "shared objects" and usually go by the extension of .so. And instead of the windows LoadLibrary, GetProcAddress and FreeLibrary, there are dlopen, dlsym and dlclose.
There's nothing to stop you providing different licensing for the different modules in your application, obviously that precludes using GPL 3 as that would immediately cover everything.
Have you ever thought of AngelScript? I don't know much about it either but it seems to have a C++ like syntax and is pretty flexible and extremely cross-platform.
精彩评论