©2004,2008 Jim E. Brooks http://www.palomino3d.org
[2008/09]
See also lua module.
The simulator is implemented as a mixture of C++ and Lua code. The core of the simulator is written in C++. The high-level (missions, game logic, etc) is written in Lua. In client/server terms, C++ is the server, while Lua is the client.
Partitioning of C++ and Lua varies by area. Lua is fully responsible for mission setup and defining a scene. By contrast, game logic is a mixture of Lua and C++.
[2008/10]
Summary of functionality partitioned across C++ and Lua:
Only the C++ core is independent.
All Lua code depends on the C++ core in one way or another.
C++:
Lua:
Mixture of C++ and Lua:
Of the Lua functionality, the most complex is the game logic.
[2008/09]
[2008/09]
Defines the Player and Friends.
Dequeue and execute commands from the simulator's command queue.
Definitions, constants.
Lua classes can define events to be broadcast to registered listeners.
Game class. C++ has a Game class too that implements much of the game logic.
Graphics-related classes (Vec3, RGBA etc) and functions.
Lua is responsible for updating the "slow HUD" (low-frequency tick). For example, Lua is what causes "STALL" and "[PAUSED]" to be displayed. The C++ classes Hud and Game are involved in rendering the HUD.
Lua responds to keyboard input (C++ responds to joystick input).
General Lua functions.
Scripts for specific missions.
Wraps underlying C++ Replay class.
Defines the scene graph. scene.lua has a function that populates the scene-graph by reading a Lua table from a specific scene_*.lua script.
Bindings to many exported C++ classes. Some Lua classes extend the functionality of their underlying C++ class.
The main script.
Lua scripting is timer-driven.
Classes such as SuperView, ChaseView. View/window functions.
Last modified: Wed Oct 1 20:59:20 EDT 2008