[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Can Lua be used to write a AAA video game?
- From: Mark Feldman <mfeldman@...>
- Date: Mon, 15 Feb 2010 11:07:43 +1100
Enrico Colombini wrote:
Not bad at all. On the Nintendo DS, I was limited to a few calls per
frame :-)
Out of curiosity, where did you put the Lua/C(++) boundary? What did
the frame loop look like? (if you can talk about it)
I work for Infinite Interactive and we develop all of our games in Lua,
although our titles are more "A" than "AAA" (Puzzle Quest is one of
ours). Our main loop and engine technology is all C++, with some MIPS
asm thrown in for fun, but the game code is all Lua (i.e. the game teams
implement _G.OnTick, _G.OnDraw etc which then get called each frame).
Getting Lua to run well on low-end hardware can be tricky as the VM
tends to hammer the cache lines pretty hard, especially on something
like a PSP which has a crap bus architecture to begin with. I've done
some preliminary experiments converting Lua to C by running the raw
op-codes through a processor and substituting each one with the
equivelent instructions from luaV_execute...idea being that you
eliminate loop mechanics and disruptions to the pipeline from branching
and you also take advantage of the C++ compiler optimizing away the work
of extracting fields from the op-codes. If you're doing a lot of table
look-ups then obviously you don't get that much of a performance
improvement but for everything else the results have been suprisingly
promising, with an overall 50% performance increase to the routines I've
tested it on.
Mark Feldman
This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect.