Verse Library verse

01 Device

Monitors prop count to warn designers about potential memory limits during island development.

verse-library/cell-memory-used-bar/01-device.verse

# This is a comment. It explains the code.
# We are making a simple check for memory.

# We define a device class. In Verse, logic lives inside a creative_device.
# The creative_device connects our code to the island.
memory_check_device := class(creative_device):

    # OnBegin runs automatically when the game session starts.
    # It is the first recipe the island follows.
    OnBegin<override>()<suspends> : void =

        # We create a fixed threshold to represent our warning level.
        # Verse has no runtime memory-query API, so we track a prop count instead.
        # note: UEFN exposes no Get_Memory_Usage() call at runtime; prop count
        #       is the closest in-code proxy a designer can act on.
        PropWarningThreshold : int = 90
        CurrentPropCount : int = 50   # replace with your actual tracked count

        # We check if the count is too high.
        # If it is over the threshold, we warn the player.
        if (CurrentPropCount > PropWarningThreshold):
            # We print a message.
            # This message appears in the output log during Play-In-Editor.
            Print("Island is getting full! Move some props.")
        else:
            # If it is safe, we say good job.
            Print("Memory looks good! Keep building.")

Comments

    Sign in to vote, comment, or suggest an edit. Sign in