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:

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.

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.

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
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:

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.

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.

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
About the author
http://www.TheEngine.Co
#42
Cookie support definitely should be added (and is supported by QtWebKit)
Edit: Glad you got it compiling and running, that is encouraging! :)
02/18/2010 (3:06 pm)
Hi Jason, from the README.TXTQuote:
SSL Note: In order to support https protocol Qt must be built with OpenSSL, I have tested this with the binary Qt release and it does work. However, I have not built Qt against OpenSSL. I'll give this a shot soon.
Cookie support definitely should be added (and is supported by QtWebKit)
Edit: Glad you got it compiling and running, that is encouraging! :)
#43
And yeah, it compiled the first try with zero errors. Well made package with clear instructions on how to set up Qt. One suggestion, instead of stating 'after' for the -MP4, may want to rephrase it as 'at the end of' or add inline, etc. I only state that because I could definitely see someone adding it as a new line after, as that's what 'after' usually means to me when following such instructions (hundreds, maybe even thousands of them in phpBB modding... ugh).
02/18/2010 (9:31 pm)
Sorry, missed the note. Thanks for pointing it out.And yeah, it compiled the first try with zero errors. Well made package with clear instructions on how to set up Qt. One suggestion, instead of stating 'after' for the -MP4, may want to rephrase it as 'at the end of' or add inline, etc. I only state that because I could definitely see someone adding it as a new line after, as that's what 'after' usually means to me when following such instructions (hundreds, maybe even thousands of them in phpBB modding... ugh).
#44
Stock standard install, WebKitDemo.exe never closes after exiting. Have to kill it with Task Manager. Windows XP SP3 32bit.
The Enter key does nothing in the browser. This is a bit of a pain if I want to have tight community integration with in game forum support.
It took all night, but I got OpenSSL built, Qt configured and built with OpenSSL, and finally WebKitDemo rebuilt with Qt+OpenSSL and even loaded an HTTPS link just fine. Tested by logging into my last.fm account. ;)
I'm going to a convention this weekend, starting in... about 8 hours... I wont be able to post steps for OpenSSL til at least Sunday. It was a pain, but now that I have figured out where and why, it should be easy once the steps are posted.
02/19/2010 (3:12 am)
A few more things:Stock standard install, WebKitDemo.exe never closes after exiting. Have to kill it with Task Manager. Windows XP SP3 32bit.
The Enter key does nothing in the browser. This is a bit of a pain if I want to have tight community integration with in game forum support.
It took all night, but I got OpenSSL built, Qt configured and built with OpenSSL, and finally WebKitDemo rebuilt with Qt+OpenSSL and even loaded an HTTPS link just fine. Tested by logging into my last.fm account. ;)
I'm going to a convention this weekend, starting in... about 8 hours... I wont be able to post steps for OpenSSL til at least Sunday. It was a pain, but now that I have figured out where and why, it should be easy once the steps are posted.
#45
I won't be able to really look at this until after GDC, but:
If you run a debug session, do a break all when hung at exit, and see if you're inside winmm.dll ... I fixed this and am trying to recall what it was, hrm.
The keyboard input code was cleaned up considerably recently and I had to use some less tested code when building against the beta. That is probably something dead simple, if you track it down feel free to post a fix. Native Mode will probably work as that is using a separate keyboard handler.
That's great news on the OpenSSL :) I am looking forward to seeing those steps myself :)
- Josh
02/19/2010 (3:41 am)
Hey Jason, thanks for the reports. I think both of those have to do with getting this packaged up against Beta 1.1I won't be able to really look at this until after GDC, but:
If you run a debug session, do a break all when hung at exit, and see if you're inside winmm.dll ... I fixed this and am trying to recall what it was, hrm.
The keyboard input code was cleaned up considerably recently and I had to use some less tested code when building against the beta. That is probably something dead simple, if you track it down feel free to post a fix. Native Mode will probably work as that is using a separate keyboard handler.
That's great news on the OpenSSL :) I am looking forward to seeing those steps myself :)
- Josh
#47
02/22/2010 (4:52 pm)
Josh, is there an easy way to know when a document has finished loading? Like a callback or an event maybe? Since I'll be using webkit for our game's info windows, I thought that I could also give it a try to make it fetch xml data.
#48
As for building Qt with OpenSSL:
Configuring OpenSSL requires Perl. I use ActivePerl which is the same suggested by the OpenSSL instructions.
I built OpenSSL 0.9.8l for Win32 and thus these instructions are based on that.
I ran all commands under Visual Studio 2008 Command Prompt.
Instructions can be found on my NWN project's website here: www.tairisnadur.com/portal.php?page=qt_openssl_t3d
02/22/2010 (6:03 pm)
Okay, I spent most of the day trying to duplicate the issue where the executable wouldn't close completely after exiting. Unfortunately, no matter what I did I could not reproduce it. Though I did encounter a crash, I couldn't reproduce that either.As for building Qt with OpenSSL:
Configuring OpenSSL requires Perl. I use ActivePerl which is the same suggested by the OpenSSL instructions.
I built OpenSSL 0.9.8l for Win32 and thus these instructions are based on that.
I ran all commands under Visual Studio 2008 Command Prompt.
Instructions can be found on my NWN project's website here: www.tairisnadur.com/portal.php?page=qt_openssl_t3d
#49
Also wishing there was a preview post button...
Fixing it all now.
02/22/2010 (6:08 pm)
ugh... Editing a post that uses MarkupLite removes backslashes... fixing now.Also wishing there was a preview post button...
Fixing it all now.
#50
The stock build works fine and compiles/links. We tried to merge this into our current existing 1.1b build and keep getting these defined errors. Any clues on what might be happening here? It appears zlib is being linked in the stock build so I am a bit confused why that would compile find with the qtcore4 dll and not in ours.
02/22/2010 (6:14 pm)
Both JC and I tried to port this into our build and ended up with the same issue.15>zlib.lib(inflate.obj) : error LNK2005: _inflateInit2_ already defined in QtCore4.lib(QtCore4.dll) 15>zlib.lib(inflate.obj) : error LNK2005: _inflate already defined in QtCore4.lib(QtCore4.dll) 15>zlib.lib(inflate.obj) : error LNK2005: _inflateEnd already defined in QtCore4.lib(QtCore4.dll) 15>zlib.lib(deflate.obj) : error LNK2005: _deflate already defined in QtCore4.lib(QtCore4.dll) 15>zlib.lib(deflate.obj) : error LNK2005: _deflateEnd already defined in QtCore4.lib(QtCore4.dll) 15>zlib.lib(deflate.obj) : error LNK2005: _deflateInit2_ already defined in QtCore4.lib(QtCore4.dll) 15>zlib.lib(compress.obj) : error LNK2005: _compress2 already defined in QtCore4.lib(QtCore4.dll)
The stock build works fine and compiles/links. We tried to merge this into our current existing 1.1b build and keep getting these defined errors. Any clues on what might be happening here? It appears zlib is being linked in the stock build so I am a bit confused why that would compile find with the qtcore4 dll and not in ours.
#51
02/22/2010 (6:14 pm)
All fixed. Installed a javascript based highlighting package on my own website and posted the instructions there. See the previous post that had the instructions for the link.
#52
02/22/2010 (7:38 pm)
@Jason: you could use the quote tag, that doesn't break backslashes.
#53
02/23/2010 (7:41 am)
i was compiled the Qt and the Engine, but when i run webkitdemo.exe popup show
#54
Having the same issue. Anyone know why this happens?
btw. This WebKit is awesome.
02/23/2010 (11:19 am)
@ JoshuaHaving the same issue. Anyone know why this happens?
btw. This WebKit is awesome.
#55
i was try it on windows xp with directx 9.0c update Feb 2010, and it show the errors,
but when i try on windows 7 machine, it's all ok except the AJAX
02/24/2010 (12:19 am)
sorry, my mistake,i was try it on windows xp with directx 9.0c update Feb 2010, and it show the errors,
but when i try on windows 7 machine, it's all ok except the AJAX
#56
If anyone else has this problem and fixes it, please share how you did it. I've been trying to figure out what the problem is for the past two days with no luck yet.
02/24/2010 (10:49 am)
We have it compiled in our client now, but I'm getting the same error as Yadhi. On the other programmer's system and on our artist's systems it works fine. I run it on my system and get the same error as above. Some research on the net indicates that this is usually a DLL conflict, though doing a search of my drive for the DLL shows that only one version exists. It should also be noted that I can compile the stock version no problem. If anyone else has this problem and fixes it, please share how you did it. I've been trying to figure out what the problem is for the past two days with no luck yet.
#57
1) Make sure you don't have another QtCore4.dll in your path or copy the Qt dll's into your client's folder.
2) Make sure you're compiling Qt with VS2008 SP1, and install the VS2008 SP1 runtime package on the problem machine http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en
3) Switch to /MD code generation (Torque 3D Beta 1.1 supports this and check out the demo's project.conf for additional settings)
For deployment, you'll want to include the VS runtime as part of the setup or add it along side your binaries (easy to do). When dealing with multiple code modules, it is preferable to not use a statically linked runtime.
BTW, Steam is the latest user of embedded WebKit. So, in good company :)
02/24/2010 (11:00 am)
In massive GDC crunch here, sorry.1) Make sure you don't have another QtCore4.dll in your path or copy the Qt dll's into your client's folder.
2) Make sure you're compiling Qt with VS2008 SP1, and install the VS2008 SP1 runtime package on the problem machine http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en
3) Switch to /MD code generation (Torque 3D Beta 1.1 supports this and check out the demo's project.conf for additional settings)
For deployment, you'll want to include the VS runtime as part of the setup or add it along side your binaries (easy to do). When dealing with multiple code modules, it is preferable to not use a statically linked runtime.
BTW, Steam is the latest user of embedded WebKit. So, in good company :)
#58
02/25/2010 (12:41 am)
I've done all of the above. I did notice there were about 10 copies of the QTCore.dll, I think from where it ran the generateprojects. But I removed them all except the ones in the game dir and in the lib/bin directories. Still haven't figured it out. Will keep hacking away here, and if I find a solution will post it in here.
#59
02/25/2010 (12:55 am)
You should be able to see where it is loading QtCore4.dll from in the output windows of a debug session, just to triple check. Have you tried building/running against Beta 1.1?
#60
02/25/2010 (1:42 am)
You can also try Dependency Walker http://dependencywalker.com/ on the trouble box to see what DLLs it is loading or missing. I have run this on XP, so shouldn't be an XP vs Vista/Win7 issue, also tested on 32/64 bit.
Torque 3D Owner Jason Parker
EDIT: Also, any chance for cookie support? Remember me check boxes don't have any effect.