It works!
by Neil Marshall · 03/07/2006 (1:28 pm) · 27 comments
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:


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:


About the author
#2
03/07/2006 (1:44 pm)
Very cool =)
#3
How does it get the art assets, etc? How do you see something like this being used?
03/07/2006 (1:48 pm)
Neil-How does it get the art assets, etc? How do you see something like this being used?
#4
03/07/2006 (1:58 pm)
sweet, now lets get those casual games out there
#5
03/07/2006 (2:02 pm)
Very cool! :)
#6
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]
03/07/2006 (2:09 pm)
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]
#7
03/07/2006 (2:24 pm)
Uber-cool! :) Gotta try this out soon! Great work there, Neil!
#8
03/07/2006 (2:29 pm)
Well, that is brilliant!
#10
Does the user need any local files?
What's the loading time like before the splash screen comes up?
03/07/2006 (3:24 pm)
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?
#11
Can you give some high level details about how this works Neil?
Matt
03/07/2006 (4:15 pm)
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
#12
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?
03/07/2006 (4:39 pm)
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?
#13
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.
03/07/2006 (5:29 pm)
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.
#14
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 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.
03/07/2006 (6:28 pm)
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 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.
#15
03/07/2006 (7:50 pm)
Very innovative.
#16
[Off Topic]
My Firefox looks the same =)
Whats new... and then Ventura... And this...
[/Off Topic]
03/07/2006 (10:32 pm)
Very coool...[Off Topic]
My Firefox looks the same =)
Whats new... and then Ventura... And this...
[/Off Topic]
#17
03/07/2006 (10:45 pm)
Damn cool feat! Congrats
#18
03/07/2006 (11:03 pm)
@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.
#19
No problem. I can understand the concern, actually I'm glad that you guys are concerned with it.
03/08/2006 (5:30 am)
Stephen Zepp:No problem. I can understand the concern, actually I'm glad that you guys are concerned with it.
#20
03/08/2006 (5:54 am)
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.
Torque 3D Owner Michael Vanderpool