Plug-ins

Questions, comments, and news on the server side plug-ins and it's API
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5182
Joined: Fri Dec 13, 2002 4:11 am
Location: https://github.com/OmniTanks
Contact:

Plug-ins

Post by JeffM » Sat May 21, 2005 12:47 am

BZFS now supports plug-ins ( in CVS at least ).

Plug-ins can be used to make the server change how it normaly does things. Plug-ins are loaded at runtime from external modules, and have access to a number of bzfs's internal features. They most often respond to events, but can can be used to implment things such as cusom "/" commands or chat filters.

So far the first 2 sample plugins are;

shockwaveDeath
Causes a shockwave to fire when ever anyone dies. Ether from the server like a world weapon, or from the player who died.

playHistoryTracker
Provides a "UT" style anouncement for players who have multiple kills with no intervening deaths. Aka. the KILLING SPREE.

hiddenAdmin New
removes the admin bit sent to clients so admins don't show up with the tell tale @ before there names.

These are just examples. The API that the plug-ins have access to is rather small at the moment but we are adding to it all the time.

If anyone has any ideas for plug-ins please post them. Knowing what people would like to do helps us know what things we should expose to the plugins.

Plug-ins can't do anything. They can only do things that are purely server side. They are not used by the client in any way.
Last edited by JeffM on Mon May 23, 2005 1:10 am, edited 1 time in total.

User avatar
RPG
Lieutenant, Junior Grade
Lieutenant, Junior Grade
Posts: 2015
Joined: Fri Sep 17, 2004 2:37 am
Location: Chicago, Illinois
Contact:

Post by RPG » Sat May 21, 2005 12:53 am

If someone makes a plugin, can that person get it bundled with the next BZFlag release, or does the individual have to promote the plugin on his/her own?

And could you please make a "plugin" forum?

EDIT: Aha, now I see
Plug In File wrote:A plug-in 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 plug-ins
are compiled Plug-ins need to be built on the platform they are to be run with.
This means that a plug-in built for windows will not work on linux, and vice/
versa. Plug-ins are writen in C++ as Dynamic Librarys, ether as a DLL on windows
or a .so file on linux/OS X.

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5182
Joined: Fri Dec 13, 2002 4:11 am
Location: https://github.com/OmniTanks
Contact:

Post by JeffM » Sat May 21, 2005 12:59 am

compiled plug-ins can only be used on the same type of system the were built on. Linux plug-insdon't work on windows for instance.

Disributing them with the builds could be problematic. More then likely there will be a plugins library that server owners can pull from with ether binary builds of plugins for systems that support them well ( like windows ), and source releases of them for those that don't ( linux ).

Plug-ins are very easy to build, and very small.

CVS will have some plug-ins in it. Not all plug-ins will be in CVS, so there will be some promotion by the authors. The nice thing is plug-ins have about the same risk as patches, since they are optional, so geting them into CVS could be easyer.

I'm sure eventualy we'll make a plugins forum, but for now it's very very brand new.

User avatar
Supertanker
Private First Class
Private First Class
Posts: 363
Joined: Sat Mar 19, 2005 9:56 pm

Post by Supertanker » Sat May 21, 2005 1:16 am

Hmmm...how about one that randomly give players flags? Like one that gives player iamanidiotpleaseshotme the tiny flag, then 30 seconds later give it to someone else?

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5182
Joined: Fri Dec 13, 2002 4:11 am
Location: https://github.com/OmniTanks
Contact:

Post by JeffM » Sat May 21, 2005 2:04 am

the game dosn't realy allow for new flags to be pulled outa nowhere, the flag would have to come from somehwere.

you can remove a flag from somone, but then it's just like they had a flag reset.

User avatar
BinarySpike
Corporal
Corporal
Posts: 735
Joined: Mon Mar 28, 2005 11:58 pm
Contact:

Post by BinarySpike » Sat May 21, 2005 3:44 am

Just read this...
Cool!

How did you emplement this in Mac os X?
(Bundles?)


I was working on a plug-in interface for making games.
(which at the time only worked on Mac os 9-)

This is Awsome!!!


*edit*
If you create a new forum please add a Plug-in releases.
(for authors)

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5182
Joined: Fri Dec 13, 2002 4:11 am
Location: https://github.com/OmniTanks
Contact:

Post by JeffM » Sat May 21, 2005 3:57 am

OSX hasn't been finalised yet ( noone has taken a crack at it ).
It should work a lot like linux where a .so is loaded and called. I think just a couple functions will need to change in the bzfsPlugin manager.

User avatar
BinarySpike
Corporal
Corporal
Posts: 735
Joined: Mon Mar 28, 2005 11:58 pm
Contact:

Post by BinarySpike » Sat May 21, 2005 4:30 am

Some CF code should be piece-of-cake for any experienced programmer.
(CF, Core Foundation.)


The only problem is the Plugs would have to be re-compiled into a bundle ON macintosh.


I've been searching for a sulotion for loading code...
(but, hey! I'm not a good searcher.)

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5182
Joined: Fri Dec 13, 2002 4:11 am
Location: https://github.com/OmniTanks
Contact:

Post by JeffM » Sat May 21, 2005 4:49 am

apple says
Preferred Functions

These are the recommended functions to use to interact with the dynamic loader. These functions work in Mac OS X v10.3 and v10.4. However, in Mac OS X v10.4 they are more efficient that other image-loading functions. These functions are declared in /usr/include/dlfcn.h.

dladdr Finds the image and nearest symbol corresponding to an address. Available only in dynamically linked programs.
dlclose Closes a dynamic library or bundle.
dlerror Provides diagnostic information corresponding to problems with calls to dlopen, dlsym, and dlclose in the same thread.
dlopen Loads and links a dynamic library or bundle.
dlsym Returns the address of a symbol.
so it will be just like linux it looks like. Heck the code as is may even work.
just because it's apple dosn't mean it has to be diferent ;)

Guest

Post by Guest » Sat May 21, 2005 9:36 am

JeffM2501 wrote:just because it's apple dosn't mean it has to be diferent ;)
Of course it does.
If it's the same, it can't be better... Rofl!

Anyway, my idea:
Could you use this to run bots on a server?
So that you don't need to run bzflag.2.0.x.app -solo # in the command line as well as running bzfs...
My guess is it's not feasable, but it would be great if it was!

User avatar
RPG
Lieutenant, Junior Grade
Lieutenant, Junior Grade
Posts: 2015
Joined: Fri Sep 17, 2004 2:37 am
Location: Chicago, Illinois
Contact:

Post by RPG » Sat May 21, 2005 2:08 pm

CBG wrote:Anyway, my idea:
Could you use this to run bots on a server?
So that you don't need to run bzflag.2.0.x.app -solo # in the command line as well as running bzfs...
My guess is it's not feasable, but it would be great if it was!
Bots are client-side, and pulgins only work server-side, so the answer would be no.

Guest

Post by Guest » Sat May 21, 2005 2:34 pm

RPG wrote:
CBG wrote:Anyway, my idea:
Could you use this to run bots on a server?
So that you don't need to run bzflag.2.0.x.app -solo # in the command line as well as running bzfs...
My guess is it's not feasable, but it would be great if it was!
Bots are client-side, and pulgins only work server-side, so the answer would be no.
But that was my point...
Why can't there ba a plug-in to enable bzfs to run bots?
I know its probably not possible, but would make it a lot easier if it was. :)

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5182
Joined: Fri Dec 13, 2002 4:11 am
Location: https://github.com/OmniTanks
Contact:

Post by JeffM » Sat May 21, 2005 3:31 pm

A couple things have to change before server side bots can be done. But this is something that gets us closer to it. They will be posible.

bzfs can't do it right now because it can't conceve of a player that doesn't hav e a network slot. Also bzfs dosn't track shots.

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5182
Joined: Fri Dec 13, 2002 4:11 am
Location: https://github.com/OmniTanks
Contact:

Post by JeffM » Mon May 23, 2005 1:10 am

added new plugin to cvs,

hiddenAdmin
It removes the bit that clients use to show the @.

User avatar
RPG
Lieutenant, Junior Grade
Lieutenant, Junior Grade
Posts: 2015
Joined: Fri Sep 17, 2004 2:37 am
Location: Chicago, Illinois
Contact:

Post by RPG » Mon May 23, 2005 1:12 am

Darn, I liked seeing who the admins were.

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5182
Joined: Fri Dec 13, 2002 4:11 am
Location: https://github.com/OmniTanks
Contact:

Post by JeffM » Mon May 23, 2005 4:37 pm

then don't run it on your servers.

trepan
Dev Wizard
Dev Wizard
Posts: 704
Joined: Fri Feb 21, 2003 7:50 pm

Post by trepan » Mon May 23, 2005 4:45 pm

RPG:
Hiding admins is possible with the current release, just
use the HIDEADMIN group permission. You may have
already been snookered.

Guest

Post by Guest » Mon May 23, 2005 4:59 pm

trepan wrote:RPG:
Hiding admins is possible with the current release, just
use the HIDEADMIN group permission. You may have
already been snookered.
Then why do we need a Plug-In ..?

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5182
Joined: Fri Dec 13, 2002 4:11 am
Location: https://github.com/OmniTanks
Contact:

Post by JeffM » Mon May 23, 2005 9:12 pm

because I didn't know there was a perm for it :)

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5182
Joined: Fri Dec 13, 2002 4:11 am
Location: https://github.com/OmniTanks
Contact:

Post by JeffM » Tue May 24, 2005 3:58 pm

purged off topic posts.

User avatar
BinarySpike
Corporal
Corporal
Posts: 735
Joined: Mon Mar 28, 2005 11:58 pm
Contact:

Post by BinarySpike » Tue May 24, 2005 4:25 pm

Can you make a plugin that makes a custom admin sign?
(like for cops you use '#' and for admins '@')


That would be awsome if you could define your own signs.

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5182
Joined: Fri Dec 13, 2002 4:11 am
Location: https://github.com/OmniTanks
Contact:

Post by JeffM » Tue May 24, 2005 4:45 pm

sadly no. the character put in front of the user is done by the client, not the server.

the plugin can remove it by not sending the "I'm an admin" bit the client checks for.

User avatar
BinarySpike
Corporal
Corporal
Posts: 735
Joined: Mon Mar 28, 2005 11:58 pm
Contact:

Post by BinarySpike » Tue May 24, 2005 5:51 pm

Oh, sad... sad... sad...

User avatar
purple_cow
Private First Class
Private First Class
Posts: 63
Joined: Sun Dec 15, 2002 9:24 pm

Python lovin'

Post by purple_cow » Sat May 28, 2005 9:58 am

For those of you who aren't down with writing C++ code to do your plugins, I've finished about half of a plugin which binds the API into python. Combined with external python packages, this allows some very cool things to be created pretty easily -- for example, integrating with twisted to provide a web administration frontend that runs in-process, no extra web server needed.

I expect you all to create nifty stuff once this is done ;)

User avatar
TD-Linux
Sergeant
Sergeant
Posts: 724
Joined: Wed Apr 27, 2005 8:26 pm
Location: Mountain View, CA

Post by TD-Linux » Tue Aug 09, 2005 1:57 pm

Must....learn....C++

Is writing plugins hard? Do you just call a bunch of functions and have bzfs do it for you, or do you have to know the game protocol? I know Borland C++ for DOS 6.0, is that enough to get me writing plugins?

Post Reply