This wiki is archived and useful information is being migrated to the main bzflag.org website

Editing Plug-ins

Jump to: navigation, search

Warning: The database has been locked for maintenance, so you will not be able to save your edits right now. You may wish to copy and paste your text into a text file and save it for later.

The administrator who locked it offered this explanation: Archived wiki

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
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 one of the more popular ways to apply modifications to the game. They do not require modifications of the BZFS application source code so it can be kept up to date with out the need to constantly apply patches. They have also proven to be a very simple method for distributing modifications from developers to players.
+
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==
 
==Overview==
Plug-ins are compiled 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.
  
 
==Use==
 
==Use==
Line 19: Line 19:
  
 
==Standard plug-ins==
 
==Standard plug-ins==
The [[BZFlag Source]] distribution contains a number of plug-ins that are maintained by the project [[:Category:Developer|developers]].
+
The [[BZFlag Source]] distribution contains a number of plug-ins that are maintained by the project [http://my.bzflag.org/wiki/index.php/Category:Developer developers].
 
These plug-ins are located in the ''/plugins'' directory.
 
These plug-ins are located in the ''/plugins'' directory.
  
{{Template:Plug-in list}}
+
As of August 2009, [[BZFlag SVN|SVN]] TRUNK( version [[BZFlag 3.0|2.99]]) contains the following plug-ins:
 +
 
 +
*[[airspawn]]
 +
*[[bzfscron]]
 +
*[[chathistory]]
 +
*[[chatlog]]
 +
*[[customflagsample]]
 +
*[[fastmap]]
 +
*[[flagStay]]
 +
*[[hiddenAdmin]]
 +
*[[HoldTheFlag]]
 +
*[[HTTPServer]]
 +
*[[httpTest]]
 +
*[[keepaway]]
 +
*[[killall]]
 +
*[[koth]]
 +
*[[logDetail]]
 +
*[[mapchange]]
 +
*[[nagware]]
 +
*[[Phoenix]]
 +
*[[playHistoryTracker]]
 +
*[[python(plug-in)|python]]
 +
*[[rabidRabbit]]
 +
*[[recordmatch]]
 +
*[[regFlag]]
 +
*[[RogueGenocide]]
 +
*[[SAMPLE_PLUGIN]]
 +
*[[serverControl]]
 +
*[[serverSideBotSample]]
 +
*[[shockwaveDeath]]
 +
*[[soundTest]]
 +
*[[teamflagreset]]
 +
*[[thiefControl]]
 +
*[[timedctf]]
 +
*[[torBlock]]
 +
*[[unrealCTF]]
 +
*[[weaponArena]]
 +
*[[webadmin]]
 +
*[[webReport]]
 +
*[[webstats]]
 +
*[[wwzones]]
  
 
==Third Party Plug-ins==
 
==Third Party Plug-ins==
A number of non-developers have created plug-ins for BZFS, and usually release them on the [https://forums.bzflag.org/ BZFlag Forums].
+
A number of non-developers have created plug-ins for BZFS, and usually release them on the [http://my.bzflag.org/bb/ BZFlag Forums].
 
+
=== On Linux ===
+
  
 
Here are the steps to compile a hypothetical third party plug-in named "Example":
 
Here are the steps to compile a hypothetical third party plug-in named "Example":
  
==== For versions older than 2.4.3 ====
+
# In the plugins directory of the BZFlag source tree run the command '''./newplugin.sh Example'''
 
+
# To save time type ''ctrl/c'' to stop the command when it says "Running autogen.sh, please wait..."
# In the plugins directory of the BZFlag source tree run the command '''./newplug.sh Example'''
+
# Remove all of the files from the newly created plugins/Example directory (they were created by newplugin.sh)
# Remove all of the files from the newly created plugins/Example directory (they were created by newplug.sh)
+
 
# Copy all of the distributed Example files into the plugins/Example directory
 
# Copy all of the distributed Example files into the plugins/Example directory
 
# In the top-level BZFlag source directory run '''autogen.sh''', '''configure''', and '''make''' as usual
 
# In the top-level BZFlag source directory run '''autogen.sh''', '''configure''', and '''make''' as usual
  
==== For versions on or after 2.4.3 ====
 
 
# Store the distributed plugin files into the plugins/''Example'' directory
 
# In the top-level BZFlag source directory run:
 
<div style="margin-left: 45px;">
 
./autogen.sh
 
./configure --enable-custom-plugins=''Example''
 
./make
 
 
Note that you can use a comma-separated list to specify multiple plugins to be built:
 
./configure --enable-custom-plugins=''Example'',''AnotherExample'',''AnotherPlugin''
 
</div>
 
 
When that finishes successfully the plug-in should be ready to use as described above.
 
When that finishes successfully the plug-in should be ready to use as described above.
 
=== On Mac OS X ===
 
 
In Xcode on Mac OS X, follow these instructions:
 
 
# Create a new target for your plug-in.
 
#* '''Xcode 5 (and below)''': Click on the BZFlag project name in the project navigator. Click Add Target, and create a new C/C++ Library. Name the plugin, and select "Dynamic" for type.
 
#* '''Xcode 6''': Click on the BZFlag project in the project navigator. Go the File > New > Target. When prompted for the template for the target, under the "OS X" section, select the "Framework & Library" section and finally select "Library." In the next dialog, select "None (Plain C/C++ Library)" for the Framework and "Dynamic" for the type.
 
# In the project navigator, move the new library target from the bottom of the screen into the "Targets" group.
 
# Click on the BZFlag project name in the project navigator again. In the list of targets, select the BZFlag application target. In the Build Phases tab, in the Target Dependencies pane, add your new library target as a dependency of the application target. Also add it to the Copy Files phase for the PlugIns directory.
 
# Select your new library target. Select the Build Settings tab, and locate the Other Linker Flags option. Add the option "-undefined dynamic_lookup"
 
# Find the Architecture build setting for your new library. Make sure it is the same architecture as the main codebase, or click Levels, click the Architecture setting under your library target, click Other, and delete the setting. This will make it assume the overall project build architecture.
 
# If your plug-in uses "plugin_utils.h", then ensure that under Build Phases the '''libplugin_utils.a''' library is listed under "Link Binary With Libraries"; add the library if it is not already listed.
 
# Find the Executable Prefix build setting for your new library, and delete the "lib" setting.
 
# Add your source file(s) to the project, and make them members of your library target; ensure you select the "Copy items if needed" checkbox and to choose "Create groups."
 
# Build as usual.
 
  
 
==Preparing a Linux BZFS==
 
==Preparing a Linux BZFS==
  
In order to run plugins in BZFS, you need to recompile it with the --enable-shared option on the configure script.
+
For becoming BZFS able to run plugins you need to recompile it with the --enable-shared and --enable-plugins options on the configure script.
  
''Note that as of 2.4.0 the BZFlag configuration has --enable-shared automatically enabled.''
+
$ ./configure --enable-shared --enable-plugins --disable-client;
 
+
$ ./configure --enable-shared --disable-client;
+
 
       make;
 
       make;
 
       make install;
 
       make install;
Line 80: Line 87:
 
==Plug-in Development==
 
==Plug-in Development==
 
{{DoDoc|Describe the basics of plug-in development.}}
 
{{DoDoc|Describe the basics of plug-in development.}}
 
==History==
 
The plug-in system was added in BZFlag V. 2.0.4 and was initially met with a lukewarm reception by some of the core developers and the maintainer. The community has since embraced the concept and built a multitude of useful modifications, many that have been incorporated into the project as standard plug-ins.
 
 
For Version 3.0 major changes to the [[BZFS API]] have been made to increase its lifespan.
 
  
  

Please note that all contributions to BZFlagWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see BZFlagWiki:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel | Editing help (opens in new window)