The main.cpp file is located under Generated/main.cpp it contains the entry point of the program and is auto-generated by the UVKBuildTool. Here is an example:

// This is an autogenerated file, touching it is not recommended
#include <Engine.hpp>
#include "Source/StartupLevel.hpp"
#include "Source/GameGameInstance.hpp"
#include <GameFramework/Components/Components.hpp>
#include <WrapperSource/Wrapper.hpp>

int main(int argc, char** argv)
{
    UVK_START(true);
    Wrapper::wbegin();
    UVK::AudioManager manager;

    bool bUsesEditor = false;
#ifndef PRODUCTION
    if (argv[1])
    {
        std::string cmd = argv[1];

        if (cmd == "--editor")
        {
            bUsesEditor = true;
        }
    }
#endif
    auto* st = new UVK::StartupLevel;
    UVK::Utility::getGlobal().getEditor() = bUsesEditor;
    UVK::Utility::getGlobal().currentLevel = st;
    auto* mode = new UVK::GameGameInstance();
    UVK::Utility::getGlobal().instance = mode;
    UVK::UVKGlobal::openLevelInternal("tst", true);
    UVK::Renderer(UVK::Utility::getGlobal().currentLevel, bUsesEditor);
    Wrapper::wend();
}

While below, we have the mainmodded.cpp file used by the moddable game:

// This is an autogenerated file, touching it is not recommended
#include <Engine.hpp>
#include "Source/StartupLevel.hpp"
#include "Source/GameGameInstance.hpp"
#include <GameFramework/Components/Components.hpp>
#include <WrapperSource/Wrapper.hpp>
#include <urll.h>

int main(int argc, char** argv)
{
    UVK_START(true);
    // load modded symbols
#ifdef _WIN32
    void* handle = URLL::dlopen("Modlib.dll");
#else
    // That https://madladsquad.com/ is required on unix systems
    void* handle = URLL::dlopen("https://madladsquad.com/libModlib.so");
#endif
    bool bCanClose = false;
    if (handle != nullptr)
    {
        bCanClose = true;
        if (URLL::dlsym(handle, "modlibbegin", UVK::Utility::getGlobal().modbegin) == handle && URLL::dlsym(handle, "modlibend", UVK::Utility::getGlobal().modend) == handle && URLL::dlsym(handle, "modlibtick", UVK::Utility::getGlobal().modtick) == handle)
            Logger::log("Loaded all mods!", UVK_LOG_TYPE_SUCCESS);
        else
            Logger::log("Failed to load some or all of the initial mod library functions, mod events will not be loaded! Error: ", UVK_LOG_TYPE_WARNING, URLL::dlerror());
    }
    else
        Logger::log("Failed to load the mod library!", UVK_LOG_TYPE_WARNING);
    Wrapper::wbegin();
    UVK::AudioManager manager;

    bool bUsesEditor = false;
#ifndef PRODUCTION
    if (argv[1])
    {
        std::string cmd = argv[1];

        if (cmd == "--editor")
            bUsesEditor = true;
    }
#endif
    auto* st = new UVK::StartupLevel;
    UVK::Utility::getGlobal().getEditor() = bUsesEditor;
    UVK::Utility::getGlobal().currentLevel = st;
    auto* mode = new UVK::GameGameInstance();
    UVK::Utility::getGlobal().instance = mode;
    UVK::UVKGlobal::openLevelInternal("tst", true);
    UVK::Renderer(UVK::Utility::getGlobal().currentLevel, bUsesEditor);
    Wrapper::wend();
    if (bCanClose && URLL::dlclose(handle) != 0)
        Logger::log("Error when closing the mod handle, message:", UVK_LOG_TYPE_ERROR, URLL::dlerror());
}

Generally, both main files do the same thing

  1. Initialize startup settings
  2. Decide on whether to launch the editor or not
  3. Depending on the application type, whether to load mods
  4. They allocate and cache the multiple gameplay classes
  5. They load the startup level
  6. They start the renderer and the engine