Help?

Questions, comments, and news on the server side plug-ins and it's API
Post Reply
User avatar
LouMan
Chief Sgt. of Cartography
Chief Sgt. of Cartography
Posts: 338
Joined: Mon Jan 31, 2005 3:05 am
Location: Michigan, USA

Help?

Post by LouMan »

I am requesting help from anyone that has knowledge of bzfs plugin source coding and the time to create a small, specific plugin for a server running one of my maps (Roundabout). I have made a valiant attempt to create my own, but I have failed miserably; my C++ is extremely rusty. :(

I would like the server to take away a player's Guided Missile flag if the player is outside of a defined geometric volume (e.g. inside the GM Towers). I would assume that this would be some sort of timed event check (bz_eTickEvent?) against all players' locations and flag types.

In any case, the volumes in which GM's must remain is as follows:

(Tower 1)

X Minimum: -20
X Maximum: +20
Y Minimum: -296
Y Maximum: -256
Z Minimum: 44
Z Maximum: 64

and/or

(Tower 2)

X Minimum: -20
X Maximum: +20
Y Minimum: 256
Y Maximum: 296
Z Minimum: 44
Z Maximum: 64

If a player has a GM flag outside of these volumes, then the flag must be taken away from that player, ideally with a player message "Guided Missiles Stay In Towers!" (or something similar).

I have tried many conventional (and some unconventional) methods of mapping to try and restrict players from using intentionally induced jitter/lag to escape the towers with GM's, but all of my attempts have not been 100% reliable.

Please PM me if you think that this is something you might be able to do for me. I'm not sure what I could offer in exchange, other than my extreme gratitude. :)

-----------------------------------------------------------------

PS:

If this could be someday generalized into a bzFlag map/server function, I could see many applications. Regionalized flag types on maps... hmmm... yes, I could see many applications of this. Perhaps some sort of zone function similar to zoneflag, e.g.:

zone
name keep_GMs_Tower1
position 0.0 -276.0 44.0
size 10.0 10.0 20.0
rotation 0.0
flagstay GM Guided Missiles Stay In Towers! # type, message if not in volume
end
zone
name keep_GMs_Tower2
position 0.0 276.0 44.0
size 10.0 10.0 20.0
rotation 0.0
flagstay GM Guided Missiles Stay In Towers! # type, message if not in volume
end

Of course this would require that error checking was in place to be sure that the required flags are available in these zones in the first place and that they will respawn there if a player's flag is taken away. It would also require that all of the specified flag's possible volumes (e.g. Keep_GMs_Tower1 and Keep_GMs_Tower2) are checked before taking flag and issuing message to player.
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

how about I just make you a plugin that adds a custom map object, so you can do it in a similar manner?
ImageJeffM
User avatar
LouMan
Chief Sgt. of Cartography
Chief Sgt. of Cartography
Posts: 338
Joined: Mon Jan 31, 2005 3:05 am
Location: Michigan, USA

Post by LouMan »

:) that would be so appreciated :)

How would that work exactly? Some sort of "flag holder" object?
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

yeah,

you just give it the bounding box, the flags that should stay inside, and then the plugin will go and use that as input to do its checks. It'll check every player update message, see what flag they have, and if they are not allowed to have the flag where they are, it'll get zapped. that way you can tweak the paramaters with the map.

it will need a new bzfs, since it seems I never did a playerUpdate Event hook.
ImageJeffM
User avatar
LouMan
Chief Sgt. of Cartography
Chief Sgt. of Cartography
Posts: 338
Joined: Mon Jan 31, 2005 3:05 am
Location: Michigan, USA

Post by LouMan »

Well, that sounds very promising indeed. I cannot express my gratitude enough for such an effort.

Couldn't the plugin use the existing bz_eTickEvent event to do a regular check of the bz_PlayerRecord object's float pos[3] (last known position) & bzApiString currentFlag (the flag the player currently has) data, instead of the playerUpdate event? That was the plugin method I was attempting to create and failed to produce...
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

yeah I guess It could, but we need an update event anyway, so I added one. It checks on each update and each shot just to be sure.

I have it done, I just have to test it when I get home.

You can define each zone as an axis aligned bounding box, or as a cylinder with a center point, radius, and max and min Z.

so in the map it'd look like this.

FlagStayZone
bbox -10 10 -20 -20 0 30
Flag GM
Flag SW
end

for a box that goes from +- 10 in X, +- 20 in Y, and 0 to 30 in Z that keeps GM and SW
or


FlagStayZone
cylinder 10 20 0 10 100
Flag GM
Flag SW
end

for a cylinder that centered at X 10 Y 20 that goes from Z 0 to Z 10 with a radius of 100.

I can make a version that does a position poll if you really don't want to rebuild your server, but it may not be as accurate. If your on windows I can provide a binary for the server. Linux is a simple rebuild from CVS.

I did just realize I have to do the message too, so I'll get that in.
ImageJeffM
User avatar
LouMan
Chief Sgt. of Cartography
Chief Sgt. of Cartography
Posts: 338
Joined: Mon Jan 31, 2005 3:05 am
Location: Michigan, USA

Post by LouMan »

Incredible - you are very fast. I have been clunking around at it for at least 2 days now, ready to pull my hair out from compile errors. :? I can't seem to even get the syntax right these days (must be because I'm getting old - 40 years old today - eek).

The server is administered by Thumper, so I would need to relay instructions to him for the rebuild and for the plugin details. I would assume that (after your tests) he could rebuild bzfs from CVS and then associate the proper plugin build. It would then be my responsibility to update the map file with the proper "FlagStayZone" data.
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

well happy birthday :)

thumper is aware of the plug-in and what needs to be done, so he'll be able to do what is needed.
ImageJeffM
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

the plugin is done and in CVS.

I've tested it with a simple map

Code: Select all

box
position 100 100 0
size 10 10 10
end 

box
position -100 100 0
size 10 10 10
end 

box
position -100 -100 0
size 10 10 10
end 

box
position 100 -100 0
size 10 10 10
end 

flagstayzone
bbox -100 100 -100 100 -1 30
flag GM
message "SUCK IT"
end
and then the folowing server paramaters.

Code: Select all

-loadplugin flagStay -world test.bzw -d -d -d +f GM{20}
And it worked fine for me. You drop the flag very shortly after going outside the area of the boxes.
ImageJeffM
User avatar
LouMan
Chief Sgt. of Cartography
Chief Sgt. of Cartography
Posts: 338
Joined: Mon Jan 31, 2005 3:05 am
Location: Michigan, USA

Post by LouMan »

Very cool - thank you so much! :)

I will be getting in touch with Thumper to give it a shot.
User avatar
optic delusion
Special Forces
Special Forces
Posts: 1052
Joined: Sat Sep 25, 2004 2:29 pm
Location: Planet MoFo
Contact:

Post by optic delusion »

I tried this plugin with a little help from Thumper, it works good. It opens up alot of possibilities. With the custom map object, once you get the plugin loaded, all the subsequent code will be inside the map, where it should be. Jeff's instructions above and test map are good.

Jeff made modifications to the bzfs2.0.9 API that are required to run the plugin, so you'll need a current cvs to make it work. (the plugin itself is in there too.) If you load the plugin after bzfs debugging loads, the plugin won't load, be sure the plugin loads before ANYTHING else, because only the plugin understands the new map objects.

Also, the zone/zoneflag map objects include the position and number of they're specific flags. Take those -f flags out of you're conf, or you'll have too many.
Take a look at my Defender game mode concept.

Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.
Post Reply