Topic: Suggestion: lua-behaviors

I suggest a new type of behavior.

In common, behavior is

  1. variables + type

  2. update procedure

It can be realized in lua

// behavior_lookat.lua
// pseudo-code
behavior_lookat.vars = {var => type}
behavior_lookat.object_depended_vars = {}
behavior_lookat.update = <function code here>

In editor add lua-behavior by filename.
Editor parse vars-table and show var-list.
Editor values stored in object_depended_vars-table with object-name as table-index.

In main loop

  1. get next object lua-behavior

  2. get object name

  3. execute <behavior_name>.update with vars from object_depended_vars.objectName-table

The lua function list is short, so lua-beheviors will be scant. But it's simple way to extend engine wink
What do you think about this?

Example: if we want to create FPS then add player, head and camera on scene, add behavior_controllerFPS.lua to player-object, define vars "head" and "camera".  This is all you need to do.

Last edited by Aikon (2013-12-18 21:04:55)