GameStyles.wiki
author Wuzzy
Sat, 06 Jan 2024 14:10:36 +0000
changeset 2265 5d951acf9b54
parent 2031 6ac51d7a29c9
permissions -rw-r--r--
LuaRules: Add math.random rule
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2025
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
     1
#summary Description of game styles in Hedgewars
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
     2
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
     3
= Game styles =
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
     4
== Introduction ==
2028
50a64e4112d8 GameStyles: More intro
Wuzzy
parents: 2027
diff changeset
     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
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
     6
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
     7
== Location and files ==
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
     8
All game style files are saved in `Data/Scripts/Multiplayer`.
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
     9
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    10
To create a style with the name `<name>`, create the file `<name>.lua`.
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    11
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    12
Here's the full list of supported files:
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    13
2027
97859a2b6c39 GameStyles: Indent
Wuzzy
parents: 2026
diff changeset
    14
 * `<name>.lua`: Mandatory. The script code. See below.
97859a2b6c39 GameStyles: Indent
Wuzzy
parents: 2026
diff changeset
    15
 * `<name>.cfg`: Optional. Config file to specify the default schemes to use. See below.
97859a2b6c39 GameStyles: Indent
Wuzzy
parents: 2026
diff changeset
    16
 * `<name>.hwp`: Optional. A sidecar [HWPFormat HWP file] containing additional resources for the style.
2025
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    17
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    18
== How it works ==
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    19
In the multiplayer menu, the player will select a style in the drop-down menu.
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    20
2030
1c0077fa2f65 GameStyles: Pointless!
Wuzzy
parents: 2029
diff changeset
    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.
2025
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    22
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    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.
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    24
2030
1c0077fa2f65 GameStyles: Pointless!
Wuzzy
parents: 2029
diff changeset
    25
The documentation of [LuaAPI Lua API] applies. Some special notes for styes:
2025
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    26
2030
1c0077fa2f65 GameStyles: Pointless!
Wuzzy
parents: 2029
diff changeset
    27
 * In `onGameInit`, you can read the scheme settings and also change them. You can overwrite pretty much all scheme settings here.
1c0077fa2f65 GameStyles: Pointless!
Wuzzy
parents: 2029
diff changeset
    28
 * In `onParameters`, you can parse the script parameter (which is also specified by the player in the game scheme).
2031
6ac51d7a29c9 GameStyles: add missing tick
Wuzzy
parents: 2030
diff changeset
    29
 * The functions `AddHog`, `AddMissionHog`, `AddTeam` and `AddMissionTeam` are pointless here. Teams are chosen by the players, hogs are placed by the engine
2030
1c0077fa2f65 GameStyles: Pointless!
Wuzzy
parents: 2029
diff changeset
    30
 * Campaign variables and mission variables are pointless here.
2025
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    31
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    32
== Config file format ==
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    33
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    34
The config file is a text file with 2 lines:
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    35
2027
97859a2b6c39 GameStyles: Indent
Wuzzy
parents: 2026
diff changeset
    36
 * Line 1: Name of the game scheme to select by default
97859a2b6c39 GameStyles: Indent
Wuzzy
parents: 2026
diff changeset
    37
 * Line 2: Name of the weapon scheme to select by default
2025
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    38
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    39
Both lines can use a special value: 
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    40
2027
97859a2b6c39 GameStyles: Indent
Wuzzy
parents: 2026
diff changeset
    41
 * `locked`: This scheme is locked and cannot be changed by the player
97859a2b6c39 GameStyles: Indent
Wuzzy
parents: 2026
diff changeset
    42
 * `*`: Don't select a default for this scheme
2025
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    43
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    44
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.
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    45
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    46
== Versioning ==
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    47
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.
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    48
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    49
The first version is `1`. Whenever you publish a changed version of the style, increase the number by 1.
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    50
9fd0936eddfb Add GameStyles page
Wuzzy <almikes@aol.com>
parents:
diff changeset
    51
Example name for a versioned style: `ExampleStyle_v4`.
2029
41a66f3490e1 GameStyles: DLC
Wuzzy
parents: 2028
diff changeset
    52
41a66f3490e1 GameStyles: DLC
Wuzzy
parents: 2028
diff changeset
    53
Versioned names are a requirement for inclusion into DLC.