Just some update when it feels right
-
[Dec 2024]Misc Note for verse
- Lighting in UEFN can be really different based on the platform. Console seem to have issues compare to PC
- Stat Management Devices just got added in 33.00, should take a look
- Use props to make in-world UI might be a better idea than trying to use widget
- I don’t understand the limit of making some device not available for certain projects
- State Creator Device is bottom based, as the Tracker device is top-left based
- It moves elements to the lower part of screen, but if you have elements in different Y height, the higher one can move up
- Still, since the anchor is bottom-left based, it will “broke” as soon as someone changed their HUD scale
- You can’t have 2 of those and wanting them to track the different stats together
- Doesn’t seem it can go away, not like HUD device that you can hide it. The best way to “hide” it is making elements invisible in the widget
- When setting stat for players, set level, then value
- The best part of this device is that you don’t need to do the logic of “rank up”/”level up” to reset the value. You can just give them the value and it handle those for you
- What does “Show Widget in List” mean?
- It allows the widget to be full screen overlay
- Also allows multiple stat HUD to be shown on screen
- When “Show Widget in List” is true, the stats with the name scope will be displayed based on HUD priority; when “Show Widget in List” is false, it will be shown to player regarding the HUD priority
- Sounds like a bug…the tooltip didn’t mention this effect, but we can use it
- Switch device, GetCurrentState doesn’t return a bool but void. When the result is ON, it successes, fail if OFF
- This is how to use GetCurrentState function to check the state
- if(SwitchDevice.GetCurrentState[Agent]):
- if(not SwitchDevice.GetCurrentState[Agent]):
- Code below will not work
- if(SwitchDevice.GetCurrentState[Agent] = true):
- This is how to use GetCurrentState function to check the state
- Is HUD priority different from Z-order?
- get player from agent, get fort_character from player, get agent from fort_character
- Tracker device track default stats, such as elimination, but it won’t track custom stats you create from stat creator device
- Stat Counter can track your custom stat, can also track default stat
- Broadcast Events on stat change, how to capture those events in verse?
- the counter do comparison to a const value set to the counter device
- This device can server as a way to manipulate stat values with overwrite settings
- Cinematic device won’t play if the target player is too far away from the cinematic
- Can’t use <decides> and return logic, is it because they are somewhat redundant?
- Always use return for your function, just a good practice
- Some function you can set your return value by just put the value as the last line, but it will cause issues when the return type is logic
- For verse logic that will happen when player join during game, always assume agent/fort_character can be invalid and use a loop to wait dynamically til those 2 are valid
- When you need player name:
- MessageName<localizes> (Agent:agent):message= “player name is {Agent}”
-
[Nov 2024]Misc Note for verse
This month is a busy month, hopefully I still remember must of the things…
- When you has a suspended function, or anything that is checking a reference of player, prop, or anything that can be removed in the game. You want to always check if they are still valid before using them.
- Especially player, since they can join/leave the game as they like.
- Bugs that doesn’t make any sense can happen
- Prop manipulator has a small sphere, and the props it is interaction with must touch that sphere.
- Prop manipulator kept the prop alive in its best ability. That says, if it is destroyed (for example, if it can be damaged and player deal enough damage to destroy it), the prop will be removed from the game and the prop manipulator can no longer recover it
- You must connect to UEFN to see verse debug logs
- I wish this wasn’t the case
- HUD device bug:
- “Re-Evaluate Message On Show” should force the device to treat same message as different, but it turns out that it doesn’t do that
- Since you can set it up so Show() trigger some animation, we need it to always treat it the same as new message to make sure the animation is consistent
- Reading it as a bug since if you have multiple device taking individual messages, it will be fine. It only “fail” when there is only one device
- Example that works, as the entre animation will be triggered:
- DeviceA.Show(messageA)
DeviceB.Show(messageB)
DeviceC.Show(messageC)
HideAllDevice()
DeviceA.Show(messageA)
DeviceB.Show(messageB)
DeviceC.Show(messageC)
- DeviceA.Show(messageA)
- Example that doesn’t work
- DeviceA.Show(messageA)
HideAllDevice()
DeviceA.Show(messageA)
- DeviceA.Show(messageA)
- When you got a map with player as key, you can make the value optional. Instead of removing it from the map, just set it to false. That should make sure the data are removed to avoid some weirdness
- New chapter for Fortnite usually introduce major bugs in creator map
- There is no PleyerSwitchWeapon Event for verse to listen to
- There is not really a good way to track what weapon/item player is on besides check it regularly…hopefully we will get something better later
- Direct binding on device: if you see it grey out and not changeable, that means it is other device bind to this one. To change that, find the other device and you will be able to change it
- for(I->C:ArreyName):
- This give you an element on array each loop with an index that goes up accordingly
- GetCreativeObjectsWithTag is deprecated, and it is not consistent with the result
- FindCreativeObjectsWithTag is a new function that replace the one above, and it might be consistent…should do more test for it
- Device broke in blueprint, what a shame…Hopefully that is what scene graph going to fix
- When you use FPS device or make a Lego map, there are devices that is default fortnite that might broke
- If your verse code logic is absolutely fine and it is still having bugs, especially inconsistent bugs. Look at the device you are using to see if anything might be related
- HUDMessageDevice.Show(Player) *could* show its HUD to other players if the recipient could include non-triggering player
- Note to self: init/reset value should happen as the first/last thing
- Device function can be called without a reference. In C++ terms, all functions from creative_device can be called as static functions
- As the result, if you didn’t have the right reference, the function will be called as it is newly made as default
- It won’t call OnBegin for the “newly made device”, means it is more likely they are static functions. However, they also have their own separate member variables. Maybe this is just a non-defined behavior that happen to be consistent
- This make it really hard to debug if you don’t know about it
- When you has a suspended function, or anything that is checking a reference of player, prop, or anything that can be removed in the game. You want to always check if they are still valid before using them.
-
[Note]verse – version 1
Epic just make an announcement about version 1 of verse. I am writing to note the changes and thoughts
The version 1 upgrade is not mandatory, you can stay at current version until Epic decides to stop the support. Ideally, you want to be on top of version, so upgrade asap in a different branch is probably the best thing to do. I don’t expect a new version to come up every other week, so it shouldn’t be too much.
- Failure in Set
- Set no longer allow failable expression
- Now you want to store the result from failable expression to a variable with an “or” keyword to store a default value when the expression fails
- This should be things more defined, but I wonder if we can do
set X = FailableExpression[] or default
instead of making a new variable
- Failure in Map Literal Keys
- I think the page got a typo on there sample code there. They probably mean
map{ExpressionThatCanFail=>Value}
as the old code that is allowed before version 1 - Another change to avoid more undefined behavior
- I think the page got a typo on there sample code there. They probably mean
- Mixing Semicolon/Comma/Newline Separators for Blocks
- I was surprised to hear they allow mixing separators in the first place. Just more change to avoid ambiguity
- Sometimes we use new line to separate code that is too long, not sure if this impact that
- It really is pick your medicine. I am not bothered which way they do it as long as it is consistent and not ambiguous
- Might want to write down the result once I have project upgraded
- Unique Specifier Changes
- <unique><computes> is no longer allowed, now <unique> requires <allocates>
- <unique> – When a class is unique, you can make 2 instances with the same value and they are still not equal to each other
- I am not sure what to make of this bullet point since <computes> doesn’t seem to be a class specifier
- <allocates> is not on the specifier document yet?
- If <unique> requires <allocates>, and <allocates> is new. Why don’t just add the feature <allocates> is doing into <unique>?
- Function-Local Qualifiers
- now you can make variables as local with (local:) in case there is another variable with the same name but from outside of scope
- Personally speaking, you shouldn’t need this since you should name variable in a way that is clear and not duplicate…usually
- Are they trying to allow verse coding library? One use I can think of is allowing utility code library to be shared. Therefore, the code library will want to make sure they are using local qualifier so the project won’t mess with library if they have any global variables. I would love to have utility libraries.
- Public Fields in Structs
- Using <public> is no longer necessary
- Small and nice QoL improvement
- Failure in Set
-
[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
- 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()
-
[Note]How to do animated UI in UEFN (31.40)
So far there are 3 ways to create animated UI in UEFN, they all having its limitations. However, we should see what is to come in the December update as it seem to promise UI improvements.
update: It is totally possible with data binding, but there are still restriction- have a button, or anything that can be triggered by the UI itself
- This method seem good enough if the UI is interactable.
- However, it doesn’t works on pop-ups, or any in-game behavior feedback.
- in verse, creating the UI and remove the UI every tick
- Probably everyone’s nightmare unless you enjoy placing UI component in code
- Require you to add and remove the widget every frame for the animation
- At this point of the engine, cause memory leak and tank your game’s performance
- got some self-animated shader
- The easiest way to get something moving
- Doesn’t take any input or control
- Good for pop-up and the things that doesn’t communicate game meaning but just decoration
- Data binding (the best way so far)
- I am on 32.00 when I found out about this, but it is probably available before
- With different location of your UI, you want to use different device to do data binding
- If your UI is on top-left, use tracker device
- If anywhere else, you need to use HUD device with limitations
- The reasoning of this is tracker device being more powerful, but it force your UI to anchor on top-left. It might looks good on your machine, but it won’t work with people who changed their UI scaling. HUD device doesn’t have that issue, but it can only do very little data binding
- Once you linked your UI and the device to each other, go to the binding tab and create a new condition as “if expression, do queue animation”. In the detail of the condition, like the animation you want
- Right now it can only do Data compare float
- “if expression, play animation” seem to be a better way to set it up, but it actually doesn’t work
- When using tracker device, you can compare value(int) to the float value properly and use it to control many animations to play in different situations
- HUD device does not have any numbered value you can set from verse that is good as a switch for data binding since it only compare to float but not string/text.
- However, HUD device for some reason, the condition of “text equals to 0.0” seem to be always true regardless what the text is. For each HUD device, it will be able to trigger 1 animation and only when the text from HUD device is being updated.
At this point of the engine, animation in UI is possible. Regardless it is not good for giving feedbacks from the game. It is totally fine to have animated UI for the sake of art, or having fancy UI that require mouse clicks.
- have a button, or anything that can be triggered by the UI itself