PUBLISHING

The site www.shockwave.com, an important site of games at the internet, defines a pattern for the publication of games that we like and will use.

There are a page having details (how to play, requirements etc.) and, clicking a button, opens a new window having the game to play on-line.

The Visual C# Express has a powerfull publishing system that will put your application (remember that this DMU site is about games) at your site (you need to have a site, of course).

At our case, select: Project | Ba1 Properties | Publish

You need to type the address of your site and the name of a folder that will be created automaticaly.

Clicking Options you type the name of the publisher of the game: you.

Press Publish Now and your application will go to your site and your browser (IE, please) will open in the page Ba1/publish.htm and wil begin the transmission of the application from the site to a cache at your computer.

Like you are not a "certified publisher" will appear a "security warning" saying that you can not be "verified".

TIP: It's a good idea to say to the user that this window will appear and need to be ignored. And that it will need to liberate the firewall.

After the download (It's a good idea to say to the user the size of the download) the game/application will appear on a new window.

You can verify that, at your site server, you have many new files:

The Microsoft publishing system ("Click Once") we are using is very powerful. Everytime the user goes back to the page of the game and tries to play it, if a copy is at the user computer, this copy will be used. There will have a new download only if the game has a new version - this is verified automaticaly. And the download will be only of the new parts of the application!

The cache is at the folder Documents and Settings of the user.

TIP: The "normal user" doesn't knows that he can run the game clicking the .EXE file here and will return to you site/page where he can see some ads, or need to have a registration or some other "dirt trick".

This solution we have presented for publishing is better than to have the game embeded inside the page (a Web Browser application: here we have a Web application, an installed application, but webpage dependent) where the user will need to wait the download that can be big. This problem of a big and unexpected download was the cause of the disaster of the Java applets and some others web3D games architectures.

And... SURPRISE! SURPRISE!... you can put the launch of your game at any .HTML page. You need to copy from the last (pay attention: THE LAST!!!) publish.htm file created, these lines and put at your page:

<SCRIPT LANGUAGE="JavaScript">
<!--
runtimeVersion = "2.0.0";
directLink = "http://your-site/Ba1/Ba1.application";
function Initialize(){
  if (HasRuntimeVersion(runtimeVersion)){
    InstallButton.href = directLink;
    BootstrapperSection.style.display = "none";
  }
}
function HasRuntimeVersion(v){
  var va = GetVersion(v);
  var i;
  var a = navigator.userAgent.match(/\.NET CLR [0-9.]+/g);
  if (a != null)
    for (i = 0; i < a.length; ++i)
      if (CompareVersions(va, GetVersion(a[i])) <= 0)
		return true;
  return false;
}
function GetVersion(v){
  var a = v.match(/([0-9]+)\.([0-9]+)\.([0-9]+)/i);
    return a.slice(1);
}
function CompareVersions(v1, v2){
  for (i = 0; i < v1.length; ++i)
  {
    var n1 = new Number(v1[i]);
    var n2 = new Number(v2[i]);
    if (n1 < n2)
      return -1;
    if (n1 > n2)
      return 1;
  }
  return 0;
}
-->
</SCRIPT> 
<BODY ONLOAD="Initialize()">  
 
<TABLE  ONCLICK="window.navigate(InstallButton.href)"><TR> <TD>
<A ID="InstallButton" HREF="http://your-site/ba1/setup.exe"><IMG SRC="image-of-your-button.jpg">
</A></TD> </TABLE>
 
</BODY>

The tags of your page need to be between the BODY tag.

Like we did here (you can see the Source Code of this page using the IE resources) ! Click to launch the application! You need to liberate the firewall.




PREVIOUS LESSON NEXT LESSON
T.CONTENTS HOMEPAGE