Web UI (HTML/CSS/JS Interface)

Hi
We are buildung a project which we are exporting for the HTML-Player but the Web-UI seems not to work there.
Is it only for Desktop Standalone Applications and not for Browser-Applications?

Kind regards

Hey guys sorry for the delay. Weā€™ve been really busy and were not able to get around to some of these updates until now. There are new versions available on GitHub and some updated documentation and examples will be posted soon. Here are some quick notes for these updates:

WebUI

  • Native support for 60 FPS (no engine changes required)
    there is a new setting in the widget blueprint under the ā€œbehaviorā€ section that allows you to specify the FPS for the browser instance of that widget

  • Dynamic mouse transparency
    another setting is available in the ā€œbehaviorā€ section of the widget blueprint to enable mouse transparency which allows for clicking behind the interface

  • Debugging via the Chrome DevTools
    you can now press CTRL+SHIFT+I to open the devtools in development and debug builds for the currently focused browser widget

  • Access texture data
    new functions such as GetTextureWidth() and GetTextureHeight() along with ReadPixels() provide the ability to sample the browser pixels (this DOES NOT create a new render target and samples the existing slate texture on the render thread)

  • Focus browser elements
    new functions such as Focus() allow the browser to receive direct focus, when combined with JavaScript focus events you can now directly trigger focus into a browser input or textbox element (this was not previously possible because the browser required the player to click on the widget before receiving keyboard focus)

  • Load local files (mobile)
    you can new use functions such as LoadFile() on mobile browsers to directly access HTML files and load local image files, the file paths will be properly resolved for both Android and iOS (the updated example project will demonstrate full mobile support out of the box)

  • Custom mouse cursors
    new documentation will be provided for fixing engine-related issues that prevent custom mouse cursors from working with browser widgets

  • Support for WebGL
    new documentation will be provided for enabling WebGL in the UnrealCEFSubprocess (Windows, Mac, and Linux)

  • Support for 3D widgets (coming soon)
    the new ReadPixels() function when used with the widget interaction component allows for the 3D laser pointer to pass through transparent parts of the browser

JSON Library

  • Direct reference checking
    you can now directly compare objects and lists via reference using the new Equals() function, subsequently new functions such as FindList() and RemoveList() have been added to the JSON array wrapper class

  • Primitive type coercion
    originally if you used GetBoolean() or GetFloat() or GetString() and the underlying JSON type did not match then the default value was returned, now these functions will automatically try to convert these values into the appropriate data type (the new equals function is now the equivalent of the JavaScript abstract equality operator)

  • Variable change tracking
    new delegate pins have been added to the Construct Object and Construct List nodes that allow for tracking variable changes (these events are only valid for the current reference and will no longer trigger if the object/array is accessed from a parent object or converted into a generic value)

  • Performance improvements
    the JSON wrapper classes now utilize the underlying FJsonValueArray and FJsonValueObject structures

1 Like

Hi

Sorry for my stupid question.
But could you please tell me if WebUI is for Standalone Applications only (for example *.exe-Files on Windows) or does it also work for In-Browser-Applications (using the HTML-Canvas-Element)?

Kind regards

I usually ignore questions that people are clearly able to find the answers to themselves but since youā€™ve asked multiple times here you go:

https://i.imgur.com/ZKiKGPR.png

https://i.imgur.com/YYoICQS.png

However web-based user interfaces is probably the least of your concern right now. I would be worried about the fact that Epic Games just deprecated your entire platform in the 4.23 version of the engine:

https://github.com/EpicGames/UnrealEngine/commit/a5ae87e3189bd1b4cc4564d164416b71021eab53

This is because if something doesnā€™t benefit Fortnite or anything making them money they donā€™t actually care at all, which is why Paragon was scrapped and now the entire H5 platform as well. Itā€™s only a matter of time before this engine reaches a breaking point. I think the CTO at my previous job put it best, which is that these engine developers are constantly adding new features without ever finishing anything they start and creating an evermore buggy and bloated product. I wouldnā€™t be surprised if we all get to a point where we stop downloading the latest engine updates when things become too unstable. I mean they donā€™t even bother to update their previous branches with bug fixes once theyā€™ve moved on to the next version and seem to think 2-3 minor updates per engine version is enough to fix the bugs. Yet there are many times you find yourself needing to download the next major version of the engine just to fix an issue only to have new things completely broken in the new version. Itā€™s pretty apparent this engine doesnā€™t even come close to the quality of the Source Engine and we didnā€™t even realize what we had until it was gone. Thereā€™s no question if the Source 2 Engine came out tomorrow our company would jump ship from this engine without ever thinking twice.

2 Likes

@

Thanks for taking you time and providing us more background-informations.
As you may noticed, I know almost nothing about unreal engine, and the fact that it run for some big OS, from my point of view, does not automaticaly mean is does not run in a Canvas-Element of a Browser. It maybe logic from a developer-view but not for not or an ignorant one as I am :slight_smile:

I wish you a good day.

1 Like

Hi!

I am currently struggling with mobile (VR) with a 3D widget. the widget itself is the full 1920x1080 Iā€™ve set it to, however the browser itself seems to cut as if it believes it is in landscape mode perhaps?

I am not getting the full height utilized, itā€™s actually stretched. so the content on mobile seems wrong, itā€™s squished in height.

Any ideas? :smiley:

[SOLVED]

Wow, theyā€™re completely dropping HTML5?:eek:

Anyway, thanks for this super useful plugin. It has made UI development fun again :slight_smile:

I seem to be having trouble getting range sliders to work properly. When mousing down on the slider ā€œhandleā€ and dragging, it may move for a short distance but then shortly stops responding. It seems like it stops processing if the mouse cursor moves off of the handle. This is on 4.22.3 editor on Windows 10, with the player controller input mode set to Input Mode Game and UI, with mouse transparency enabled on the web widget. Maybe it has to do with the new mouse-transparency functionality or my input mode?

Sorted out the last issue, that was my mistake :slight_smile:

What I currently struggle with is the ue4 function on my android phone, Iā€™ve applied the JS required to make it work however it only works on websites on the internet / local webservers where there is a proper URL, it does not work for me when loading the HTML directly or loading a local file.

Iā€™ve tried quite a lot, but it only returns undefined and no communication to UE4 is being picked up, Iā€™ve applied events to both the interface and the URLchange and none of them trigger.

Itā€™s using Android Webview 52

1 Like

You are correct that the range sliders are fidgety as I have experienced this issue with the example project as well. It was happening well before the transparency update and the new dynamic mouse transparency didnā€™t seem to change the way it bugs out. The entire browser widget is just very buggy when it comes to drag-n-drop operations so there hasnā€™t been a way to address this issue directly in the engine.

However in terms of a workaround there are a few things you can do. The easiest is to just not use range sliders or other weird input elements at all and just use JavaScript for everything. We actually use the jQuery UI for our form elements including range sliders and it removed a lot of hassle. Otherwise another potential workaround if you absolutely need to support native input elements could be to implement some kind of mouse position tracker in JavaScript which would manually remove focus from the slider if the mouse moves too far away. This could be achieved by manually triggering the mouseup event on the input element. But with that being said the jQuery UI is probably your best option with the fewest headaches.

Thank you for reporting this, I will look into it. The mobile workaround for data coming from the browser to the engine via the ue4() function is achieved through the URL itself and itā€™s possible that something you have setup is breaking this functionality. However when performing mobile tests on Android the LoadFile() function seemed to work just fine and these URL changes were responsive. Are you sure you are not talking about the LoadContent() function? That is not the same as LoadFile() and manually reads the contents from your .pak file(s) and then uses LoadHTML() internally.

Youā€™re right, we are using LoadContent right now for testing and we used LoadHTML prior to that for reading a file on a sdcard. The ideal solution for us would be to allow for opening HTML files outside of the application, we currently store most of our data on a sdcard so we can quickly switch out what we need for each situation. And the LoadFile function did not allow for that, tomorrow I will implement LoadFile and test with that.

Do you have any plans on implementing a solution for opening files outside the application by path?
If not I suppose a solution for us would be to use DOM manipulation after the initial LoadFile, and correct accordingly.

Thank you for quick the response! :smiley:

There are two ways to load content in the browser, the first being via LoadHTML() and the second through LoadURL(). As mentioned the LoadContent() function is just a wrapper for LoadHTML() by automatically reading a file as a string from your .pak file(s) and the LoadFile() function is essentially a wrapper for LoadURL() by resolving the absolute path of the file and using the file:/// URL. So we probably want to keep the abstraction of the file system being within the project itself, either by manually utilizing the /UI folder at the same level as your /Binaries or /Content folders or making use of the internal project settings to either copy or package files in your /Content folder.

However you already mentioned a solution which is probably the appropriate implementation within the context of the plugin, and that is to setup your own custom loadSDCard() function within JavaScript. For instance if you load a dummy page using LoadFile() and the ā€œAdditional Non-Asset Directories To Copyā€ as outlined in the documentation you can then setup your own custom file loading function:


ue.interface.loadSDCard = function(url)
{
    document.location.href = 'file:///' + url;
};

And since this page was already loaded using file:/// via the LoadFile() function in blueprints you can call your custom loadSDCard() function with the desired file path once the ā€œreadyā€ event is triggered:

This is not possible if using LoadHTML() or LoadURL() directly since they utilize the http:// protocol and the browser will prevent you from using file:/// at that point. Note that this ā€œdummy fileā€ workaround is not a good idea for production as the absolute path could be different on various devices. The LoadFile() function is internally using GFilePathBase and this may be required to setup absolute file paths on mobile. So another option could be to use LoadFile() but prepend three ā€¦/ā€¦/ā€¦/ such that you can start your file path immediately after GFilePathBase. Here is how this would look in the example project:

Ok thanks! I have been using Bootstrap but it seems a bit heavy and not well-suited to games. Iā€™ll check out jQuery UIā€¦

[Edit] Hmm, now that I look at it, it seems like it hasnā€™t been updated in quite a while. Has that been a problem for you? Are there similar options that are more up-to-date?

jQueryUI does indeed seem like it hasnā€™t been updated for ages, but usually we use it for itā€™s functionality and use our own CSS and HTML :slight_smile:
Other options to Bootstrap could be Modernizr although I prefer Bootstrap.

Yeah, jQueryUI does still seem to work pretty well - Iā€™ll give it a try!

How do you manage imports? Is there some way to run a local server on game start, or do people use webpack or something to get around cross-origin blocking with local files? Sorry, Iā€™m kind of new to this.

Our plan is to compile it into one single file, using a tool like webpack. Makes it easier for us to swap out the files when needed, and maintain the folders as clean as possible. As bandwidth and latency is not a concern locally, there is minimal gain by sharing assets with different other UIā€™s.

Weā€™ve yet to test this, so feel free to correct me :slight_smile:

See guys this is exactly what Iā€™m talking about in my HTML5 commentsā€¦

https://forums.unrealengine.com/unreal-engine/marketplace/1393342-free-web-ui-html-css-js-interface?p=1660248#post1660248

Imagine being so lazy or incompetent that itā€™s been 2 months since 4.23.0 was released and there still isnā€™t a 4.23.1 hotfix (which is always released the following week). How much you want to bet most of the engine development resources were pulled away onto the new season of Fortnite instead? If only Source 2 would come out already because this engine is such a jokeā€¦

@ Itā€™s a true shame that HTML5 has been deprecated. Our startup has been going all in for our FPS game weā€™re making that targeted WebGL, and it performs really well. With the addition of multi-threading, 64 bit addressing for more memory, the browser can and will be the next big gaming platform. I emailed Tim Sweeney about this, pitching him on the vision that I and other developers have. I figured he would be open to committing further to the development of Unrealā€™s support for WebGL, but this is what he had to say about it:

I think he hasnā€™t checked out HTML5 recently, because thereā€™s been massive improvements to all these ā€œlow pointsā€ that he mentioned. Funny enough, shortly after this email correspondence, HTML5 support was deprecated. Now that I think about it, to expect a company like Epic to commit further to WebGL while they have so many other areas they are focused on (Fortnite, UE4 in enterprise, Epic Games Store) was naive. So I have a proposal for anyone out there who shares a similar vision of gaming on the web that I do:

  • A web first game engine with an editor that can be launched on the web, but made for the web from the ground up.

To further complement this, Iā€™m also building out a browser-based gaming platform for indies, to help empower them to find their early adopters using this innovative new way to distribute their work. Am curious what everyone thinks of this idea. And remember, if you want to currently export a game to the web, youā€™ll have to use Unity/Godot if you want to target WebGL. Epic sadly doesnā€™t have the time of day for this anymoreā€¦

Except to migrate it over to Github as a ā€œcommunity-supported platform extensionā€ā€¦ So this means it will be up to us as a community to band together to push this thing forward, and show Epic how wrong they are about abandoning this awesome platform!

Link to our Discord server for those interested: Wonder platform

@astlouis44 I think thatā€™s a great idea. There should definitely be a web-focused game engine and a web-based editor is icing on the cake. There is no question Tim Sweeny is naive because anyone involved in web technologies knows that web-based applications are the future. I always tell people that ā€œone day applications will no longer be installedā€ and like to use the example of ā€œwhy install Photoshop when you can go to photoshop.com and start editingā€ along with comparing it to Google Docs and how most people donā€™t install Microsoft Office these days because you can do Word/Excel processing completely in the cloud.

There is no question games have been going in this direction and will continue to over the years. Yes we are constantly pushing the limits of graphic fidelity and because of this texture sizes and whatnot continue to be insane, always pushing hardware to the limits (and that makes it difficult to apply to web-based games). But at this point it seems like they are getting into more cinematic development because while real-time ray tracing is great, it doesnā€™t really offer all that much improvement to actual games. How about we actually finish the forward renderer first? I mean it hasnā€™t been updated in 3 years now and still says ā€œexperimentalā€ on the documentation yet they advertise it directly on the unrealengine.com homepageā€¦talk about FALSE ADVERTISING!

So as you said it definitely seems this engine development is putting focus in completely different areas. I already tell people that ā€œUE4 is NOT a networked multiplayer engineā€ because letā€™s face it when it comes to dedicated server this engine is a joke. They just added the ability to set your server name and whatnot via command-line arguments in 4.23 which is like 4-5 years after they initially added Steam support. It was 100% hard-coded this engine time! Not to mention the networking/replication for the character movement system is some of the worst networking code Iā€™ve ever seen in an engine. Itā€™s just so pathetic.

But yea I definitely think a push for a web-based game engine would be a step in the right direction because it doesnā€™t seem like these guys here care much about anything that actually matters. Itā€™s all about adding more junk to create an impressive engine release each iteration without any focus on what us game developers actually needā€¦

1 Like