Patcher Page Reference

From Multiverse

Jump to: navigation, search

Contents

Overview

When a user connects to your world, the Multiverse Client initially updates media assets required for the world. When the Client first connects to the world, it downloads all the assets; subsequently, it downloads new or updated assets. While the Client is downloading these files, it displays a web page called the patcher page within a special browser control.

You can use the default patcher page, which is not very visually interesting, or you can create your own patcher page on your web server and display you like. Basically, you can put anything on the patcher page that you can put on a web page.

The default patcher page is http://update.multiverse.net/patcher/world_patcher.html. As described in World Settings File Reference, during development you can specify a different patcher page URL in the world settings file. When a game is added to the Multiverse Network for access by consumers, the master server specifies the patcher page URL.

The patcher page is rendered into a 640x480 Internet Explorer browser control.

Methods

The browser control has the following JavaScript methods:

  • window.external.OnLoaded()
Called when the html page is fully loaded, so that the patch thread can start
  • window.external.Abort()
Called when the client wishes to abort the update
  • window.external.OK()
Called when the client is ready to proceed

The patcher page should contain the following Javascript methods:

  • HandleFileFetchStarted
  • HandleFileFetchEnded
  • HandleFileAdded
  • HandleFileModified
  • HandleFileIgnored
  • HandleFileRemoved
  • HandleStateChanged
  • HandleUpdateStarted
  • HandleUpdateCompleted
  • HandleUpdateAborted (Not yet implemented)

If these methods return false, they abort the default handler. Currently only HandleUpdateAborted has an interesting default handler, which pops up a dialog and exits the patcher.

Customizing the patcher page

When customizing the patcher page, you must keep:

  • All the existing JavaScript in the page's <head> tag.
  • The form elements (though you can place them anywhere you like).
  • The id attributes of the three div elements to display the progress bar.

Default patcher HTML

The HTML of the default patcher page is shown below and is also available at http://update.multiverse.net/patcher/world_patcher.html. The code below does not include the <head> of the page, which includes some JavaScript that you must keep.

<body onload="HandleLoad()">

<h3>Multiverse World Patcher</h3>
<div id="status" class="statusmsg">Initial status</div>
<br>
<form>
  <div id="progress_bar" 
       style="position:relative; 
              background-color:navy; 
              width:300px; 
              height:15px; 
              font-size:1px;">
    <div id="progress_background" 
         style="position:absolute; 
                top:1px; 
                left:1px; 
                width:298px; 
                height:13px; 
                background-color:lightgrey; 
                font-size:1px;">
    </div>
      <div id="progress_foreground" 
           style="position:absolute; 
                  top:1px; 
                  left:1px; 
                  width:0px; 
                  height:13px; 
                  background-color:darkgreen; 
                  font-size:1px;">
     </div>
  </div>
  <br>
  <table width="300">
    <tr>
      <td>
        <input type="button" id="log_button" value="Show Log" class="mv button" onclick="ToggleLog()">
      </td>
      <td width="100%"/>
      <td>
        <input type="button" id="cancel_button" value="Cancel" class="mv button" onclick="window.external.Abort()">
      </td>
      <td>
        <input type="button" id="ok_button" value="Ok" class="mv button" disabled="true" onclick="window.external.OK()">
      </td>
    </tr>
  </table>
  <br>
</form>
<br>
<div id="log" class="statusmsg"></div>
<br>
<div style="display: none">
  <br>
  Bytes: <input type="text" id="bytes_fetched">/<input type="text" id="bytes_needed">

  <br>
  Files: <input type="text" id="files_fetched">/<input type="text" id="files_needed">
</div>
</body>
Personal tools