[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Update the Lua engine in Lua-scripted games with LuaJIT
- From: Johnson Lin <arch.jslin@...>
- Date: Tue, 26 Oct 2010 02:52:54 +0800
On Tue, Oct 26, 2010 at 1:07 AM, Johnson Lin <arch.jslin@gmail.com> wrote:
> On Tue, Oct 26, 2010 at 12:55 AM, Mike Pall <mikelu-1010@mike.de> wrote:
>> Errm ... if Civ5 doesn't use luaL_openlibs() then the jit.*
>> library may not be loaded and the JIT compiler is not enabled.
>> For LuaJIT 1.x this means you end up with plain Lua. :-)
>>
>> If this allows you to run your own Lua scripts, then try printing
>> the version, e.g.: print(jit.version)
>>
>> --Mike
>
> I yet to experiment if I can print anything to console in Civ5's lua environment,
> but a quick dependency walking shows that it did use luaL_openlibs() to do something,
> no luaopen_xxx is used. Guess that's a good sign.. : p
>
Yep, good thing that Civ5 has a SDK in the public and it includes a
Lua console! Shows every state in a game and at least it can call
print(). LuaJIT 1.1.6's JIT compiler was successfully loaded.
print(jit.version) showed "LuaJIT 1.1.6" to the console.
To my knowledge, the biggest performance threshold in a modern game
comes from 3D rendering, and although all GUIs in Civ5 were scripted
in Lua, but most GUIs in the game are static, which are not the same
with GUIs in World of Warcraft that UI modders are doing crazy things
with. But AI movements and game flow in Civ5 are pretty much handled
in Lua, so I think the process between the points where a player hits
"End Turn" and where AIs have done all their stuffs, giving control
back to the player, would benefit most by the extra power LuaJIT
offers. However, I don't expect it to be much improved though, since
3D rendering never stops. I can only set the game option to ignore AI
animations. Now I just have to see if ordinary benchmark methods would
work. The Lua console in Civ5 SDK does have methods like os.clock().