Archive for July, 2008


Posted by Data in Cortex Command - July 28th, 2008

Area EditorAfter many months of work and preparation, we are finally ready to start creating the real campaign missions! There were several large hurdles that needed to be cleared before we could proceed with this, including:

  • Exposing almost all of the C++ engine to Lua, using LuaBind.
  • Adding a powerful in-game console for testing and debugging scripts.
  • Making the game Activites’ logic be completely driven by Lua scripts.
  • A new and flexible data-driven system of trigger “Areas” in each Scene, which the scripts can hook into.
  • Making a completely new in-game editor for defining and naming the Areas of each Scene: The Area Editor —->.

The scripting of Activities is super important; before their logic could only be hardcoded in C++. That meant the whole executable had to be recompiled each time a change was made to the winning condition or whatever of a specific mission. Now, the script can be edited (by you!) while the game is running, and it is just reloaded automatically when Ctrl+R is pressed. Any errors encountered in the script will be reported to the in-game console, with line numbers and decent descriptions.

Here’s an example of how the Areas tie into the scripts. This snippet of Lua in your script’s UpdateActivity() function will cause any Actor that wanders into a specific Area named “Kill Zone” to be instagibbed:

for actor in MovableMan.Actors do if SceneMan.Scene:WithinArea("Kill Zone", actor.Pos) then actor:GibThis(); end; end;

We are also working on the online documentation for all of CC’s Lua interface – more on that later!