3Ducttapes(); Yvo von Berg | CG Toolsmith blog | C++, Python

Tycoon C++ Track presets

Track presets

  • Testing partial track presets, so you can quickly place your favorite loopings. Currently set to work with a specific track length only.

Regenerating Normals and Tangents after deformation

  • I have to update the normals and tangents after deforming the track piece, this process can be slow on larger meshes. To solve this I run the normal generation as an Unreal background task: https://wiki.unrealengine.com/Using_AsyncTasks

It is only possible to update geometry on the main game thread, so I cache all the generated values and re-run the update on the game thread every few seconds. The result is a nice streamlined workflow where the normals catchup quickly after adding some pieces.

  // Generate normals
  (new FAutoDeleteAsyncTask<TangentCalculationAsyncTask>(
    NewPiece
    )
    )->StartBackgroundTask();

Tycoon C++ Track adjustments

Track adjustment tools

I’m testing some tools to adjust the track after it has been built. I’m basically changing the cached angle value of a specific piece. I’m hoping I can extend this functionality to implement some sort of ‘autocomplete’ feature.

  • Change single piece and update entire track.
  • ‘Auto adjust’: Change single piece, and try to align back to original track.

Tycoon C++ UI updates

UI cleanup

I just finished another pass on the UI for Tycoon. Most of the options are now persistent, when drawing the UI I lookup the previous values from the current tycoon collection actor.

I have also added actor inputs to my slate UI, these were tricky to find in the Unreal documentation, here is an example on how to use them:

SObjectPropertyEntryBox

    [
        SAssignNew(MainMeshInputWidget, SObjectPropertyEntryBox)
        // Only allow and show these object types
        .AllowedClass(UStaticMesh::StaticClass())

        // The Unreal UAsset path e.g. '/game/mesh/cube.cube'
        // This is the actual value that the field saves
        .ObjectPath(this, &FTycoonToolEdModeToolkit::GetPathMain)

        //  Whether the asset can be 'None' 
        .AllowClear(true)

        // Callback changing the asset, 
        // you can lookup the AssetData from the selected asset here.
        .OnObjectChanged(
            this, 
            &FTycoonToolEdModeToolkit::ChangeAssetDataMain
        )
    ]

New UI, I have used this great app to create the wireframe: whimsical

demo

Reload fixes

  • Tycoon will now remember the position and rotation of the first piece so it doesn’t reset back to the origin when you reload.
  • You can now place different meshes in the track while building.

Attachment features

  • Enable/Disable attachments for different sections of the track.
  • Control the minimum ground height.
  • Amount of pillars for each piece.
  • Control the local offset of each row.
  • Switch between attachment calculation from the track piece down or from the ground up until the system reaches the track piece.
  • Tycoon will generate a normal Unreal spline from the entire track, I’m planning on creating some Unreal blueprints or Houdini engine examples on how you can fully customize the attachments.

I’m currently thinking of ways on how I can make the building more dynamic, so stay tuned.

Tycoon C++ dynamic rebuild

Horizontal atttachments

Added a method that builds a cube shape procedural mesh component.

    UProceduralMeshComponent* ATycoonAttachment::AddDynamicComponent(
        FVector Start, 
        FVector End, 
        FVector StartDirection, 
        FVector EndDirection, 
        int32 Column
    )
    {
        // create procedural mesh component vertices using start / end
        // Using start and end direction to create the correct orientation in corners -> |-| -> /-\
        NewVertices.Add(Start + (StartDirection * AttachmentHorizontalWidth));
    }

I’m generating a grid with all the points required to build the attachments. (Rows, columns).

Tycoon Attachment profiles

I’m currently working on the different attachment system profiles.

  1. Pillar (Top/Main/Bottom)
  2. Pillar (Horizontal lattice work)

Prototype with two types of meshes duplicated in the Z axis based on the height of the mesh. I’m using these locations to further append extra meshes.

Added a way to control the attachment detail separately of the animation detail. In order to make Tycoon flexible for developers, I generate an Unreal spline component based on the track.

New cool animation update: