3 ms·
Lua is indeed widely used in games. The plus is that it's a very simple language to pickup and anyone on the team can learn to use it. The downside is that anyo
by forrestthewoods 15y ago
Lua is indeed widely used in games. The plus is that it's a very simple language to pickup and anyone on the team can learn to use it. The downside is that anyone on the team can use it. :) Memory is an extremely rare commodity in embedded systems and Lua loves to gobble it up.
Consistent perf in video games is crucial and the Lua garbage collector can be brutal in this regard. Newer versions of Lua support incremental garbage collection but it's quite realistic to dedicate 2-3 milliseconds of every frame to garbage collection. Yuck. (16ms = 60fps, 33ms = 30fps)
Lua is trivial to implement into an existing engine. Lots of iOS engines heavily rely on Lua. Large games devs don't want to become reliant on those middleware engines. It can take them many months to update to latest iOS sdk. It took several popular engines 6+ months to integrate the in-app purchase SDK update.
Havok, owned by Intel, purchased Kore and turned it into Havok Script. Havok Script is a virtual machine that runs a "Lua compatible" language. It is extremely fast. Ridiculously faster than straight Lua. It also has full debugging support and you can trivially step through a call stack that bounces between C++ and script. Havok middleware is not known for being cheap.
- pjin 15y agoluajit2 in interpreter mode is also very fast, originally written in x86 (Mike Pall has probably finished the arm port by now). But I've never heard of any benchmarks between the luajit2 interpreter v. havokVM, that would be interesting to see.
- tomlu 15y agoKeep your eyes peeled for a port of the LuaJIT interpreter to the consoles. From recollection it's two or three times faster than straight Lua.