lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Dibyendu Majumdar <>于2017年2月22日周三 上午5:12写道:
I am not a games programmer and do not know whether interpreted Lua is
good enough in this case.

I have been a game programmer for 20 years, and use lua since 4.0 . I think lua is good enough for game project because it's easy to embed to game engine. We need a flexible dynamic language for  gameplay  and GUI , and the performance only exists in game engine, which is written by C or C++.   I remember that I have tried to embed lua, python, _javascript_ to my game engine for my first MMORPG project in 2001. lua is the best choice, because its less memory overhead, and we can easily manipulate the memory usage (We should run the game client in 64M Ram).
In my opinion, having worked on Ravi and in my usage of it, Lua is not
a general purpose language that you would use to build a large scale
application. This is not because of any deficiency in Lua, it is more
that large scale development is better done in statically typed
languages like Java, C#, Go, Swift etc. The cost of developing complex
applications in a dynamic language is just too high. I know that many
folks on this list will probably disagree with this view, but leaving
aside your love for Lua and your wish to use Lua everywhere, would you
still use Lua as a general purpose application development platform?

We now use lua both in game client and server. For our game server, there are about 10K C loc ( for the framework , and more than 100K lua loc for gameplay. 

For mmo game server, Lua is still the best choice rather than go,erlang, python or nodejs because we choose the actor model for the game server framework like erlang. We can run thousands lua vm in one process that python can't (because of GIL). LuaJIT is not suitable too because of 2G memory limit. I think our framework (skynet) has better performance than nodejs even nodejs use v8 JIT, because skynet can use all the cpu cores. I have tried luaJIT for my framework , only 10%~15% performance improvements.

And coroutine in lua can be a better solution for asynchronous programming than callback model in nodejs.

I agree lua is not suitable for large program, but a large scale application can be build with many small parts. We can run many lua vm in one process like skynet does.