This wiki was in read-only mode for many years, but can now be edited again. A lot of information will need to be updated.
Plug-ins: Difference between revisions
No edit summary  | 
				|||
| Line 1: | Line 1: | ||
BZFS can be built to support the loading of external libraries as plug-ins. These plug-ins can alter or replace the logic applied by the server, as well as automate many common tasks  | BZFS can be built to support the loading of external libraries as plug-ins. These plug-ins can alter or replace the logic applied by the server, as well as automate many common tasks.    | ||
Plug-ins are a simpler way to apply modifications to the game, as they do not require the server owner to modify or recompile his/her BZFS application. By using the [[BZFS API]] plug-ins are also able to be mixed and matched in an easy way.  | Plug-ins are a simpler way to apply modifications to the game, as they do not require the server owner to modify or recompile his/her BZFS application. By using the [[BZFS API]] plug-ins are also able to be mixed and matched in an easy way.  | ||
| Line 6: | Line 6: | ||
Plug-ins are compile dynamic link libraries, that are built for the same OS/RuntimeEnvironment as the BZFS server that hosts them. On [http://www.microsoft.com/windows Microsoft Windows] they are built as [http://en.wikipedia.org/wiki/Dynamic-link_library DLL] files. On [http://www.linux.org Linux] and other [http://www.unix.org/ Unix]-like systems they are built as .so files.  | Plug-ins are compile dynamic link libraries, that are built for the same OS/RuntimeEnvironment as the BZFS server that hosts them. On [http://www.microsoft.com/windows Microsoft Windows] they are built as [http://en.wikipedia.org/wiki/Dynamic-link_library DLL] files. On [http://www.linux.org Linux] and other [http://www.unix.org/ Unix]-like systems they are built as .so files.  | ||
On load, plug-ins install a number of callbacks and event handlers with the hosting BZFS that are called when specific events happen. This allows the plug-in to perform additional actions on these events, or if need be, alter the results of the default logic of the server.  | ==Use==  | ||
Plug-ins are loaded at startup by the '''-loadplugin''' option, or at run time with the ''/loadplugin'' command. If the full path to the plug-in is not specified, then [[BZFS]] will search a number of known sub directories for the plug-in as it attempts to load it. Using a valid path to the plug-in on load is highly recommended.  | |||
===Parameters===  | |||
Some plug-ins take parameters that are passed to the plug-in on load. This is often a numeric value, or a path to a file. To pass a parameter to a plug-in, simply add a ',' after the plug-in name or path, and then add the parameter. Parameterscan not have spaces, due to the way [[BZFS]] parses command line options and / commands.  | |||
On load, plug-ins install a number of callbacks and event handlers with the hosting [[BZFS]] that are called when specific events happen. This allows the plug-in to perform additional actions on these events, or if need be, alter the results of the default logic of the server.  | |||
==BZFS API==  | ==BZFS API==  | ||
Revision as of 03:31, 19 February 2007
BZFS can be built to support the loading of external libraries as plug-ins. These plug-ins can alter or replace the logic applied by the server, as well as automate many common tasks.
Plug-ins are a simpler way to apply modifications to the game, as they do not require the server owner to modify or recompile his/her BZFS application. By using the BZFS API plug-ins are also able to be mixed and matched in an easy way.
Overview
Plug-ins are compile dynamic link libraries, that are built for the same OS/RuntimeEnvironment as the BZFS server that hosts them. On Microsoft Windows they are built as DLL files. On Linux and other Unix-like systems they are built as .so files.
Use
Plug-ins are loaded at startup by the -loadplugin option, or at run time with the /loadplugin command. If the full path to the plug-in is not specified, then BZFS will search a number of known sub directories for the plug-in as it attempts to load it. Using a valid path to the plug-in on load is highly recommended.
Parameters
Some plug-ins take parameters that are passed to the plug-in on load. This is often a numeric value, or a path to a file. To pass a parameter to a plug-in, simply add a ',' after the plug-in name or path, and then add the parameter. Parameterscan not have spaces, due to the way BZFS parses command line options and / commands.
On load, plug-ins install a number of callbacks and event handlers with the hosting BZFS that are called when specific events happen. This allows the plug-in to perform additional actions on these events, or if need be, alter the results of the default logic of the server.
BZFS API
All plug-ins are linked to the BZFS API. This programing layer provides the interface to the BZFS application. All events and functions that a plug-in can call are in the BZFS API.
Standard plug-ins
The BZFlag Source distribution contains a number of plug-ins that are maintained by the project developers. These plug-ins are located in the /plugins directory.
As of February 18th 2007, CVS HEAD ( version 2.1) contains the following plug-ins:
- airspawn
 - bzfscron
 - chathistory
 - flagStay
 - hiddenAdmin
 - HoldTheFlag
 - keepaway
 - killall
 - koth
 - logDetail
 - nagware
 - playHistoryTracker
 - python
 - recordmatch
 - RogueGenocide
 - SAMPLE_PLUGIN
 - serverSideBotSample
 - shockwaveDeath
 - soundTest
 - teamflagreset
 - thiefControl
 - timedctf
 - torBlock
 - weaponArena
 - wwzones
 
Third Party Plug-ins
A number of non-developers have created plug-ins for BZFS, and usually release them on the BZFlag Forums.
Plug-in Development
Todo: describe the basics of plug-in development.