TethysAPI is a C++17 library providing access to Outpost 2's public API as well as its internal functions and data, which can be used to create custom missions and mods for the game.
TethysAPI is purely header-only, and does not require linking against any libs to function.
Compared to Outpost2DLL, the public API exposed in TethysAPI has been changed to be more modern and tidier, and with better const-correctness in order to properly support MSVC in C++20 mode. TethysAPI essentially supercedes the Outpost2DLL, HFL/OP2Types, and OP2Internal libraries, although it should not be considered a drop-in replacement for them due to interface changes. TethysAPI can be used alongside these legacy libraries, which is helpful when transitioning an existing project to it.
- Outpost 2 v1.2.7 or newer
- C++17
ATTENTION: TethysAPI is a work in progress. You should expect breaking major interface changes between releases prior to 1.0.
TethysAPI is intended to be added as a Git submodule to projects. It must reside in a subdirectory called Tethys (not "TethysAPI"!)
The public mission API headers are located under the API directory. For your convenience, you may use #include "Tethys/API/API.h" to include all public API headers, but you are also free to include individual headers. Tethys/API/Mission.h documents how to interface a mission with the game.
Headers containing internals, non-exported enums, or non-mission public APIs are located under the other directories:
Gamecontains internal gameplay interfaces.Networkcontains internal networking interfaces.Resourcecontains resource management and graphics rendering interfaces.UIcontains graphical user interface and related interfaces.
The public mission APIs are within the TethysAPI namespace, while everything else is within the Tethys namespace. You may wish to do using namespace TethysAPI and/or using namespace Tethys.
- Change
Create*Trigger()functions to taketriggerFunctionas astd::string_viewinstead of aconst char*. This is a backwards-compatible interface change. - Rename
OnProcessCommandArgstoOnGameCommandArgs - Add
Unit::GetMapObject()template overloads that take aMapIDas a template arg - Add
TethysUtil::AutoDestroy<>template class - Rename
TethysUtil::Span::Data(),Length(), andIsEmpty()todata(),length(), andempty()in preparation to switch to C++20 std::span eventually - Fix
IDirectDrawforward declaration inTApp.h - Add some member function definitions to
ScriptDataBlockandFuncReference - Define vtbl info for
TriggerImplandVictoryConditionImpl - Add post-increment operators for unit iterator types
- Remove decrement operator for
GroupIterator - Remove
Locationoperator+/- overload for scalar integers
- Rework Enumerator interfaces to more closely match
std::iteratorsemantics. - Remove
GroupEnumerator; replace withScGroup::begin()andend(). - Rename
OnLoadArgs,OnUnloadArgs,OnEndArgstoOnLoadMissionArgs,OnUnloadMissionArgs, andUnEndMissionArgs(1.4.2). - Add
OnDamageUnitArgs,OnSaveGameArgs,OnLoadSavedGameArgs(1.4.2). - Add
triggeredByandprevTriggeredByfields toOnTriggerUnitArgs(1.4.2). - Replace
TethysGame::UnsetBlight()withGameMap::UnsetBlight(). - Change
GameMap::GetWidth()to return unpadded width; addGameMap::GetPaddedWidth()to return padded width (oldGetWidth()behavior). - Add
GameMap::SetBulldozed(),CreateScorchMark(),CreateCommonRubble(),CreateRareRubble(). - Add
GameMap::CreateLavaFlow*(),FreezeLavaFlow*()(where * can be SW, S, SE). - Add
TethysUtil::Span, an accessor class for array-like data. - Change various methods in
API/*.hheaders to takestd::string_viewinstead ofconst char*. Other methods are changed to takeTethysUtil::Spaninstead of a pointer and array size. - Change
_Player::GetBuildings(),GetVehicles(),GetBeacons(),GetEntities()to return aPlayerUnitIteratorinstead of aUnit. - Rename
TethysGame::ForceMorale()toForceMoraleLevel(). - Replace references to
Player[i]within TethysAPI itself with_Player::GetInstance(i). - Add
GameImpl::ProcessUnits(). - Rename
MapObject::ProcessForGameCycle()andProcessTimers()toProcessCommands()andProcessActions(). - Add missing
OP2_MO_GET_INSTANCE_IMPL()toProjectileclass. - Add
StreamIO::WriteString(),ReadString(),WriteValue(),ReadValue(), andStreamIOvtbl data. - Add more constructors to
TethysUtil::Library. - Add
OP2Strdup(). - Rename
OP2Class<>::DestroyVirtual()dummy to_DestroyVirtual(). - Add member functions to
TerrainManager. - Add
MapImpl::FindFirstUnitInRange(),FindNextUnitInRange(),DestroyWall(). - Add
VictoryConditionImpl. - Change
TriggerIml::playerVectorHasFired_type frominttoPlayerBitmask. - Change
RecordedTubeWall::cellTypetype frominttoCellType.
- Initial release.