[Oct 2024]Misc Note for verse


Here is what I learn from recent work using UEFN

  • NPC behavior doesn’t seem to have a good way to access player information. A better way for it will be use a device since they have access to GetPlayspace().GetPlayers()
    • found a way to do it….create a empty device like device{}, and call GetPlayspace().GetPlayers() on it
  • You want to have <transacts>with the function in order to have it be allowed to call inside a if condition.
  • When a function return logic(bool for Verse), the right way to call it in if condition will be if(func() = true), that is because a logic doesn’t become a condition in verse. You must specify them.
  • For anything that could fail, they go to if
  • I wish there are float_max or float_min, but no, just use some big magical number or define it to be global const
  • player? is like a player pointer, with a question mark at the end means this variable can be null(in Verse, it is false instead of null). When use the value it stored, you want to use if since it could fail (when it is false)
  • Use editable_number to limit max and min value on something can be changed in not just verse, but UEFN
  • Expect default unit radius to be 50
  • Only Guard NPCs are leashable. When you call leashable on non-Guard NPCs, it is a silent failure
    • I don’t believe it should be a guard-only feature
    • Should not be silent failure when try to leash on non-leasable, but the way for them to be set up in verse prevent any warnings
  • No custom guard appearance allowed. To make custom NPC, use custom type
    • It is unclear why it is not allowed, maybe it is but no one knows how to do that?
  • When you have persistent data in a live game, all other branch must have those data as well. Or you will hit verse errors about unknown file, and your verse will compile locally!
  • 1 tile is 512 cm
  • To spawn particle effect, make a blueprint object with the particle component and the particle you want. Spawn the object as a prop and dispose them once the particle is done
    • It feels like they should be a particle “object” as a prop that can carry a particle instead of need to have a blueprint
  • pushback in verse: set arrayName += array {newElement}
  • If your source control doesn’t know which file is what object, type the last 4 or 5 character on the file into the Outliner to find it
  • There is no “for(int i = 0; i < something; i++)” logic, code it yourself some raw logic in verse to do this
    • unbelievable lol
  • if(prop.isValid[] = false ) <–don’t do that
    • isValid returns a value of true or false, however =false is just checking if the function returns anything like a pointer since Verse treat false as null sometimes
    • The right way to do it is
      • if(not prop.isValid[])
  • player.isValid is not the same as fortCharacter.isValid
    • one of them returns false when player respawn, the other one doesn’t
    • make sure you don’t use them interchangeably, gonna got strange bug that is difficult to figure out
  • There is no Audio component, unless you drop a CUE(you can make it by right clicking a .wav file) in a blueprint.
    • I don’t believe this is the intended way to implement audio, regardless this is the right way to do it at UE4
    • Seems like the new right way is to use the niagara system, is this why it is no longer called particle system? as it can do audio and maybe other thing?
  • Trust nothing….. prop can be invalid any time in the game, players as well. Make sure you take care of the case when things became invalid in your suspends function
  • When use MoveTo function to move props. If your prop is huge (that include niagara range), it can crash even if your move to location is valid. Because the niagara system goes outside of playable boundary, it will crash and at this point Epic does not handle that. The error will look really confusing.
  • Try to not have nested loop or race…it can be difficult to debug when something goes wrong

Published by


Leave a comment