lua-users home
lua-l archive

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


Hey, i posted this question a few weeks ago on the forum, but received
no answer yet.
Now im trying the mailing list. Sorry for the duplication...

I want to make a computer game using lua for AI. The user should be
permitted to modify
the AI of the units under his command. The communication between
different units however
shall be restricted, thus, i want to provide an Api for communication.

If i have the AI as a whole running in one single lua instance, the
user could easily avoid the
communication api and the restrictions i would like to implement with
global variables in lua.

The first idea was to have a lua instance for every single unit,
making it impossible to
communicate without the api. This would probably even simplify the
programming model.

My questions now is: how efficient is this solution? How does it scale?
Is this approach still sound, when the user controls severel hundred
or maybe even
thousends of units, all with there own lua instance to be evaluated every frame?

What is generally done in computer games concerning this problem?
(Even if the user
is not permitted to modify the AI)