If you want to help us maintaining this wiki, check out our discord server: https://discord.gg/3u69jMa
Writing Native Code
Jump to navigation
Jump to search
Resources
Unreal Tournament headers modified to be as compatible as possible with RC.
Native coding example that implements the game's main loop and adds useful features like a framerate cap that can be set using a new custom console command ("SetRefreshrate") and error handling using Message boxes that show the stack trace in case of a crash. Also have a look at Republic Commando UCC
Introduction
Getting Started
Code
This code assumes that the folders with the headers for Core and Engine are in the same directory as the source file
//Linking the import libraries for Core.dll and Engine.dll so that functions from these libraries can be called
#pragma comment(lib, "Core/lib/Core.lib")
#pragma comment(lib, "Engine/lib/Engine.lib")
//Includes the headers for core and engine
#include "Engine/Inc/Engine.h"
//This function is going to replace appInit from UnFile.h and thus needs to have the same signature
__declspec(dllexport) void testFunc(const char* InPackage, const char* InCmdLine, FOutputDevice* InLog, FOutputDeviceError* InError,
FFeedbackContext* InWarn, FConfigCache*(*ConfigFactory)(), int RequireConfig){
const char* newCmdLine = "-windowed -log abcdefg 12345";
InLog->Logf("Replacing command line with %s", newCmdLine);
appInit(InPackage, newCmdLine, InLog, InError, InWarn, ConfigFactory, RequireConfig);
}