Game Development Reference
In-Depth Information
Utility classes
AI sandbox heavily uses the utility pattern to separate logic and data. While both the sand-
box and agent classes store their own relevant data, any manipulation of the data that in-
teracts with the Lua virtual machine is handled through a utility class. This design separ-
ates the need for the agent and sandbox classes to know about the intricacies of interacting
with the Lua stack. Instead, the Lua stack manipulation and data manipulation is left as
the responsibility of a utility class.
For example, the AgentUtilities class handles all actions that are performed on an
AI agent from Lua, while the SandboxUtilities class handles all actions that can be
performed on the sandbox from Lua.
Any general purpose or miscellaneous interactions with the Lua virtual machine are
handled by the LuaScriptUtilities class.
Lua binding
The LuaScriptBindings.h header file describes every C++ function that is exposed
to the Lua virtual machine from the sandbox. You can always reference this file as the AI
sandbox application programming interface ( API ). Each function contains a descrip-
tion, function parameters, return values, and examples of how the function should be
called from Lua.
Search WWH ::




Custom Search