Skip to main content

2023 Feb: Widgets & Notifications!

Β· 6 min read
Gabriel T. Nardy

Widgets & Notifications!

Here's a roundup of the latest updates from February.

Widgets​

After much anticipation and requests, we are excited to announce the introduction of a new class in nanos world: Widget! This new class allows us to spawn UserWidgets or any Widget child from Lua to be used as UI in the game, similar to WebUIs.

Just like Blueprints, it is possible to call functions and listen to dispatchers from Lua, allowing for seamless integration between both environments.

See how simple is creating a Native Button and subscribing for it's events:

local my_button = Widget(NativeWidget.Button)

-- Puts a text inside of it
local my_text = Widget(NativeWidget.Text)
my_text:CallBlueprintEvent("SetText", "Press Me!")
my_button:AddChild(my_text)

-- Binds the native OnClicked dispatcher
my_button:BindBlueprintEventDispatcher("OnClicked", function()
Console.Log("Clicked!")
end)

-- Adds the button to viewport
my_button:AddToViewport()

-- Adjusts the layout, making it centered
my_button:SetCanvasLayout(Vector2D(0, 0), Vector2D(0, 0), Vector2D(0.5, 0.5), Vector2D(0.5, 0.5), Vector2D(0.5, 0.5))

All native functions of widgets can be called with CallBlueprintEvent(). Just as events/dispatchers can also be subscribed with BindbluEprinteventDispatcher()! In the Widget page we added a section linking all Unreal Native Widgets Documentation pages which you can find all their methods and events available!

In addition to being possible to spawn native widgets, you can also spawn custom UserWidgets from an Asset Pack! Just use the other constructor:

local my_custom_widget = Widget("my-asset-pack::WBP_CustomWidget")

We have plans to keep extending the functionalities of widgets, and also make it possible to draw them in 3D World in the future.

Building UI goes Brrr now!

Better Warnings​

We have improved our warnings system by adding line numbers to deprecated warnings. This makes it easier for developers to identify and fix deprecated code in their scripts.

SceneCapture Encode​

We added a new method to SceneCapture: EncodeToBase64()!

Theis new SceneCapture Encode feature allows you to take a snapshot and generate a Base64 image string to be used in WebUI. We have both synchronous and asynchronous methods available.

Player Avatar on Chat​

We have added player avatars to the chat, making it easier to identify who is talking.

New Native Server Commands​

We have added new server commands, including the ability to kick and list players connected:

  • players - lists all players connected.
  • kick- kicks a player from the server.

CharacterSimple Damageable​

We have added support for CharacterSimple to receive damage and die, just like the existing Character class.

Also, we added a new Docs page for BaseDamageable containing all Damageable methods and events! Which is shared between Character and CharacterSimple!

New Custom Settings Type: Select​

We have added a new custom settings type: select. This new option displays as a dropdown menu in the MainMenu, allowing players to select one of the predefined options in the custom_settings setting in the game-mode's Package.toml.

Fatal Crashes Report​

We now automatically send all fatal errors to our Crash Report system. As Fatal errors usually are "treated errors that shouldn't happen", this helps us identify and fix issues quickly, improving the overall stability of the game.

Blueprint Material as Arguments​

We have expanded blueprint support to include material parameters from WebUI, Canvas, and SceneCapture entities. This means that blueprints can now receive MaterialInterface parameters from these entities automatically.

tip

The new Class Widget also benefits from this!

You can see a list of all possible Parameter Types in the Blueprint Documentation page.

Vault Improvements​

Labels​

We have added new icons to the vault display, indicating whether a resource is an official resource or if you has ownership over it (belongs to it's Team).

Ownership Manage​

Additionally, we have added a new tab for managing resources, which currently only contains a button redirecting to the store.

Local Folders​

We have also added a new button to open the local installed folder, making it easier to manage downloaded resources.

No Internet​

The vault now works and loads local resources even if the player has no internet connection.

We have added notifications to the main menu, which display general errors and vault messages. This means that notifications will appear when resources are installed or when errors occur.

All notifications from the current session can be found in a new window under the notification πŸ”” button.

Assets.toml Files Validator​

We have added a new system to automatically validate Asset Packs files from Assets.toml. This system checks if a file listed in Assets.toml was not found in the disk, helping to identify and debug Assets problems quickly.

It only runs on server when loading an Asset Pack, and will display warnings on console.

New Trace Methods​

We have added new Trace methods to Trace, including SphereSingle(), SphereMulti(), BoxSingle(), BoxMulti(), CapsuleSingle(), and CapsuleMulti(). Allowing more traces possibilities in the game world!

New Sky Methods​

We have added several new Sky methods, allowing customization to the Moon and other new properties of the Ultra Dynamic Sky.

Network Lanes​

We have made significant changes to the network layer of the game framework. VOIP and File Transfers now use a new low-priority network lane to transmit their data. This means that the performance impact on gameplay is reduced when players are connecting (and downloading files) or using VOIP, which uses large amounts of network data.

Is Steam Launched​

We added a better validator to check if Steam is launched when you start the game. Now a popup will show up instead of having the game crashing.

Do not dare to press No. πŸ˜‰

Conclusion​

Last month we got exciting new features and improvements to nanos world!

One of the most anticipated additions was the introduction of the new class Widget! This is really exciting as it will greatly increase the possibilities of creating UI within the game!

The Menu Notifications also adds a lot of quality of life to players, we often had problems happening under the hood and we didn't know. With the new notifications system we will now be alerted to problems and also what Vault is doing!

CharacterSimple now is more complete! With the addition of the damage system, it can now be better used as enemies or simple NPCs!

All these updates and improvements aim to enhance the overall stability and experience of the game! Thank you very much for your suggestions, ideas and bug reports!

We see each other next month! Nogitsu can finally rest in peace. 😁