lua-users home
lua-l archive

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


Hi all.
	Like I've said i think it could be a good thing if we can
exchange informations or experience on our vision of the integration of
Lua in a C/C++ application. I'm OK all depend of what you want to do
with Lua but here my goal is to analyse all the aspect of Lua in
performance dependant environnement. Like you've probably read, I'm
making a little game to experiment Lua before integrate it in a network
security tool. 
	Why I take this way ? Simply for to reason :
	1°. Me and my friend want to have a game in where we can build
scripted IA to fight on a battleground. For this my "game" will focuse
around the universe of Warhammer 40.000 ;
	2°. Simply because I think game are the most difficult
application to build if we consider performance aspect : the smallest
performance problem will appear automtically to the user in contrario to
other application. But this is true : it's really more complicated to
develop.


	Well to initiate this discussion I wan't to present you my first
scripting architecture that I plan to test. I hope that I can have many
reply about it.

------------------------------------------------------------------------
----------------
A multiple Virtual Machine architecture :

  1°. A VM by script :
    My goal is to control multiple entities trought Lua scripts making a
script by entity and
allowing the fact that multiple entity can share the same script. In my
application I'll have a 
ScriptManager that will handle the initialisation of each script and
assoicate the correct one 
to the correct entity. At each UpdateScript Event I'll call the entity
script's main function to make 
it evolve.
   I know that some people use a unique Lua VM for multiple entity : for
the moment I haven't analyse 
this way to do. The main reason of this use is - for my point of view -
that allow scripted entity to 
communicate throught the Lua stack. Personnaly I want to make my heart
application the more 
independant possible from the scriting system (I want to reduce to the
minimum the presence of 
Lua (or other script system) in my code forcing me to make something
really modular. To make my 
communication I think to an external communication system using queue
list with specific message 
structure in it.
   My host API will export to Lua all needed fonction (getting position,
orientation, caracteristic, 
... The script will contain a unique entry point to facilitate the
script update by after this 
The script programmer can be able to build it's own IA system.
   For the moment I plan to update all my scripted entity a number of
time per second but i don't think 
this is the better way to do so I think to link this to the message
queue used as a communication system
between each game element.
------------------------------------------------------------------------
----------------	

   I want to have your ideas and point of view about this things. What
are the bad point that I've miss 
(sorry I'm a beginner in this ;) ).
   What do you thing about the multiple VM usage ? 
   What do you have to say about my update method.

   I've tons of things that are not in my line of sight for the moment
like how to implement triggers, events, 
... I know that my communication system will reatly help for this ;) but
it's a littlely obscur right now.

Hope that I'll receive news from you soon. Sorry for the size of this
mail but script integration is really a point 
of interest for me (like it's for u I think).
In all case good day to all of you ... Hope to see you soon.

PS : I think I'll put all this discussion on my web site (if a
discussion follow ;) ) with - when somethink will work
source code of my exemple.