Game Development Community

Torque 3D Embedded Browser (WebKit)

by Josh Engebretson · in Torque 3D Professional · 01/15/2010 (8:55 pm) · 305 replies

Hey guys,

Here are some highlights:

1) It uses QtWebKit which is based off Apple's WebKit, the same HTML5/Canvas based web rendering engine from Chrome, Safari, Adobe AIR

2) QtWebKit is *easily* the best designed embeddable web browser I have found in exhaustive travels... (I actually compiled Chrome from source at one point, not recommended). Qt is *extremely* well supported and owned by Nokia who recently paid $153,000,000 for it. So, it is probably going to be around for some time.

3) Flash works :)

4) It is setup as a GuiControl so interacts perfectly with mouse events, control overlap, filters...

There are currently 3 rendering modes:

torque.mythoslabs.com/static/t3d_web_rendertexture.jpg
1) Render to Texture: This mode renders the web view to an offscreen buffer and then uploads it to a GFXTexHandle. It uses the Torque GUI system input for mouse and keyboard. As we're rendering to a texture, compositing and rendering to 3d surfaces is possible. Flash renders as long as it is set to windowless mode in the HTML (not a big deal). Instead of using Flash for anything other than presentation/video playback, I would suggest looking into Canvas/HTML5/CSS animations/effects in this mode.

torque.mythoslabs.com/static/t3d_web_rendernative.jpg
2) Render Native: This mode integrates a native child window with Gui Control, giving the best of both worlds :) There is no need to render to texture as we're using an actual clipped child HWND which uses the Torque GUI system for position/extents and focus :) Transparency does not currently work, however under Vista/Win7 this should be possible. I should be able to get masking working with minimal effort, which would allow for shaped windows and transparent areas.

torque.mythoslabs.com/static/t3d_web_renderpopup.jpg
3) Render Popup: This mode pops up a standalone window, which is owned by the application and consistent in scripting with other modes. This is useful for things like integrated document browsing, tutorial video watching, game doc reading, game forum reading, etc... where you don't want to crowd your game interface with browser. However, you want CLOSE scripted integration with a standard browser (no worries of IE/Mozilla/Chrome), which isn't possible with the current "launch browser" functionality.

These modes work with HTTPS adding a nice way to authenticate to servers, secure purchasing, etc.

It is still pretty early in the development and the idea with the code release will be to get feedback on usability and features... especially WRT integration with Javascript on the page, etc.

EDIT: The first version has been released and is available HERE

Regards,
- Josh Engebretson
Mythos Labs, LLC
#221
06/23/2011 (7:10 am)
By the way, I can manually add a GuiWebControl to a menu GUI, and specify a URL for it, and a page will load and can be clicked on.

So I believe the webkit is working properly, just not in "render to texture" mode on objects within the game itself. Worked great in 1.1 B3...

Ideas?
#222
06/27/2011 (3:27 am)
@Brian same experience here

Some thoughts

There is a new postfx setup so a new shader could be the problem, reverted to the 1.1.3 shader same problem. The 1.1.3 - Final change list has some info about this might be worthy of investigation or may be a dead end

The textures actually do make a request for the url you specify so the webkit is there but is not rendering through
#223
06/27/2011 (6:59 am)
Thanks for the reply...

Still no luck at my end, please post if you find a workaround. I will do the same.

Frustrating, as this is the last piece we need to get working before our game is completely ported to 1.1 Final. Really need the in-game web content to work.

Cheers!
#224
06/29/2011 (6:14 am)
Bumping this thread, as it seems to have disappeared from the Torque 3D forum? Luckily I have it bookmarked :)

Anyhow, would love to get this resolved - does anyone have any ideas as to why the webkit is no longer "rendering to texture" as it did fine in 1.1 B3?

Thanks again
#225
07/05/2011 (3:30 am)
Busy with a release and testing currently here, so a quick response

Suggest compare the Theora Video on texture solution

http://www.garagegames.com/community/resources/view/21019

With the WebKit. Theora works and both are basically the same thing mapping a live texture buffer
#226
07/05/2011 (3:42 am)
@Brian
Just fishing here really... but one thing I came across when using texture targets with the Theora stuff was that things weren't working because of "Material::sAllowTextureTargetAssignments". This is a pretty weird flag that Josh put in there (and didn't document... tststs :) the purpose of which I'm not clear about but what it does is it suppresses the texture target lookup path if set to false. Which, for whatever odd reason, is the default. IMO, the flag should be ripped out as I see no purpose and just damage.

Anyways, make sure that flag is on when your material is being processed. Easiest thing is to just force it to true or just rip it out in your build.

But again, just fishing. Might have nothing to do with the problem you are seeing.
#227
07/05/2011 (5:43 am)
BINGO!

Now have webkit on a texture in 1.1 preview

Go to the end of the first post http://www.garagegames.com/community/resources/view/21019 and make the suggested change to the named texture

Changes are in the instancingMatHook.cpp file

Have some problems in getting mouse interaction with the webkit texture

If anyone else could validate this fix it would be great
#228
07/05/2011 (6:55 pm)
Yep, fix verified!

Thanks so much, this is great to have this resolved... And for the record, my mouse events are working fine just as they did in 1.1 B3. So all is good to go.

Woohoo!

indelta.com/installer/ncc1701-web2.jpg


#229
07/06/2011 (11:20 am)
@Jamie - "Have some problems in getting mouse interaction with the webkit texture"

Do you mean when you click on links nothing happens? We use AFX and had to change the inheritance of the various Gui elements, in order to pass the mouse event up through the parent controls. It's documented a couple of pages back if that's the issue you're having?

Because I can click on all links and the pages change as they should. We are using AFX 2.0 for T3D 1.1 Final (QR).

Now, text input into the form fields, that's another story - still doesn't work, the game thinks any key presses are game commands (move, etc) and does not pass the keyboard input to the web form input box even after successfully clicking in the box and getting focus there.

Anyone have any ideas on that on yet? Not critical for our game release, but sure would be neat to have that working.

P
#230
07/06/2011 (2:05 pm)
Passing all the keys to a router that uses an event such as when mouse is over the web gui (textured object or whatever) and use this event to pass the keys to the web gui instead.
#231
07/07/2011 (6:28 am)
We are having some problems, the performance seems very poor. Click link and it takes an age for any response, call openURL on the texture again it takes forever. Alt tab the Torque process into the brackground and then forward again and it improves

Could just be 1.1 preview Will look at 1.1 final we I get time

Thanks for the confirmation
#232
07/07/2011 (7:53 am)
Never tried it in preview, waited for 1.1 Final before doing our game port, so can't confirm whether performance is better in Final vs. Preview.

There is a one to two second lag after clicking links sometimes, before the page refreshes, but nothing that is giving us real problems. Hopefully it's just an issue with your preview version.

We are able to run Flash video on a texture that is huge, hundreds of units high, floating out in space while we fly our shuttle around it, and only a slight choppiness is noted on the video.

I'll tell you though that as we put in the new zones and portals using 1.1 Final, the game performance is increasing tenfold, which in turn makes the webkit behave better. Seems to take a hit obviously the more you have going on in the surrounding scene. The zones are taking this issue out of the equation which is nice.

Good luck, let us know if it gets better for you with 1.1 Final...
#233
07/19/2011 (7:43 am)
Have it working in final

Needed a few tweaks to deal with the change in the object types as a result of the changes in 1.1 final

Performance is good thankfully!

Do get a slight stall during loading right about where the webkit diffuse texture missing errors appear

Would be nice to speed up the startup process
#234
07/28/2011 (2:49 am)
This looks way too useful... Any chance of getting a 1.1 final resource posted for this?

EDIT: I've had a stab at it from the comments, and I can get an embedded browser to show a webpage if I have renderMode="native" specified...but not if I have renderMode="texture". Do that, and I get a nice little call stack:

msvcr90d.dll!fastcopy_I(void * dst=0x0c181040, void * src=0x00000c80, int len=53477288)  + 0x5a bytes	C
 	msvcr90d.dll!_VEC_memcpy(void * dst=0x069cbdc8, void * src=0x0bb60840, int len=202903616)  + 0x52 bytes	C
>	JoshTest_OPTIMIZEDDEBUG.dll!ThreadSafeRef<ThreadSafeDeque<GuiWebCore::Command *>::Node>::~ThreadSafeRef<ThreadSafeDeque<GuiWebCore::Command *>::Node>()  Line 205 + 0x26 bytes	C++
 	JoshTest_OPTIMIZEDDEBUG.dll!GuiWebCore::run()  Line 132	C++
 	JoshTest_OPTIMIZEDDEBUG.dll!Thread::run(void * arg=0x00000000)  Line 135 + 0x9 bytes	C++
 	JoshTest_OPTIMIZEDDEBUG.dll!ThreadRunHandler(void * arg=0x032fff60)  Line 61	C++
 	msvcr90d.dll!_callthreadstartex()  Line 348 + 0xf bytes	C
 	msvcr90d.dll!_threadstartex(void * ptd=0x036e78c0)  Line 331	C

now I'm wondering which one of the 233 comments I missed!?
#235
10/13/2011 (2:50 pm)
1.1 final resource ?
#236
10/14/2011 (1:59 pm)
It is coming up on 2 years since writing this (warts and all), and it is still generating a gig+ monthly downloads off our site. GarageGames owns the resource. We'll be doing a site update soonish and can't guarantee we'll continue to host the files.

Regards,
- Josh Engebretson
Mythos Labs
#237
10/20/2011 (4:08 pm)
Just caught this post, thanks for the heads up Josh! :) Here's the link hosted on our site:static.garagegames.com/static/resources/T3DWebKitDemo.zip

I'll update the blog.

Edit: Ok, it's pointing at us now.
#238
10/20/2011 (6:29 pm)
@Eric will anyone at GarageGames be able to create a stable release with all the dependencies compatible with T3D 1.1 final and even sell it as an official plugin?
#239
10/21/2011 (2:37 am)
@Eric: BIG +1 on Tomer's question

Also has this webkit been officially transfered to GG as part of GG available tech to GG customers like us? :-)

( i dont want to "sell" a game/app that incorprates a technology that someone else developed without their expressed permission to do so )

#240
10/22/2011 (3:44 am)
I am not getting into the complicated legal rights, or if this should be a free plug-in or sold, and if sold who will get the money and how the percentage should be split.

Just saying that as a community resource it should be maintained in a better way and updated by GarageGames in such a way that even people that do not have the C++ knowledge and/or the time to read all the posts in this thread and patch the download can still use it...