-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement a lua scripting api #146
base: master
Are you sure you want to change the base?
Conversation
This is great stuff! Personally, I've been waiting for this (: |
3bcf909
to
1c209e9
Compare
Hmm, quite a bit of the engine internals are pretty static, stuff like the item list and such. Not bad of course, just not as flexible as I'd like for an API like this. I'm probably gonna be changing around how some of those internals work, stuff like storing item IDs in the database and other stuff like that. Just letting y'all know! Post here if you have any questions or tips. |
Why in all the games to develop mods using Lua, but not for example JavaScript? As for me, JS much clearer. |
Lua makes it extremely simple to link to native C code, and the package itself has been well-proven in many commercial and open-source games and application. Lua is also a nice, very small, self-contained package and it has a great license for linking into almost anything. I haven't seen many other scripting languages able to take the place of it and have most of those features, unfortunately! |
When I looked into lua (for example in minetest project), I didn't find any communication of files in uniform structure - files were simply scattered and worked using black magic. Is the BSD 3-Clause license compatible with Craft's license? If so, Google's V8 JS Engine may be good choice. Also I have many experience with linking JavaScript with C++ code via Qt, I think it will not very hard to implement using V8, but I can be mistaken |
I come from the JavaScript world and I am reasonably experienced in JavaScript development. but even though – personally –, i'd love to have a JavaScript scripting API, I think this is a bad idea. This may be a sketchy observation, but the game 0 A.D., which is huge and years in development now, has big performance problems using a JavaScript modding system! They also had big trouble upgrading their JevaScript engine (which is from Mozilla, think V8 is similar in this aspect). Again, I'm not an expert in this topic, but from what I read and from my general experience with JavaScript regarding speed and the compatibility with C(++) games, I highly recommend using Lua. As far as i know, Lua has been designed to be used as a scripting language for modding. It has been designed for performance and, technically, is closer to C++ than JavaScript. Lua is used in many famous games and apps, like the CryEngine, Adobe Lightroom, Unreal Engine and idTech engine. Please do a bit more research before deciding which scripting language to use. I think this Minecraft has a huge potential, given that Minecraft is closed source, now bought by Microsoft and pretty slow (in terms of performance). It would be bad if someone made a decision too quickly. |
Have you already seen the Lua about page? |
Ok, you overpersuaded me. I Google'd and found LOOP - Lua OOP library, it seems to me has more clear syntax of class defenition and inheritance. It very close to C++. |
@maksimkurb You can give MoonScript a try, which also has clear syntax and OOP support. |
What a lovely syntax (: |
Moonscript looks really interesting. Unfortunately I've not been able to do much work on this recently because of my job and other projects, but I'll definitely keep an eye on it moving forward. Thanks for pointing it out, @wenLiangcan ! |
NOTE: This is NOT yet ready to merge, I'm just creating a PR to get feedback!
Basically, it's an attempt at a scripting API. Should help other people get involved more easily, as well as creating more advanced things that are easier to express in a higher-level language (NPCs maybe?).
Most of the code in this PR is libraries being added, specifically Lua and (SGLib)[http://sglib.sourceforge.net] to provide linked lists and other general data structures. I've not done much proper C development, so I don't know what's 'standard' for that sort of thing, but SGLib got me out of trouble.
I've also not tested the Windows code at all, so that's probably broken.
But I think it could be useful eventually!