lua-users home
lua-l archive

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


> I'm a software engineer for a video game company. We currently need a
> scripting language to control various parts of our next generation of
> games (AI, SFX, animation, GUI, ...). Oour original plan was to write
> our own compiler + VM (i have written some in the past so it's not an
> unfamiliar territory for me).

I have exactly the same problem. Why reinvent the wheel? Spend all that
extra time on gameplay and improving other code. As you must know the
overhead of designing and coding a language is fairly large. Yadda, yadda,
yadda it's all be said before on here. :-)

Benchmarks for Lua and a few other languages:
http://www.chat.net/~jeske/Projects/ScriptPerf/

> * Lua being dynamicly typed, i can see the advantages especialy
> considering some of the code might be written by non programmers.
> However, since type determination is moved from the compiler to the
> VM, what is the actual runtime cost of dynamic types?

I'm not sure that its a problem at all. You should worry more about garbage
collection.

> * Lua can be extended through function calls. Unfortunateley, this
> implies writing a stub function to grab the parameters from the Lua
> stack and call the actual function (this is pretty much the same
> thing i did with a VM i did, except it could also call functions in
> objects in C++). Now, i'v heard mentioned somewhere in the mailing
> list there was a more efficient way of extending Lua. Is that so? And
> how?

If you use Lua 3.2 (and you probably should until 4.0b goes final judging by
the nb of bug reports and the lack of toLua yet) you can use toLua. There is
somewhere a module for SWIG I believe. All the code for generating your
wrapper with toLua is written in Lua so you can customise it.

> * Since our next generation game engine will work on a limited set of
> platforms (PC, Playstation 2, X-Box). How hard would it be to write
> optimized versions of the VM for such different plateforms?

Not sure you'd need to. Classically, if your script isnt working fast enough
you profile it and move more of the code into C/C++. Using any embedded
script efficiently is about drawing the interface line correctly.

> Sebastien St-Laurent
> Z-Axis ltd.
> www.z-axis.com

I like the web site. Space Inavders looks great. Are you still in San
Mateo???

Nick