ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


client_server_detection

This is an old revision of the document!


Clientside/Serverside detection

You can check if a script is running serverside, clientside or in singleplayer using functions provided by ACSUtils.

Terminology

  • Server – an engine instance that runs the gameplay code.
  • Client – an engine instance that runs the rendering code and controls a player on the server.

In singleplayer, the same engine instance is both a server and a client. Both IsServer() and IsClient() return true in singleplayer.

In ZDoom and GZDoom multiplayer (but not Zandronum's), all players are both servers and clients, just like in singleplayer.

Functions

  • bool IsServer() – returns true if the script is running on a server.
  • bool IsClient() – returns true if the script is running on a client.
  • bool IsServerOnly() – returns true if the script is running on a server that is not also client.
  • bool IsClientOnly() – returns true if the script is running on a client that is not also server.

Writing robust multiplayer code

The definitions above enable writing ACS code that functions correctly in both singleplayer and multiplayer without singleplayer being a special case.

client_server_detection.1566781543.txt.gz · Last modified: 2019/08/26 04:05 by korshun