Recently did a very first user test. I’ve decided to rebuild most of the UI to make it more artist friendly. Here is the new prototype. With a focus on sliders. Was quite a bit of work, but learned a lot about the UE4 Slate framework.
Started to build an animation system for the trains.
I’ve learned that if you use ‘BlueprintCallable’ you can expose C++ methods directly to blueprint nodes. However I had to change the plugin type from ‘Editor’ to ‘Runtime’.
Which makes sense because my animation system would run at runtime. :)
I currently have the following methods:
TycoonSwitchTrain: Sets the active train to use, to control the carts (child actors), I call GetAttachedActors() on the main train actor.
TycoonChangeCartOffset: Each train has an offset on the track.
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:
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.
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.
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:
[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
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.
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.