Back to the feed
Featured Sample Projects 2026-06-21

Minecraft-Styled Building Mechanic

Minecraft-Styled Voxel Building in UEFN via Verse

This community snippet demonstrates a fully functional Minecraft-style block-placement system built entirely in Verse, using runtime prop spawning, player rotation math, and signal remote devices. It matters because it proves that grid-snapped, directional block placement — a mechanic that previously required complex Blueprint setups or didn't exist in UEFN at all — is achievable with a single creative_device class and standard Verse APIs.


What Changed

This is a community-authored sample project (not an Epic API change), but it surfaces several Verse capabilities that many developers haven't composed together before:

  • Runtime prop spawning via SpawnProp — You can call SpawnProp(asset, transform) at runtime to materialize a creative_prop_asset at an arbitrary world position, scale, and rotation. This is what creates the actual placed blocks.
  • creative_prop.TeleportTo[] for holographic preview — A pre-placed "HoloBlock" prop is repositioned every 0.1 seconds using TeleportTo[position, rotation] to act as a placement indicator before the player commits.
  • signal_remote_manager_device subscriptionsPrimarySignalEvent and SecondarySignalEvent on the signal remote map to "place blue block" and "place red block" actions, giving you two distinct build commands from a single held item.
  • fort_character.GetViewRotation() + GetAngle() — The player's facing direction is extracted as a rotation, converted to degrees via RadiansToDegrees(rotation.GetAngle()), and bucketed into 8 cardinal/intercardinal directions to determine which grid cell in front of the player should receive the block.
  • Grid-snapping math in CalculateBlockLocation() — Rather than placing blocks at the raw raycast hit, positions are quantized to a fixed BlockRange (500 units) offset from the player's current position, producing aligned voxel-style placement without any physics query.

The construction_device class is wired entirely through @editable properties, meaning the two block assets, the holo indicator prop, and all supporting devices are configured in the UEFN editor without touching code.


What You Can Build

1. Two-Material Grid Builder with Block Budget

The snippet's core loop maintains a var BlockCount : int that decrements on every placement. When it hits zero, a hud_message_device fires once (guarded by setting the counter to -1) and no further blocks can be placed. You can extend this into a competitive resource-management game where each player starts with a fixed inventory:

# Extend construction_device to track per-player budgets
var PlayerBudgets : [player]int = map{}

PlaceBlock(Agent : agent, Asset : creative_prop_asset) : void =
    if (P := player[Agent]):
        if (Remaining := PlayerBudgets[P]):
            if (Remaining > 0):
                Pos := CalculateBlockLocation()
                Rot := MakeRotation(Pos, 0.0)
                SpawnProp(Asset, transform{Scale := BlockScale, Rotation := Rot, Translation := Pos})
                set PlayerBudgets[P] = Remaining - 1

This pattern — budget per agent, block type per signal — lets you build a tower-defense or castle-siege mode where players spend resources to fortify positions.


2. Real-Time Holographic Placement Preview

The DisplayBlockLocation() / TeleportTo[] loop running at 100 ms intervals gives you a cheap placement ghost without any rendering API. You can upgrade this to differentiate valid from invalid placements by checking proximity to existing props or world bounds, then swapping the holo prop's material via a device parameter:

DisplayBlockLocation() : void =
    PotentialSpot := CalculateBlockLocation()
    IsBlocked := CheckOverlap(PotentialSpot)   # your collision check
    TargetProp := if (IsBlocked) then RedHolo else GreenHolo
    if (TargetProp.TeleportTo[PotentialSpot, MakeRotation(PotentialSpot, 0.0)]):
        Print("Preview updated")

Because TeleportTo is a failable expression, the if wrapper already handles cases where the prop can't be moved (e.g., it was destroyed), keeping the loop crash-safe.


3. Cardinal-Direction Snap System for Non-Building Games

The CalculateBlockLocation() angle-bucketing logic — GetViewRotation()GetAngle()RadiansToDegrees() → 22.5° bucket comparisons — is a reusable utility for any mechanic that needs to know which of 8 directions a player is facing. You can lift it directly into an ability system, a turret-targeting tool, or a puzzle where players must face a specific direction to activate a trigger:

GetCardinalIndex(Character : fort_character) : int =
    Angle := RadiansToDegrees(Character.GetViewRotation().GetAngle())
    if (Angle < 22.5)  { return 0 }   # North
    else if (Angle < 67.5)  { return 1 }   # Northeast
    else if (Angle < 112.5) { return 2 }   # East
    else if (Angle < 157.5) { return 3 }   # Southeast
    else if (Angle < 202.5) { return 4 }   # South
    else if (Angle < 247.5) { return 5 }   # Southwest
    else if (Angle < 292.5) { return 6 }   # West
    else                    { return 7 }   # Northwest

This eight-way directional index is stable and cheap to call inside a polling loop, making it suitable for any frame-rate-independent directional query.


References

Related topics