5 ms·
C/C++/C# are indeed often used for game programming but when it comes to gameplay logic scripting there's a lot more options. Lua, blueprint, lisp, angelscript,
by ClimaxGravely 4y ago
C/C++/C# are indeed often used for game programming but when it comes to gameplay logic scripting there's a lot more options. Lua, blueprint, lisp, angelscript, unity's graph language etc..
- paulddraper 4y agoYeah, Lua is super common. Not exactly sure why, but it really is.
- codebje 4y agoLua is super common because it's super easy to embed into a C(++) project.
- Yoric 4y agoIf I remember correctly, one of the main original reasons was that it was super easy to embed.
- paulddraper 4y agoIsn't that true of Python as well?
- camgunz 4y agoLong ago I evaluated a few scripting languages to add to a Doom engine, I think I considered Ruby, Lua, Python, JavaScript, and Squirrel. I ended up choosing Lua because: - easy to embed - good ecosystem (in particular needed Lua GObject Introspection for pangocairo) - usable from C (not just C++) - not white space sensitive - skills translate to programming in the large - it's fast A lot of games let you write little snippets of code or what have you in a console or text box. Python is really bad at handling that because of its whitespace sensitivity. It's also the slowest popular language by far.
- pbhjpbhj 4y agoAs a non-programmer: when you say slowest, do you mean most verbose? Or, most runtime overhead? Or, something else?
- camgunz 4y agoRuntime; there are things you can do, but generally Python takes more time and memory to do things than other languages/platforms. It got better in 3.11 but AFAIK it's still the slowest.
- piva00 4y agoSlowest in runtime performance I'd guess as the CPython runtime isn't really known for its performance. Other projects such as PyPy implement a much faster interpreter/JIT compiler but there are some compatibility quirks to use them.
- david2ndaccount 4y agoIt’s not super difficult to embed python, but it ain’t easy. It is also very slow and insists on stat’ing a million files all over the disk when starting up. It’s also hard to stop python code from doing things it really shouldn’t, like calling os._exit. Oh, you also have to deal with linking against the right crt on windows.
- ClimaxGravely 4y agoI think that's definitely the reason from my talks with the engine programmers who added lua support to our bespoke engines. Lua binding is quite easy.
- JonChesterfield 4y agoIt's ridiculously easy to code in. Lua started out life as a simple language for extending larger projects and then repeatedly broke backwards compatibility to make the language simpler. For example it's lexically scoped now but it wasn't to begin with. Contrast with python, which started out life as a simple beginner friendly language, then added lots of complexity, then had the totally botched transition from 2.7 to 3 and is now growing a static type system. Lua is also very easy to embed in other systems. Like sqlite.c levels of easy to embed.
- munificent 4y agoA few reasons: 1. Extremely permissive license. 2. Very simple embedding API. 3. Fairly efficient for a scripting language. 4. Simple and relatively easy to learn.