This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| new:multiplayer [2018/02/19 10:21] – created korshun | new:multiplayer [2019/09/05 20:46] (current) – removed korshun | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Multiplayer support ====== | ||
| - | |||
| - | These functions enable proper multiplayer support in mods. | ||
| - | |||
| - | ===== Terminology ===== | ||
| - | |||
| - | * A ZDoom instance is a **server** if it runs gameplay code. | ||
| - | * A ZDoom instance is a **client** if it runs non-gameplay code that only affect the visuals. | ||
| - | * A ZDoom instance can be both a client and a server (e.g. in singleplayer) | ||
| - | |||
| - | ==== Examples | ||
| - | |||
| - | * Zandronum client -- **client** | ||
| - | * Zandronum server -- **server** | ||
| - | * Singleplayer -- **both client and server** | ||
| - | * ZDoom multiplayer nodes -- **both client and server** | ||
| - | |||
| - | Note that ZDoom multiplayer is serverless, and all players run both clientside and serverside code. | ||
| - | |||
| - | ===== Functions ===== | ||
| - | |||
| - | * '' | ||
| - | * '' | ||
| - | | ||
| - | * '' | ||
| - | * '' | ||
| - | |||
| - | Using '' | ||
| - | < | ||
| - | if (IsServer()) | ||
| - | { | ||
| - | // Run serverside gameplay code. | ||
| - | } | ||
| - | if (IsClient()) | ||
| - | { | ||
| - | // Draw hud, spawn effects. | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | Use '' | ||
| - | < | ||
| - | if (!IsClient()) | ||
| - | error(" | ||
| - | </ | ||