Infinity Engine v0.6.20
C++ API Documentation
Loading...
Searching...
No Matches
Basic Setup and First Project

This tutorial will walk you through setting up the Infinity Engine SDK, creating your first project, building a simple procedural system in the Infinity Creator, and integrating it into your application.

Prerequisites

  • C++ compiler supporting C++17 or later (Visual Studio 2019+, GCC 9+, or Clang 10+)
  • CMake 3.16 or higher
  • Infinity Engine SDK downloaded and installed
  • Infinity Creator installed (for visual system design)

Step 1: Project Setup

Create a new directory for your project and add a CMakeLists.txt file:

cmake_minimum_required(VERSION 3.16)
project(MyInfinityProject)
# Set C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Find the Infinity Engine package
find_package(InfinityEngine REQUIRED)
# Create your executable
add_executable(my_project main.cpp)
# Link against Infinity Engine
target_link_libraries(my_project InfinityEngine::Core)

Step 2: Initialize the Engine

Create main.cpp with basic engine initialization:

#include <Infinity/InfinityInit.h>
#include <Infinity/Engine/InfinityEngine.h>
#include <iostream>
int main() {
// Initialize the engine first - this MUST be called before any other Infinity functions
try {
// Create engine instance
std::cout << "Infinity Engine initialized successfully!" << std::endl;
std::cout << "Ready to load procedural systems." << std::endl;
return 0;
}
catch (const std::exception& e) {
std::cerr << "Error: " << e.what() << std::endl;
return 1;
}
}
Main entry point to the InfinityEngine API for procedural generation.
Definition InfinityEngine.hpp:26
INFINITY_API_PUBLIC void InfinityInit(void)
Initializes the Infinity Engine.

Step 3: Build and Test

Build your project to ensure everything is working:

Windows (Visual Studio)

mkdir build
cd build
cmake ..
cmake --build . --config Release

Linux/macOS

mkdir build
cd build
cmake ..
make -j$(nproc)

Run your executable to verify the setup:

./my_project # Linux/macOS
.\Release\my_project.exe # Windows

You should see:

Infinity Engine initialized successfully!
Ready to load procedural systems.

Step 4: Create a System in Infinity Creator

Now let's create a simple procedural system using the visual editor:

  1. Launch Infinity Creator
Infinity Creator loading screen
  1. Create a New Project
    • Click "New Project" or File → New Project
    • Choose a location and name for your project
  2. Design Your System
    • Drag components from the Toolbox into the Procedural Graph View
    • For a simple example, create a basic mesh generation system:
      • Add a "Create Mesh" component (or similar sphere/cube generator)
      • Add input parameters like "Scale" or "Subdivisions"
      • Connect the components and configure their properties
Basic mesh deform system
  1. Configure System Inputs/Outputs
    • Add system-level input ports for external control
    • Add output ports to retrieve generated data
    • Name your system (e.g., "SimpleTerrainGenerator")

For detailed guidance on using the Creator interface, refer to the Infinity Creator Manual which provides comprehensive documentation on system design, component configuration, and workflow management.

Step 5: Deploy Your System

Once you're satisfied with your system design:

  1. Click the Deploy Button
    • Located on the right side of the Toolbar at the top of the UI
Click the Deploy button
  1. Configure Deployment Options
    • Library Export: Choose whether to export a copy of the Infinity shared library
      • Usually unnecessary if you have the SDK installed
      • Useful for deploying into other engines or standalone applications
    • Code Generation: Enable auto-generation of helper code
      • Multiple language options available (C++, C#, Python)
      • Generates boilerplate code to access your systems
    • Asset Deployment: Configure whether to deploy additional assets
  2. Set Deployment Path
    • Choose where to save your .infinitycore file and related assets
    • Recommend creating a assets/ or data/ folder in your project
  3. Deploy
    • Click "Deploy" to export your system
    • The .infinitycore file and any additional files will be saved to your chosen location

Step 6: Load and Use Your System

Update your main.cpp to load and execute your deployed system:

#include <Infinity/InfinityInit.h>
#include <Infinity/Engine/InfinityEngine.h>
#include <iostream>
#include <filesystem>
int main() {
// Initialize the engine
try {
// Load your deployed core file
std::filesystem::path corePath = "assets/MyProject.infinitycore";
std::cout << "Core loaded successfully!" << std::endl;
// List available systems
auto systems = engine.rootSystems();
std::cout << "Available systems: " << systems.size() << std::endl;
for (const auto& system : systems) {
std::cout << " - " << system->id() << std::endl;
}
// Get a specific system (replace with your system name)
auto system = engine.system("SimpleTerrainGenerator");
if (system) {
std::cout << "Found system: " << system->id() << std::endl;
// Configure inputs
system->setIn<float>("Scale", 10.0f);
system->setSeed(12345);
// Execute the system
std::cout << "Executing system..." << std::endl;
system->execute();
std::cout << "Execution complete!" << std::endl;
// Access outputs (example - replace with your actual output types)
// const auto& mesh = system->getOut<Infinity::Types::Rendering::Mesh>("mesh");
}
return 0;
}
catch (const std::exception& e) {
std::cerr << "Error: " << e.what() << std::endl;
return 1;
}
}

Platform-Specific Notes

Windows

  • Ensure the Infinity Engine DLLs are in your PATH or next to your executable
  • Use forward slashes or escaped backslashes in file paths
  • Consider using vcpkg for dependency management

Linux

  • Install development packages: sudo apt-get install build-essential cmake
  • Ensure proper library linking with -Wl,-rpath if needed
  • Set LD_LIBRARY_PATH if libraries are not in standard locations

macOS

  • Install Xcode command line tools: xcode-select --install
  • Consider using Homebrew for CMake installation
  • Handle framework linking if using the framework distribution

Troubleshooting

"InfinityEngine not found" during CMake configuration:

  • Verify the SDK is properly installed
  • Set CMAKE_PREFIX_PATH to your SDK installation directory
  • Check that find_package(InfinityEngine) can locate the config files

Runtime library errors:

  • Ensure all required DLLs/shared libraries are accessible
  • Check that you called InfinityInit() before any other engine functions
  • Verify your project targets the same architecture (x64/x86) as the SDK

Core loading failures:

  • Verify the .infinitycore file path is correct
  • Ensure all component libraries are in the expected locations
  • Check file permissions and accessibility

Next Steps

Now that you have a working setup: