Module 3: Creating the XML Configuration Using System Designer
Define the data types and create a Connext XML configuration file
Before creating code in Unreal Engine, we will briefly review the data being exchanged between the different applications. Connext is based on the Object Management Group® (OMG®) Data Distribution Service™ (DDS™) standard, which is a data-centric publish/subscribe protocol. As for any data-centric system, we need to define the data type being shared between different publishers and subscribers. Since we use the RTI Shapes demo as our source, for the first steps we will use the same data type (Shapes). Type definitions in DDS are typically shown in IDL format. The ShapeType.idl file can be found in the RTI Connext install directory under resources/idl (%NDDSHOME%\resource\idl).
Multiple options types can be used with Connext. The two main options are:
- Generated type-specific code from the IDL file
- Use the dynamic data type APIs
For this example, we have chosen the second option (Dynamic data API) since the dynamic data API does not need additional generated C++ files to be added to the project. It also makes the code more generic; just a few lines need to be changed if you work with different types. In addition, using dynamic data is more aligned with the Unreal Engine approach.
With dynamic data we can define the types in C++ code or we can read the types from an XML configuration file. We choose to use the XML configuration file once again to keep the code mostly independent of the type.
To generate the XML file, we can use RTI System Designer. Open the System Designer and create a new project. Place the project in a folder called Connext in the Content folder of your Unreal Engine workspace. The first step is to create the data type. As mentioned, we already have an IDL file. We can convert the IDL file to an XML file and import it into the system designer. To convert the ShapeType.idl to XML, open up a Windows command prompt window and type:
Rtiddsgen -convertToXml ShapeType.idl
This will create a ShapeType.xml file which can now be imported into the system designer project.
The next tab is the QoS settings where we can set the QoS of the different DDS entities. For now, we can leave it empty and use the default settings.
The other sections can be used to define the Domain Participants and all the data readers and writes. For our example, we will create those entities in C++ as we eventually want to be able to create readers and writers dynamically. If you have no need to create readers or writers dynamically, you can define the needed DDS instances in the XML configuration and later load the configuration in your code. This will reduce the amount of code you have to write if you use a static configuration.
For this example, the XML file will be in the Content\Connext folder of the Unreal Engine project. If you package the project, you may choose to move it to a different location.
This video shows the steps for creating the XML configuration using system designer.