GameStyles.wiki
author Wuzzy
Fri, 27 Nov 2020 13:45:03 +0100
changeset 2200 b285ffef13e0
parent 2031 6ac51d7a29c9
permissions -rw-r--r--
Translations: Add TOC

#summary Description of game styles in Hedgewars

= Game styles =
== Introduction ==
A *game style* (or “style” for short) is a type of script that can be selected in multiplayer games. They are used to customize multiplayer games. A list of all official styles can be found [https://hedgewars.org/node/2946 here].

== Location and files ==
All game style files are saved in `Data/Scripts/Multiplayer`.

To create a style with the name `<name>`, create the file `<name>.lua`.

Here's the full list of supported files:

 * `<name>.lua`: Mandatory. The script code. See below.
 * `<name>.cfg`: Optional. Config file to specify the default schemes to use. See below.
 * `<name>.hwp`: Optional. A sidecar [HWPFormat HWP file] containing additional resources for the style.

== How it works ==
In the multiplayer menu, the player will select a style in the drop-down menu.

When the game is started, Hedgewas will initialize the script with all the player-chosen settings and also automatically places all hedgehogs and possibly some land objects (specified in the game scheme), just like in a normal game.

With an empty script, this game will behave exactly like a normal, unscripted game, with the same rules as a normal battle. Any code you write in the script will make Hedgewars deviate from the default gameplay.

The documentation of [LuaAPI Lua API] applies. Some special notes for styes:

 * In `onGameInit`, you can read the scheme settings and also change them. You can overwrite pretty much all scheme settings here.
 * In `onParameters`, you can parse the script parameter (which is also specified by the player in the game scheme).
 * The functions `AddHog`, `AddMissionHog`, `AddTeam` and `AddMissionTeam` are pointless here. Teams are chosen by the players, hogs are placed by the engine
 * Campaign variables and mission variables are pointless here.

== Config file format ==

The config file is a text file with 2 lines:

 * Line 1: Name of the game scheme to select by default
 * Line 2: Name of the weapon scheme to select by default

Both lines can use a special value: 

 * `locked`: This scheme is locked and cannot be changed by the player
 * `*`: Don't select a default for this scheme

By default, the schemes are locked. If you use a locked scheme, the style will be initialized with the settings of the “Default” scheme, but you can always overwrite that in your script code.

== Versioning ==
For community-created styles, we strongly suggest to follow a naming convention: Append a version number to the name. The style name is the form `<name>_v<number>`, where `<version>` is the version number.

The first version is `1`. Whenever you publish a changed version of the style, increase the number by 1.

Example name for a versioned style: `ExampleStyle_v4`.

Versioned names are a requirement for inclusion into DLC.