Follow-up Comment #4, patch #1432 (project wesnoth):

Second version of the patch.

I use two types of objects for LuaAI. both are c++ objects which reference a
compiled lua function stored in a lua table.

First type of object is 'lua_ai_context' - it is 1-per-AI object which will
be directly used and/or extended by the AI creator as the 'interface' to the
AI.

Second type of object is 'lua_ai_action_handler' - it's purpose is to be a
proxy around lua code inside an ai component. Upon execution,
lua_ai_action_handlers get a 'lua_ai_context' as an argument.

as you see, the interface for the AI creator is much cleaner (and more, it
can be customized/extended by the AI creator as the interface itself is
written in lua - except for the actual hook to 'ai_execute_move' function
which should not be used by the AI creator directly)

P.S.: as I don't know the area very well, I might had done something stupid
while implementing, so I'm asking you to check it out.

(file #8102)
    _______________________________________________________

Additional Item Attachment:

File name: lua_ai_2010_Feb_15.patch       Size:13 KB


    _______________________________________________________

Reply to this item at:

  <http://gna.org/patch/?1432>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs

Reply via email to