Creation/Dev/Update Packages

From Graal Bible

Update Packages allow you to package files together and allow the user to manually download them when they log in, or force them to download the files when they log in. This is good for downloading certain images or ganis the first time a player logs in to a server or when they are updated, and it will help prevent the game form looking weird while everything loads individually.

Note: This is missing some information, but should be enough to get you started on update packages. Experiment with it, some fun stuff may happen :).

Using Update Packages

Update Packages are based on plain-text files, and have a fairly simple syntax.

You first need to add a folder option so that the .gupd file is downloadable.

file    *.gupd

You then need to create a file called basepackage.gupd. This will specify the subpackages.

Base Package

Here is the general syntax of a basepackage.gupd file.

GRPKG001
NAME My Packages
VERSION 1.23
PLATFORM any
SUBPACKAGE package_images.gupd
SUBPACKAGE package_sounds.gupd
USECHECKSUM false
PROTECTOVERWRITE true
FLAG popupforoptionalpackages=false

Lets break it apart piece by piece.

GRPKG001

All .gupd files must start with this line.

NAME My Packages

The name of the package. In this case it's name is "My Packages".

VERSION 1.23

The version of the package. In this case, the version is "1.23" Increasing the version number will result into the Button "Update" to appear in the Updates menu under the desired catagory. Incase the packadge is manditory it will automaticly update.

SUBPACKAGE package_images.gupd

This line gives the filename of a subpackage, which can contain other files. You can have as many subpackages as you want.

USECHECKSUM false

A checksum is a modulated number of all the data within a file. It basically allows the download to be checked for any erronous data that may have appeared during the transfer.

PROTECTOVERWRITE true

Unsure. Though it may be self-explanitory.

MODE required

Each package is "optional" by default. Available package modes:
base - updates are checked at each login; files the player doesn't have will be downloaded directly. (This methode can be slow, depends on the ammount of files listed in the package)
required - updates are checked if the local version differs.
optional - only downloaded if the user downloads it trough the "Update" tab and/or the "popup" menu (See below)

FLAG popupforoptionalpackages=false

Incase the package MODE isn't set to required it will result in a popup appearing once the player logs on, asking him/her if he/she wants to dowload the package in question.

PLATFORM any

What platform(s) this pacakge is available to. In this case it will be available to people on all platforms. Available platforms: mac,win,linux,any.

Sub Packages

Subpackages work similar to the base package.

General Subpackage file

GRPKG001
NAME Images
VERSION 1.00
PLATFORM any
DESCRIPTION
Maloria Images. <img src="images/alchemybottlered.gif">
DESCRIPTIONEND
SUBPACKAGE images_guimain.gupd
USECHECKSUM false
PROTECTOVERWRITE true
FLAG popupforoptionalpackages=false

The only new parameter here is DESCRIPTION. It contains a description of the package. It currently supports limited HTML markup. You must put DESCRIPTIONEND at the end of a description.

This points to another Subpackage, which contains the actual files.

GRPKG001
NAME GUI Images
VERSION 1.00
PLATFORM any
DESCRIPTION
Images used for Maloria's GUIs.
DESCRIPTIONEND
MODE required
FILE levels/webgifs/maldefaultwindow.png
FILE levels/webgifs/maldefaultscroll.png
FILE levels/webgifs/maldefaultbutton.png
FILE levels/webgifs/maldefaultcheck.png
FILE levels/webgifs/maldefaultslider.png
FILE levels/webgifs/maldefaulttextedit.png

This is the general layout of a subpackage that contains files. The only new attributes here are FILE and MODE.

If you have MODE required then the files will be downloaded the first time the user connects to your server,and every time the VERSION changes. If you habe MODE optional then the user will have to download the files himself.

FILE levels/webgifs/maldefaultcheck.png

This is the location on the clients computer to save the files, relative to the Graal directory.