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
#181
02/28/2011 (8:15 am)
A zip file with all the patched files for 1.1.3 would be very helpful for a lot of folks

Having the same problem Alan had earlier with the weird shaders issue, any tips? Sounds like I've missed out a step somewhere
#182
02/28/2011 (2:27 pm)
Solved the linker error via removing zlib from the projects, since the whole zlib seems to be included in the qtlibs. Rerunning project generation isnt gonna solve that. What it does is just creating a new project that has the libs and paths for the webkit in the solutions settings. But that only concerns stuff that happens before the binary is finished(linked).

Now theres a new error when i try to run the binary, mumbling something about a missing procedure entry in the Qt4Network.dll. Wonder if its some 64/32 bit incompatibility or ... dunno, ran out of ideas here.
#183
02/28/2011 (5:31 pm)
Quote:Now theres a new error when i try to run the binary, mumbling something about a missing procedure entry in the Qt4Network.dll.

Did you change the version of Qt you're using relative to the dlls in that folder? I got the same thing when I compiled 4.7.1 because I forgot to copy the dlls over after the recompile.
#184
03/01/2011 (4:54 am)
Possible solution to the shaders related crash that several people are having

Starting with the WebKitDemo.zip make the changes as listed in the thread

Delete the shaders folder from your webkitdemo game folder and replace it with a copy of a shaders folder from a normal 1.1.3 project

This seems to clear the problem for me after all other attempts failed
#185
03/01/2011 (10:38 am)
@Ted

I only ever compiled it once, so yeah, it cant be another version, thats why im so stumped.

What i did was removing Qt from the path-variable (since you cant expect users to install and compile it themselfes anyway) and move the necessary headers into our engines lib/Qt directory (since it makes no sense including additional 200+MB of Qt files in our source). I didnt change the source nor anything in the headers, the .lib or .dll files, except for removing intermediary/temporary files from the sourcefolders (which were additional 200+MB). I wonder if that might impact where the Torque.dll is looking for a procedure entry point, but i really dont know.
#186
03/02/2011 (6:51 am)
@Michael: Thanks, tried post #175 but did not seem to have any effect.

Compiled fine but still works the same - in-game, when clicking a form entry box on the web control, it gets focus and waits for me to type, just as before. When I try typing, my main playgui just traps the characters as if they are gameplay commands. So when trying to enter the letter "m" into the form, my game pops up the in-game map which is normally triggered by the "m" key.

Since we use AFX, on the onmousedown and onmouseup commands I had to tell it to also pass the command up to the parent, in order to get the guiwebctrl stuff to fire. But in this case it's a bit different since I actually want to disable game commands somehow when clicking on a web form, and then make sure the guiwebctrl::onkeydown fires properly. Seems like it's not even getting to your code because the keys are just firing game commands.

Anyhow, still great for now. But would be nice to figure this out. Will keep at it.
#187
03/02/2011 (8:51 am)
As far as zlib is concerned, you can try opening the zconf.h source file under the zlib project and read the following line:

"If you *really* need a unique prefix for all types and library functions, compile with -DZ_PREFIX. The "standard" zlib should be compiled without it."

Add -DZ_PREFIX to your "Command Line" --> "Additional Options" in the zlib project settings in Visual Studio under C/C++.
#188
03/08/2011 (9:57 am)
So, can anyone answer my question about the text input?

I feel a bit silly, that I must be missing something obvious, since nobody in this entire thread seems to mention that their keybinds are firing instead of text being entered into web forms.

How come I can get focus on the form fields, can click on any buttons on any web pages, but the minute I go to enter text it just sees the input as being my movement and control keys. How does the MyGameTSCtrl know to disable the main game keybinds while the focus is on a form field, so we can type text without it firing game commands?

Again, feeling a bit dumb on this one. Should be obvious but it's not, at least to me :)

Any advice? Thanks much...
#189
03/09/2011 (1:55 pm)
@Brian: I've been side tracked with other things right now. When I get a chance I will look at it, but hopefully you will come up with the solution before that:) I didn't want you to think I was ignoring you, I actually check this thread quite often.
#190
03/10/2011 (7:57 pm)
Thanks Philip... Have taken a couple days off from this myself. Will pick it up again maybe over the weekend. Must be something trivial that I am missing.
#191
03/15/2011 (9:10 pm)
Hi guys, I've changed the code a little bit to make it works for TGEA 1.8.2.

Just want to know if we need to have license to use the QTWebkit? Thanks for the help in advance.
#192
03/16/2011 (2:45 am)
Ok, a full recompile of the qt-libs did it.
We got it running with minimal header files (including the whole of qt would have been overkill), but for some reason it now it also needs QtXmlPatterns4.dll to run.

Nice resource and thank you from the Apok Team :D
#193
03/31/2011 (1:41 pm)
Very nice resource! I got it working in Beta 3 (thanks Philip & Konrad).

How hard would it be to setup an audio emitter that is assigned to stream the audio that comes from an object with a web material? It would be to be able to setup the sound as a 3d emitter so that you dont hear the sound everywhere.
#194
04/01/2011 (7:27 am)
@Adam: Can you enter data on web forms in your version?

As mentioned above, I can click in various fields, but when I try to type it just thinks I'm entering game commands (W key makes me just move forward, etc). Not sure if this affects everyone, or just those of us using AFX which uses a different playgui control and required a few modifications to inheritances to make this webkit work.

I also second your question about the sound emitter, although at least all this is client side so in multiplayer only your copy of the web control changes when you click on things and only you hear the sound. But it is heard everywhere in the level which is not ideal like you said.

Thanks.
#195
04/01/2011 (9:35 am)
Brian: No I cant. I dont need to be able to do so in my game so I havent looked into it.
#196
04/05/2011 (3:31 am)
@Brian I have the same issue with the click in fields issue on textures

In a GUI control, i.e. BrowserWnd.gui everything works fine except survey monkey where a tick box won't respond to a mouse click (space bar works though)

We are not using AFX and use the same playgui control as provided in the original source for the webkit mod

The only add on we have is at the end of the mousedown/up function we restored the original calls to pass the mouse click through so we can do raycasting on objects
#197
04/11/2011 (5:48 am)
Hi,
I followed every step to install the kit for Torque 3D Beta 3. I just regenerate the solution via MSVS2008, with no error (but a few warnings), i tried to launch the demo in Torque but it failed.

I got the following message : Unable to load game library: C:TorqueTorque 3D 2009 Pro 1.1 Beta 3DemosWebKitDemogameWebKitDemo_DEBUG.dll. Please make sure it exist and the latest DirectX is installed.

DirectX is up to date. Obviously the problem is there's no WebKitDemo_DEBUG.dll, but my question is why?

EDIT: I have re-regenerated, with no error. Now I have a WebKitDemo_DEBUG.dll, but I still have that message.
#198
04/12/2011 (7:06 am)
@DINF CLL:

You need the QT libraries as well, did you successfully compile QT and have the 4 required DLL files in your game folder?

I have them posted here if you want to grab them and save yourself the headache of compiling them yourself:

http://gambitrealm.com/installer/QT-DLLs.zip

Just put them in your game directory.

I also suggest you go with a RELEASE build rather than debug when compiling your project in VS2008.

If you already have the libraries and this is not the cause of the error, than not sure what is wrong.
#199
04/12/2011 (7:43 am)
Qt was succesfully compiled, I didn't know I had to add these dll in the folder. So thanks for the tip.

Now I can launch the demo, I can open the browser but I can't play the demo, it crashes. As for World editor and GUI editor, the window goes black and nothing happens.

And VS is already set on Release.
#200
04/14/2011 (5:44 am)
Hmm, that's odd. I actually can't help much more, because we ended up just integrating the kit into our existing project - we did not get the demo going with it either. When it worked properly in our own build we just moved on, so didn't bother getting the included demo running.

Perhaps try to use it in one of your projects that is already working, and see if that runs without issues.