1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>BZFS API Documentation: Introduction</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css"
href="http://www.bzflag.org/general.css">
<link href="http://www.bzflag.or/favicon.ico" rel="shortcut icon">
<style type="text/css">
<!--
.style1 {
font-size: 16px;
font-weight: bold;
}
.style2 {font-size: 36px}
.style4 {font-size: 18px; font-weight: bold; }
.style5 {color: #999999}
-->
</style>
</head>
<body>
<table bgcolor="#dddddd" border="0" cellpadding="0" cellspacing="1"
width="100%">
<tbody>
<tr height="50" valign="top">
<td colspan="2">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td align="right" bgcolor="#013571"><img
src="http://www.bzflag.org/images/logo2-1.jpg" alt="logo"></td>
<td align="left" bgcolor="#818181"><img
src="http://www.bzflag.org/images/logo2-2.jpg" alt=""></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr valign="top">
<td>
<table width="100%">
<tbody>
<tr>
<td align="center" valign="top" width="14%">
<table align="center" bgcolor="#ffffff" border="1"
bordercolor="#000000" width="179">
<tbody>
<tr>
<td align="center"><span class="style4"> Contents </span></td>
</tr>
<tr>
<td align="center"> <strong>Overview </strong> </td>
</tr>
<tr>
<td align="center"> <a href="index.html">Introduction
</a> </td>
</tr>
<tr>
<td align="center"> <a href="general.html">General
Info </a> </td>
</tr>
<tr>
<td align="center"> <strong>Reference </strong> </td>
</tr>
<tr>
<td align="center"> <a href="entrys.html">Entries</a>
</td>
</tr>
<tr>
</tr>
<tr>
<td align="center"> <a href="types.html">Types</a> </td>
</tr>
<tr>
</tr>
<tr>
<td align="center"> <a href="events.html">Events</a>
</td>
</tr>
<tr>
</tr>
<tr>
<td align="center"> <a href="functions.html">Functions</a> </td>
</tr>
<tr>
</tr>
<tr>
<td align="center"> <strong>Examples </strong> </td>
</tr>
<tr>
<td align="center"> shockwaveDeath </td>
</tr>
<tr>
</tr>
<tr>
<td align="center"> scoreReset </td>
</tr>
<tr>
</tr>
</tbody>
</table>
</td>
<td width="86%">
<table align="left" bgcolor="#ffffff" border="0"
cellpadding="2" cellspacing="2" width="100%">
<tbody>
<tr>
<td valign="top">
<center><b>BZFS API Documentation</b></center>
</td>
</tr>
<tr>
<td align="left">
<p class="style1 style2" align="center">Introduction</p>
<p><strong>* This document:</strong></p>
<p>This document is a description of the BZFlag
plugin system and its associated API. It will attempt to explain how
to make a plugin, what you can do in a plugin, and what the basic API
features are.<br>
</p>
<p><span style="font-weight: bold;">* What is a
plugin?</span><br>
</p>
<p>A plugin is a compiled code module
that is loadable at runtime by the BZFlag game server (bzfs) that can
change the way that the server runs. Since plugins are compiled,
plugins need to be built on the platform they are to be run with. This
means that a plugin built for windows will not work on Linux, and
vice versa. Plugins are written in C++ as Dynamic Libraries, ether as
a DLL on windows or a .so file on Linux or OS X.</p>
<p><strong>* What can a plugin do?</strong></p>
<p>Plugins can install event handlers for a number
of events in bzfs. Events are actions that happen in the game, such as
the capture of a team flag, or the death of a player. Plugins can then
call API functions that can change the game state in response to the
event, such as sending a text message, activating a world weapon, or
kicking a player. All plugin actions are event driven. A plugin is
always called first by the server in response to an action.</p>
<p><strong>* What do I need to make a plugin, and
what do I need to know?</strong></p>
<p> To make a plugin you will need to know at least
C and should be familiar with the C++ language. Many of the API calls
and structures will use C++, but they can be called in a C "style" if
you wish. Since plugins are compiled code you will need a compiler for
your OS and the knowledge of how to use it. The sample plugin has
makefiles and Windows VC projects that you can use as a basis. If you
are on windows, there is a free version of visual studio that you can
use to build plugins. You can download it for free from
http://lab.msdn.microsoft.com/express/visualc/default.aspx . You will
also need access to some of the source files from the BZFlag source
distribution. If you are on windows, the required header and library
files are included with the installer in the API folder. Other OSes can
get the full source tree from www.bzflag.org</p>
<p><strong>* How do I start a new plugin project?</strong></p>
<p> If you are not familiar with making projects and
using makefiles, the BZFlag source tree provides a template plugin in
/plugins/SAMPLE_PLUGIN/. This is an empty plugin project for most
OSs. All you have to do is replace the term SAMPLE_PLUGIN with your
plugin name. Do this to every file name that contains the term
SAMPLE_PLUGIN. Also open each file ( even the .sln and .vcprog, don't
double click them yet) in a text editor ( notepad ) and do a search and
replace. Replace SAMPLE_PLUGIN with your plugin name. The project will
then be ready to build. </p>
</td>
</tr>
<tr>
<td>
<div class="style5" align="left">Previous</div>
<div align="right"><a href="general.html">Next</a></div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr valign="bottom">
<td cellpadding="2" bgcolor="#000000">
<table bgcolor="#ffffff" border="0" cellpadding="2" width="100%">
<tbody>
<tr>
<td align="right"> <span class="copyright">copyright
© <a href="http://www.bzflag.org/wiki/CurrentMaintainer">Current
Maintainer</a> 1993-2006 </span> </td>
</tr>
<tr>
<td>
<table bgcolor="#ffffff" border="0" cellpadding="2"
width="100%">
<tbody>
<tr>
<td align="center"> <a href="http://www.opengl.org/"><img
src="http://www.bzflag.org//images/opengl.gif" alt="opengl" border="0"
height="31" width="88"></a> <a
href="http://sourceforge.net/project/?group_id=3248"><img
src="http://sourceforge.net/sflogo.php?group_id=3248&type=1"
alt="sourceforge" border="0" height="31" width="88"></a> <a
href="http://sourceforge.net/donate/index.php?group_id=3248"><img
src="http://images.sourceforge.net/images/project-support.jpg"
alt="Support This Project" border="0" height="32" width="88"> </a> <a
href="http://www.linuxgames.com/"><img
src="http://www.bzflag.org/images/linuxgames.gif" alt="linuxgames"
border="0" height="31" width="88"></a> <a
href="http://www.telefragged.com/"><img
src="http://www.bzflag.org//images/telefragged.gif" alt="telefragged"
border="0" height="31" width="88"></a> </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</body>
</html>
|