Skip to main content

Spawning Brushes

Runtime brushes are components. They exist in two types:

  • ElRtTextureStampBrush (Errant Landscape Runtime Stamp Brush Component) - used when you want to dynamically add, move, and destroy brushes during the gameplay and the expected number of brushes is low (tens to hundreds). Each of these brushes is somewhat independent and is replicated to other players in a multiplayer game. When destroyed, the landscape modification is also reverted.
  • ElRtPersistentTextureStampBrush (Errant Landscape Runtime Persistent Stamp Brush Component) - used when you only add brushes, but never remove them and when the number of brushes is high (hundreds to millions). Each time a persistent brush is added, it gets rendered into a cache (Persistent Layer Textures) and then gets destroyed. The cost of rendering persistent brushes is independent of their number. In multiplayer games, Persistent Layer data is sent over to players joining mid-game right after they join the game. And when new brushes are added, they are rendered independently on the client and the server in the same spot. This way the client and the server stay in sync.

In order to spawn a runtime brush, you need to create an actor BP and add the brush component to it. Then spawn that actor from Blueprint or code. After one or several runtime brushes were spawned, you need to trigger a landscape update. This can be done by calling Update Landscape function on the runtime brush in the actor's BeginPlay event.

Alternatively, as an optimization, you can call UElRtWorldSubsystem::QueueRender for bounds that cover an area of several brushes.

tip

Mixing normal and persistent runtime brushes over a single landscape is supported.

Example Blueprint Implementation: