Previous Blog Next Blog
Prev/Next Blog
by date

It works!

It works!
Name:Neil Marshall
Date Posted:Mar 07, 2006
Rating:4.8 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Neil Marshall

Blog post
I finally got the Torque Plugin to work!

If you're interested in giving it a spin, the code and installation instructions are here. If you're willing to help out great! Just fix something and email the code to me and I'll put it in the zip file so that other people can build on top of it.

TGE Plugin source code


It took me a while to get to this point. It turns out that the error message in my last post was caused by a couple different problems.

1) The processor wasn't being detected, so it didn't know how to draw properly. This was due to the fact that I had disabled the assembly language code in an attempt to get it to compile. Once I re-enabled it, and figured out the linking errors, the top of the console.log file showed that it picked up my processor.

2) The next problem that I spotted was DirectInput wasn't loading. It turns out that this wasn't really the issue either, but I managed to fix it with some help from people in the IRC channels. It turns out the appInstance variable was always 0 and I had to find the HINSTANCE of the application which the npPlugin architecture didn't supply me properly (It gives me an instance of the plugin and the browser window, but neither of those worked).

3) And finally, the cause of the crash was failing to run the run(argc, argv) function. I didn't realize that the bootup process started sooner in the code then where I was looking. Once I got those 3 lines of code to execute the plugin didn't crash and I made it to the main menu.

Next up is to look into the reasons why the mouse doesn't work too well in the GUI screens, but it works perfectly in the game itself (If you can get there). If anyone knows the reason, please let me know.

And now for the ever popular screenshots:



Recent Blog Posts
List:08/18/06 - Experimenting with TSE
07/19/06 - TGE Browser Plugin Online
05/29/06 - TGE Browser Plugin
05/02/06 - The browser plugin - progress
04/24/06 - TGE Browser Plugin
04/11/06 - More TGE in the Browser
03/24/06 - TGE Plugin now working in IE 6.0
03/07/06 - It works!

Submit ResourceSubmit your own resources!

Michael Vanderpool   (Mar 07, 2006 at 21:42 GMT)   Resource Rating: 4
wow, very nice. i will have to try it out later

Matt Fairfax   (Mar 07, 2006 at 21:44 GMT)
Very cool =)

Dave Young   (Mar 07, 2006 at 21:48 GMT)   Resource Rating: 5
Neil-

How does it get the art assets, etc? How do you see something like this being used?

Anthony Rosenbaum   (Mar 07, 2006 at 21:58 GMT)
sweet, now lets get those casual games out there

Tom Bushby   (Mar 07, 2006 at 22:02 GMT)
Very cool! :)

Jorgen Ewelonn   (Mar 07, 2006 at 22:09 GMT)
back in -94 some less tech-savvy friends asked me what this new thing called inteeernet was going to be like in 10 to 12 years time .. boy was I wrong !

Absolutely brilliant job on this one Neil, I think this will have a bigger impact on the TAP than XBLA (no offense GG). This really is Torque in the common-place.

Also have a feeling this possibility alone will sell the TAP to a heep of new developers.

[edit]I hear it's conscidered polite to atleast spell the name of the blog-author correctly these days[/edit]
Edited on Mar 07, 2006 23:23 GMT

Stefan Beffy Moises   (Mar 07, 2006 at 22:24 GMT)
Uber-cool! :) Gotta try this out soon! Great work there, Neil!

Tom Bentz   (Mar 07, 2006 at 22:29 GMT)
Well, that is brilliant!

Hokuto   (Mar 07, 2006 at 22:34 GMT)
? TGE as a Web plug in?
did I get this right?

Chris Labombard   (Mar 07, 2006 at 23:24 GMT)
What platofrms does this run on? Just windows? or will it run on Mac and/or linux as well?

Does the user need any local files?

What's the loading time like before the splash screen comes up?

Matt Hughson   (Mar 08, 2006 at 00:15 GMT)   Resource Rating: 5
What the hell!? How is this possible!? What is going on here!?

Can you give some high level details about how this works Neil?

Matt

Chris Labombard   (Mar 08, 2006 at 00:39 GMT)
I can tell you exactly how it works...

Neil went hiking in the woods one day and discovered a magic code fairy. He captured the fairy. To create the plugin he placed the fairy on his keyboard and sprayed it with water from a squirt bottle until it tap danced the plugin code for him.

Is that about accurate?

Stephen Zepp   (Mar 08, 2006 at 01:29 GMT)
I'm not trying to burst any bubbles here, but it's not as difficult as it appears (as Neil has demonstrated--with a bit of sweat and work, he got it up and running in just a few weeks).

The main problems:

1) As far as I am aware, he's running this as an ActiveX control. This means that not only do your customers have to trust enough to enable the control, but it also opens up any devs using this technique to being a floodgate for spyware and even more malevolent malware piggybacking through TGE to gain access (due to the ActiveX control capability) to pretty much anything on the browser's computer.

2) As an activeX control, it's windows only.

Neil--great work man, I'm not trying in any way to downplay what you've done, it is pretty cool! I just needed to get it said about some of the issues regarding this style of implementation, and why GG has not released play in a browser functionality in this manner.

Neil Marshall   (Mar 08, 2006 at 02:28 GMT)
Okay, let's see if I can answer all of these:

Dave Young:
"How does it get the art assets, etc?"

Right now it reads a windows registry entry
HKEY_LOCAL_MACHINE\Software\TGE\main.cs = c:\example\
In the future I'd like to be able to specify multiple main.cs' there and then in the object code on the web page have a <param> that points to the particular main.cs that you want to run.

"How do you see something like this being used?"
Exactly what it looks like really. To run the TGE and possibly script things here and there.

Hokuto:
"TGE as a Web plug in? did I get this right?"

Yes.

Chris Labombard:
"What platofrms does this run on? Just windows? or will it run on Mac and/or linux as well?"

It could theoretically run on Mac and Linux. But the fact that I don't have a Mac and my Linux PVR is non-functional, well I won't be programming that any time soon. Someone could though, I put the code on TDN.

"Does the user need any local files?"

Yes. As I pointed out earlier, the code looks in the windows registry for the main.cs and the data directories. You need the files on the hard drive, but I hope, in the future to have the ability for TGE to download the files on the fly. Actually some games (Age of time is the one that I know of) already kinda sorta have this ability. It would just be a matter of combining code snippits together to get it to work.

"What's the loading time like before the splash screen comes up?"

On my 3GHz box it's just a couple seconds before the GG logo shows up. It's noticable, but it's no Adobe Acrobat.


Matt Hughson:
"What the hell!? How is this possible!? What is going on here!?

Can you give some high level details about how this works Neil?"

I think Chris Labombard summed it up nicely. ;)
I just recompiled the TGE executable as a DLL and added all the nice plugin goodness to it. Instead of loading in a window, it just loads in the space given to it by the Web Browser.


Stephen Zepp:
"I'm not trying to burst any bubbles here, but it's not as difficult as it appears (as Neil has demonstrated--with a bit of sweat and work, he got it up and running in just a few weeks)."

You're right. It was just a bit of sweat and tears. The only thing painful about it really was I've never worked on a Windows C++ app before so there is definatly a learning curve there for me.

"1) As far as I am aware, he's running this as an ActiveX control."

Yes and no. I'm TRYING to use an ActiveX control. Right now it's Firefox only so it's a Netscape "np" plugin. I hope to either get it compiling as an ActiveX natively or I'll just have to figure out how to put an ActiveX wrapper around it. www.mozilla.org/projects/plugins/plugin-host-control.html

"This means that not only do your customers have to trust enough to enable the control, but it also opens up any devs using this technique to being a floodgate for spyware and even more malevolent malware piggybacking through TGE to gain access (due to the ActiveX control capability) to pretty much anything on the browser's computer."

They have to trust it yes (FireFox and IE7 appear to work very similar in this regard. They both popup a bar and ask you if you are sure you want to install it). As for piggybacking on this control, I don't know about that. The script files have to be installed on your machine for them to execute so that requires the user to agree. I guess if there is a game using this plugin that has an execute script command that is vulnerable somewhere then someone could make a web site which looks like a game and takes the contents of the HD or something. Right now there is no browser scripting in it, so that wouldn't really be possible to do.

'2) As an activeX control, it's windows only."
Again, it's not an ActiveX control yet. Yes it is windows only because that's all I have programmed, but the np plugin format also works on the mac and linux as far as I know. It's the same plugin format that Flash and Quicktime are programmed in so it does work in theory.
Edited on Mar 08, 2006 02:32 GMT

Vashner   (Mar 08, 2006 at 03:50 GMT)
Very innovative.

James Laker (BurNinG)   (Mar 08, 2006 at 06:32 GMT)
Very coool...

[Off Topic]
My Firefox looks the same =)

Whats new... and then Ventura... And this...
[/Off Topic]

Thomas "Man of Ice" Lund   (Mar 08, 2006 at 06:45 GMT)
Damn cool feat! Congrats

Stephen Zepp   (Mar 08, 2006 at 07:03 GMT)
@Neil: Just wanted to make sure that you understand I wasn't trying to pick on you--it -is- damn cool! The biggest issue when this was brought up as a generic TGE possibility for us as a company was "well, first virus that gets launched by TGE in a browser is going to destroy our rep", and it was shot down as an idea in this type of package.

Neil Marshall   (Mar 08, 2006 at 13:30 GMT)
Stephen Zepp:

No problem. I can understand the concern, actually I'm glad that you guys are concerned with it.

Dave Young   (Mar 08, 2006 at 13:54 GMT)   Resource Rating: 5
Maybe some collaboration is in order to do an 'authorized' version, which will stamp the program with an 'authorized by GarageGames' stamp. It could at least dampen bad press from the inevitable viral attacks.

Neil Marshall   (Mar 08, 2006 at 14:07 GMT)
I don't really see why that would be needed. If you put the plugin code in your game, you're responsible. It's not part of the default package, just like every other code resource.

If there was an authorized version then GarageGames would be setting themselves up to take the blame which is what they want to avoid.

Dave Young   (Mar 08, 2006 at 14:25 GMT)   Resource Rating: 5
Mainly because it would help the user discern between versions which are going to run a program which is pre-authorized as unharmful, as opposed to a program which is not authorized, and may contain harmful code.

It says to the user that "GarageGames knows about this and if something goes wrong, it's not related to us, it's related to the developer."

I guess if anyone did something so stupid, it's not exactly untraceable ;)

Jay Barnson   (Mar 08, 2006 at 17:22 GMT)
I'm really excited to see where this goes. Congratulations, Neil.

Alexander "taualex" Gaevoy   (Mar 09, 2006 at 04:36 GMT)
My $0.02 about security: we can wrap a sandbox around this plugin, so only one folder - with art will be accessible.

Joe Rossi   (Mar 21, 2006 at 21:01 GMT)
igLoader has a technique to protect against that kind of security threat. Some type of encryption/key system... But I don't remember how he said it works exactly.

Jukka Kokkonen   (Apr 24, 2006 at 21:02 GMT)
Very nice.

Although, I don't see much use for it for creating web-browser based games... Mainly due to security reasons and people being too afraid (rightfully) to download any "suspicious" new browser plugins.

Basically, I think the security is a problem since TGE is a complex piece of work, so it's likely to have some security flaws. Add the easy accessibility to the TGE code, and you just may have a major security problem.

(Also, add the quite big size (of the dll / data) to that, and TGE isn't such a great web browser game anymore)

However, I do see one really interesting aspect to this... The possibility of HTML and TGE integration. HTML/javascript being an easy and very quick way to develop even complex GUIs, and TGE giving the ability to have a 3D viewport, the combination might be something interesting... Perhaps a RPG game with 3D viewport and HTML based inventory, conversation, etc. menus. If done properly, it just might work. :)

Also, another useful implementation might be editor menus... HTML would be a fast way to develop menus for an editor, then just glue the TGE 3D viewport to that and you have a quick and easily extensible editor up and running for whatever purpose.

(A bit far fetched ideas maybe, but interesting nevertheless. ;)

Tim Fisher   (Aug 09, 2006 at 09:17 GMT)
igLoader just got a sandbox.

You must be a member and be logged in to either append comments or rate this resource.