API Implementations

At the time of writing there are 2 implementations of the Shard API:

  • spring_native – Uses the LuaAI Gadget API
  • spring_lua – Uses the Shard native C++ API

The spring_lua API is feature complete at the time of writing, and the spring_native API is partially completed.

When the AI object is loaded, the ai.lua file will attempt to load preload/api.lua, which loads the relevant API, and other important files, such as hooks.lua, class.lua, and aibase.lua. Then, depending on several environment checks, the implementation is loaded from a subfolder.

Each implementation sits in its respective subfolder, and contains a file for each major object type:

  • unit.lua
  • game.lua
  • map.lua

Each of which provides an implementation for that respective unit type, along with an implementation for a conversion function. The conversion functions converts the native unit object to a Shard friendly one ( that can be passed into the main AI object )