2025
|
1 |
#summary Description of game styles in Hedgewars
|
|
2 |
|
|
3 |
= Game styles =
|
|
4 |
== Introduction ==
|
2028
|
5 |
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].
|
2025
|
6 |
|
|
7 |
== Location and files ==
|
|
8 |
All game style files are saved in `Data/Scripts/Multiplayer`.
|
|
9 |
|
|
10 |
To create a style with the name `<name>`, create the file `<name>.lua`.
|
|
11 |
|
|
12 |
Here's the full list of supported files:
|
|
13 |
|
2027
|
14 |
* `<name>.lua`: Mandatory. The script code. See below.
|
|
15 |
* `<name>.cfg`: Optional. Config file to specify the default schemes to use. See below.
|
|
16 |
* `<name>.hwp`: Optional. A sidecar [HWPFormat HWP file] containing additional resources for the style.
|
2025
|
17 |
|
|
18 |
== How it works ==
|
|
19 |
In the multiplayer menu, the player will select a style in the drop-down menu.
|
|
20 |
|
|
21 |
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. Because the hogs are already placed, `AddHog` and `AddTeam` are pointless here.
|
|
22 |
|
|
23 |
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.
|
|
24 |
|
|
25 |
The documentation of [LuaAPI Lua API] applies. Some things we like to highlight:
|
|
26 |
|
|
27 |
In `onGameInit`, you can read the scheme settings and also change them. You can overwrite pretty much all scheme settings here.
|
|
28 |
|
|
29 |
In `onParameters`, you can parse the script parameter (which is also specified by the player in the game scheme).
|
|
30 |
|
|
31 |
== Config file format ==
|
|
32 |
|
|
33 |
The config file is a text file with 2 lines:
|
|
34 |
|
2027
|
35 |
* Line 1: Name of the game scheme to select by default
|
|
36 |
* Line 2: Name of the weapon scheme to select by default
|
2025
|
37 |
|
|
38 |
Both lines can use a special value:
|
|
39 |
|
2027
|
40 |
* `locked`: This scheme is locked and cannot be changed by the player
|
|
41 |
* `*`: Don't select a default for this scheme
|
2025
|
42 |
|
|
43 |
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.
|
|
44 |
|
|
45 |
== Versioning ==
|
|
46 |
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.
|
|
47 |
|
|
48 |
The first version is `1`. Whenever you publish a changed version of the style, increase the number by 1.
|
|
49 |
|
|
50 |
Example name for a versioned style: `ExampleStyle_v4`.
|