Turret Plugin Release

Expand and mod your server.
Anxuiz
Private First Class
Private First Class
Posts: 31
Joined: Fri Sep 05, 2008 3:38 am

Turret Plugin Release

Post by Anxuiz »

This plugin adds the ability for map makers to include turrets in their map like the one on flying_popcorn's "Shooting Gallery" map.

Current version: v2.2

From the README:

Code: Select all


Turret Plug-in README

== Table of Contents ==

- Summary
- TurretWeapon
- TurretZone
- TurretEjector
- Notes
- Loading the plug-in
- Loading Examples
- Example Map File
- flying_popcorn's turret
- Technical Notes
- Changelog
- Credits
- License

== Summary ==

The Turret plug-in is a plug-in that allows map makers to specify turrets like the one in flying_popcorn's
"Shooting Gallery". The tilt is based off the position of the tank in the turret zone in proportion
to the tilt extents. The new bzw objects are: turretWeapon, turretZone, and turretEjector.

== TurretWeapon ==

turretWeapon
name <text>                         # Required. Name of weapon.
position <number> <number> <number> # Required. Position of weapon.
type <flag type>                    # Optional. Type of shot the weapon fires (eg. L, SW, SB). Defaults to US.
lifetime <number>                   # Optional. Defines how long the shot "lives" for. Defaults to BZDB value.
frequency <number>                  # Optional. Defines how many times a second the weapon fires. Defaults to 5.
tiltExtent <number> <number>        # Optional. Defines the minimum and maximum tilt. Defaults to 0 and 360.
angleExtent <number> <number>       # Optional. Defines the minimum and maximum angle. Any shot with an angle
                                    # outside this range is not fired. Defaults to 0 and 360.
end

== TurretZone ==

turretZone
name <text>                         # Required. Name of zone.
position <number> <number> <number> # Required. Position of zone.
size <number> <number> <number>     # Required for box zone. Size of zone.
radius <number>                     # Required for cylinder zone. Radius of zone.
height <number>                     # Required for cylinder zone. Height of zone.
addWeapon <text>                    # Repeatable. Adds a weapon which will be fired when a player enters this zone.
end

== TurretEjector ==

turretEjector
position <number> <number> <number> # Required. Position of ejector.
size <number> <number> <number>     # Required for box ejectors. Size of ejector.
radius <number>                     # Required for cylinder ejectors. Radius of ejector.
height <number>                     # Required for cylinder ejectors. Height of ejector.
addZone <text>                      # Repeatable. When a player enters the ejector, any player(s) in these zone(s) will be killed.
ejectTeammates                      # Optional. When specified if the zone is occupied by a player of the same team
                                    # they will be killed. Defaults to no.
end

== Notes ==

- Do NOT specify radius or height with size. The plug-in is unable to determine whether the zone is a box or a cylinder and will
  return an error.
- Names are CaSe SeNsItIvE. MyTurret is not the same as myturret.
- If you want a name with a space, you must put quotation ("") marks around it. For example, "name "My Turret"" (without the first
  set of quotes).
- Rotation is COUNTER-clockwise.
- You cannot have world weapons on a map with a turret.

== Loading the plug-in ==

To load the plug-in, simply add this to your BZFS command list when you start the server:
-loadplug-in /path/to/plug-in/Turret,<debug level>

The debug level defines how much debugging information to report.

Debug Level 0 - No debugging. (Default)
Debug Level 1 - Reports ERRORS that happen. These are things that will probably give undesired effects and should be fixed.
Debug Level 2 - Reports WARNING messages also. These are things that may or may not give undesired effects, but should be fixed. (Recommended Level)
Debug Level 3 - Reports NOTICE messages also. These are things that will most likely not give undesired effects.
Debug Level 4 - Reports DEBUG messages also. These are messages that describe what is going on "behind the scenes".

== Loading Examples ==

-loadplugin path/to/plugin/Turret,2
Loads the Turret plug-in and specifies to include ERROR and WARNING messages.

-loadplugin path/to/plugin/Turret,0
Loads the Turret plug-in and specifies to ignore all messages.

Note: For testing/developing a map with turrets, it is recommended to start Turret with the highest debug level.

== Turret Example File ==

# This can also be found in turret.bzw.

world
size 200 # Slightly smaller world (normal is 400)
end

options
-loadplugin Turret,4 # Show all messages
-j # Enable jumping
+r # Enable rico
end

material # Define a material for the ejector
name red
diffuse 1 0 0 1 # Red
end

box # Turret zone box
position 0 0 0
size 5 20 1
end

box # Turret ejector box
position 0 -50 0
size 5 5 1
matref red
end

turretWeapon
name front
position 0 21 2
type L
tiltExtent 0 90
angleExtent 0 180
end

turretZone
name zone
position 0 0 1
size 5 20 1
addWeapon front
end

turretEjector
position 0 -50 1
size 5 5 1
addZone zone
end

== Replica of flying_popcorn's turret ==

turretWeapon
name wep
position -335 0 46.57
type L
lifetime 0.7
tiltExtent -90 90
angleExtent 0 180
end

turretZone
name turret
position -350 0 44
size 15 7 6
addWeapon wep
rotation 270
end

turretEjector
position -392.5 0 25
size 7.5 7 10
addZone turret
end

== Technical Notes ==

- For a box zone, the tilt is calculated based on how close the tank is to the front (x+) side of the box. The closer it is, the lower
  the tilt is.
- For a cylinder zone, the tilt is calculated based on how close the tank is to the edge. The closer it is, the lower the tilt is.
- The zone is considered box when size is provided.
- The zone is considered cylinder when radius and height are provided.
- Angle Extents are automatically adjusted so that x+ is 0, x- is 180.

== Changelog ==
= v2.2 =

- Fixed a few bugs.
- Removed a few warnings.

= v2.1 =

- Fixed compile errors on linux.

= v2.0 =

- Added support for rotation.
- Added support for cylinder zones (through radius and height).
- Removed front property for turretZone and turretEjector. The x+ side is used for this now; you can rotate the box to achieve
  the same effects of settings a different front (x- = 180, y+ = 270, y- = 90).
- Modulized the collision detection code.
- General code cleanup.

= v1.0 =

- Added the initial turretWeapon, turretZone, and turretEjector code.

== Credits ==

- flying_popcorn for initial inspiration by making the Shooting Gallery map. Also for making the plug-in tutorial which I used for
  the custom map object code.

== License ==

The Turret plug-in is distributed under the Creative Commons license as descibed on this page:
http://creativecommons.org/licenses/by-sa/3.0/

== Replica of flying_popcorn's turret ==

turretWeapon
name wep
position -335 0 46.57
type L
lifetime 0.7
tiltExtent -90 90
angleExtent -90 90
end

turretZone
name turret
position -350 0 44
size 15 7 6
addWeapon wep
rotation 270
end

turretEjector
position -392.5 0 25
size 7.5 7 10
addZone turret
end

== Technical Notes ==

- For a box zone, the tilt is calculated based on how close the tank is to the front (x+) side of the box. The closer it is, the lower
  the tilt is.
- For a cylinder zone, the tilt is calculated based on how close the tank is to the edge. The closer it is, the lower the tilt is.
- The zone is considered box when size is provided.
- The zone is considered cylinder when radius and height are provided.

== Changelog ==
= v2.1 =

- Fixed compile errors on linux.

= v2.0 =

- Added support for rotation.
- Added support for cylinder zones (through radius and height).
- Removed front property for turretZone and turretEjector. The x+ side is used for this now; you can rotate the box to achieve
  the same effects of settings a different front (x- = 180, y+ = 270, y- = 90).
- Modulized the collision detection code.
- General code cleanup.

= v1.0 =

- Added the initial turretWeapon, turretZone, and turretEjector code.

== Credits ==

- flying_popcorn for initial inspiration by making the Shooting Gallery map. Also for making the plug-in tutorial which I used for
  the custom map object code. And finally for building the linux plug-in.

== License ==

The Turret plug-in is distributed under the Creative Commons license as descibed on this page:
http://creativecommons.org/licenses/by-sa/3.0/

Here is an example of how the turret is added to the shooting gallery map:

Code: Select all

turretWeapon
name wep
position -335 0 46.57
type L
lifetime 0.7
tiltExtent -90 90
angleExtent 0 180
end

turretZone
name turret
position -350 0 44
size 15 7 6
addWeapon wep
rotation 270
end

turretEjector
position -392.5 0 25
size 7.5 7 10
addZone turret
end
Please report any bugs or comments to this thread. Thanks!

Source, windows binary, and linux binary is attached.

Licence
Attachments
windows.zip
Windows Binary
(34.46 KiB) Downloaded 372 times
linux.zip
Linux Binary
(28.6 KiB) Downloaded 398 times
source.zip
Source
(22.92 KiB) Downloaded 370 times
Last edited by Anxuiz on Thu Sep 17, 2009 12:55 am, edited 11 times in total.
User avatar
flying_popcorn
Private First Class
Private First Class
Posts: 88
Joined: Wed Dec 14, 2005 2:40 am
Contact:

Re: Turret Plugin Release

Post by flying_popcorn »

Wow, awesome :)

I was planning on making something like this, though I never got around to it :wink:

Anyway, attached is a compiled .so (EDIT: .so of version 2 is attached) (EDIT2: I removed the attachment because a newer version is available in the original post)
Last edited by flying_popcorn on Fri Oct 21, 2011 1:02 am, edited 3 times in total.
Anxuiz
Private First Class
Private First Class
Posts: 31
Joined: Fri Sep 05, 2008 3:38 am

Re: Turret Plugin Release

Post by Anxuiz »

I'm proud to announce the release of Turret 2.0!

The differences you'll notice are:
  • Added support for rotation.
  • Added support for cylinder zones (through radius and height).
  • Removed front property for turretZone and turretEjector. The x+ side is used for this now; you can rotate the box to achieve the same effects of settings a different front (x- = 180, y+ = 270, y- = 90).
  • Modulized the collision detection code.
  • General code cleanup.
The README has also been expanded and turret.bzw has been added. I suggest everyone who uses this plugin to read the entire README as there is quite a bit of information in there ;)

- Yassen
Anxuiz
Private First Class
Private First Class
Posts: 31
Joined: Fri Sep 05, 2008 3:38 am

Re: Turret Plugin Release

Post by Anxuiz »

Turret 2.2 has been released!

The changes in 2.2 are listed here:
  • Fixed the death physics bug.
  • Removed some compilation warnings.
  • Rotation is now automatically adjusted so that 0* is pointing north and 180* is pointing south.
  • Fixed the part bug where the plug-in thought that a player was still in a turret after they left.
The README and the sample turret have been updated to reflect these changes.

- Yassen
User avatar
Bambino
Private First Class
Private First Class
Posts: 1210
Joined: Mon Apr 21, 2008 10:27 pm
Location: Alberta, Canada

Re: Turret Plugin Release

Post by Bambino »

Yassen wrote:]Fixed the part bug where the plug-in thought that a player was still in a turret after they left.
Thank you!!!

Is the Slot #0 bug gone ;) ?
"Anyone who has never made a mistake has never tried anything new." -- Albert Einstein
GU League | Ducati League | OpenLeague
User avatar
Starski
Private First Class
Private First Class
Posts: 93
Joined: Sun Jan 06, 2008 6:01 pm
Location: Florida

Re: Turret Plugin Release

Post by Starski »

I downloaded the turret attachments but i dont know what to do from their.
"You cannot shake hands with a clenched fist"
-Gandhi

FKA Danji

Bad Company -> http://www.guleague.org/Teams/?profile=1001
User avatar
mrapple
Sergeant Major
Sergeant Major
Posts: 460
Joined: Wed May 27, 2009 11:59 am
Location: Unknown
Contact:

Re: Turret Plugin Release

Post by mrapple »

line wrote:I downloaded the turret attachments but i dont know what to do from their.
well then maybe you should learn how to compile before posting.
Image
User avatar
Bambino
Private First Class
Private First Class
Posts: 1210
Joined: Mon Apr 21, 2008 10:27 pm
Location: Alberta, Canada

Re: Turret Plugin Release

Post by Bambino »

mrapplecomputer1 wrote:
line wrote:I downloaded the turret attachments but i dont know what to do from their.
well then maybe you should learn how to compile before posting.
Well maybe he doesn't know how to compile and wants to learn?
What if he downloaded the wrong file type?
"Anyone who has never made a mistake has never tried anything new." -- Albert Einstein
GU League | Ducati League | OpenLeague
User avatar
blast
General
General
Posts: 4931
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Re: Turret Plugin Release

Post by blast »

Bambino wrote:Well maybe he doesn't know how to compile and wants to learn?
Then he should be reading the README files.
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image
User avatar
mrapple
Sergeant Major
Sergeant Major
Posts: 460
Joined: Wed May 27, 2009 11:59 am
Location: Unknown
Contact:

Re: Turret Plugin Release

Post by mrapple »

Hello, I have a question about rotating the turret for the other team. So I have one teams turret:

Code: Select all

turretWeapon
name wep
position 0 245 56
type MG
lifetime 0.7
tiltExtent -40 20
angleExtent 30 330
end

turretZone
name turret
position 0 256 57
size 6 6 1
addWeapon wep
end
now how would i make it so the new turretZone is at -256. Ive tried but you have to facebackwards to fire the turret. What am I missing?
Image
User avatar
zaphod
Sergeant
Sergeant
Posts: 352
Joined: Sun Jan 23, 2005 3:20 pm
Location: beteigeuze-system
Contact:

Re: Turret Plugin Release

Post by zaphod »

I need a little help to set up a turret-tower in the center of the map where a player can use it to shoot around 360° and downwards.
problems i have so far :::
when i set the turretWeapon on top of the player ::: he gets shot!
when i set the turretWeapon below the player ::: he gets shot!

so i guess i miss the settings for the angleExtent?!
problem :::
when i set an negative (-90 90) or a positive range (180 360)
the turretWeapon is not firing when entering the turretZone!

here i am so far and needing help from you guys!

Code: Select all

turretWeapon
 name Zone1
 position 0 0 27
 type US
 #lifetime
 #frequency
 tiltExtent -90 90 #works so far
 angleExtent ? ?
 #angleExtent -90 90 < not firing
 #angleExtent 180 360 < not firing
end

Code: Select all

turretZone
 name turretzone1
 position 0 0 28
 size 15 15 5
 addWeapon Zone1
rotation 270
end
BIG thanks in advance for any input!


.
.
.
.
Image
Anxuiz
Private First Class
Private First Class
Posts: 31
Joined: Fri Sep 05, 2008 3:38 am

Re: Turret Plugin Release

Post by Anxuiz »

Try not specifying an angle extent or setting it to 0 and 360.
User avatar
Propane Tank
Private First Class
Private First Class
Posts: 99
Joined: Mon Aug 17, 2009 12:44 pm

Re: Turret Plugin Release

Post by Propane Tank »

I downloaded the 2.2 source code to compile for my server and I get the following error.

Code: Select all

In file included from TurretWeapon.h:9,
                 from Turret.cpp:13:
common.h:65: error: ‘bzAPIStringList’ has not been declared
common.h:66: error: ‘bzAPIStringList’ has not been declared
common.h:67: error: ‘bzAPIStringList’ has not been declared
common.h:68: error: ‘bzAPIStringList’ has not been declared
common.h:69: error: ‘bzAPIStringList’ has not been declared
common.h:75: error: ‘bool isNumber’ redeclared as different kind of symbol
common.h:74: error: previous declaration of ‘bool isNumber(std::string)’
common.h:75: error: ‘bzApiString’ was not declared in this scope
In file included from Turret.cpp:13:
TurretWeapon.h:15: error: ‘bz_PlayerRecord’ has not been declared
In file included from TurretEjector.h:6,
                 from Turret.cpp:14:
TurretZone.h:13: error: ‘bz_PlayerRecord’ has not been declared
In file included from Turret.cpp:14:
TurretEjector.h:13: error: ‘bz_PlayerRecord’ has not been declared
Turret.cpp:55: error: expected class-name before ‘,’ token
Turret.cpp:60: error: ‘bzApiString’ has not been declared
Turret.cpp:63: error: cannot declare variable ‘Turret’ to be of abstract type ‘TurretHandler’
Turret.cpp:56: note:   because the following virtual functions are pure within ‘TurretHandler’:
/home/propane/downloads/bzflag-2.4.0/include/bzfsAPI.h:1445: note: 	virtual bool bz_CustomMapObjectHandler::MapObject(bz_ApiString, bz_CustomMapObjectInfo*)
Turret.cpp: In function ‘int bz_Load(const char*)’:
Turret.cpp:67: error: ‘bz_registerEvent’ was not declared in this scope
Turret.cpp: In member function ‘virtual void TurretHandler::process(bz_EventData*)’:
Turret.cpp:107: error: ‘bz_PlayerDieEventData’ was not declared in this scope
Turret.cpp:107: error: ‘data’ was not declared in this scope
Turret.cpp:107: error: expected primary-expression before ‘)’ token
Turret.cpp:107: error: expected ‘;’ before ‘eventData’
Turret.cpp:130: error: ‘bz_PlayerJoinPartEventData’ was not declared in this scope
Turret.cpp:130: error: ‘data’ was not declared in this scope
Turret.cpp:130: error: expected primary-expression before ‘)’ token
Turret.cpp:130: error: expected ‘;’ before ‘eventData’
Turret.cpp:138: error: ‘bz_PlayerJoinPartEventData’ was not declared in this scope
Turret.cpp:138: error: ‘data’ was not declared in this scope
Turret.cpp:138: error: expected primary-expression before ‘)’ token
Turret.cpp:138: error: expected ‘;’ before ‘eventData’
Turret.cpp:149: error: ‘bz_PlayerPausedEventData’ was not declared in this scope
Turret.cpp:149: error: ‘data’ was not declared in this scope
Turret.cpp:149: error: expected primary-expression before ‘)’ token
Turret.cpp:149: error: expected ‘;’ before ‘eventData’
Turret.cpp:167: error: ‘bz_ShotEndedEventData’ was not declared in this scope
Turret.cpp:167: error: ‘data’ was not declared in this scope
Turret.cpp:167: error: expected primary-expression before ‘)’ token
Turret.cpp:167: error: expected ‘;’ before ‘eventData’
Turret.cpp:178: error: ‘bz_TickEventData’ was not declared in this scope
Turret.cpp:178: error: ‘data’ was not declared in this scope
Turret.cpp:178: error: expected primary-expression before ‘)’ token
Turret.cpp:178: error: expected ‘;’ before ‘eventData’
Turret.cpp:200: error: ‘bzAPIIntList’ was not declared in this scope
Turret.cpp:200: error: ‘playerlist’ was not declared in this scope
Turret.cpp:205: error: ‘bz_PlayerRecord’ was not declared in this scope
Turret.cpp:205: error: ‘player’ was not declared in this scope
Turret.cpp: At global scope:
Turret.cpp:232: error: ‘bool TurretHandler::handle’ is not a static member of ‘class TurretHandler’
Turret.cpp:232: error: ‘bzApiString’ was not declared in this scope
Turret.cpp:232: error: expected primary-expression before ‘*’ token
Turret.cpp:232: error: ‘data’ was not declared in this scope
Turret.cpp:232: error: initializer expression list treated as compound expression
Turret.cpp:232: error: expected ‘,’ or ‘;’ before ‘{’ token
Server is Ubuntu 10.10 if that is of any relevance.
-Propane Tank
User avatar
joevano
General
General
Posts: 1863
Joined: Sat Jun 18, 2005 1:08 pm
Location: South Bend, Indiana, USA

Re: Turret Plugin Release

Post by joevano »

For BZFlag 2.4? The source code will need to be updated to work with the 2.4 API.
There is nothing worse than aggressive stupidity. -- Johann Wolfgang von Goethe
"How many legs does a dog have if you call his tail a leg? Four. Calling a tail a leg doesn't make it a leg." -- Abraham Lincoln
User avatar
allejo
Breaker of Builds
Breaker of Builds
Posts: 809
Joined: Sun Feb 17, 2008 10:01 pm
Location: /dev/null
Contact:

Re: Turret Plugin Release

Post by allejo »

I've gotten behind with my plugin updating because of my own development, I'll see if I can update the few remaining plugins over the next month. Of course, anyone else is welcome learn and do it themselves but it seems I'm the lone plugin dev.
User avatar
Rob5a
Private First Class
Private First Class
Posts: 35
Joined: Tue Apr 01, 2008 1:49 pm
Location: Berlin, Germany

Re: Turret Plugin Release

Post by Rob5a »

Here's an updated version for 2.4

Not sure if everything works, since I've only just began learning c++, but whatever. :)
Attachments
source2_4.zip
Turret source for 2.4
(22.86 KiB) Downloaded 317 times
Last edited by Rob5a on Tue Oct 02, 2012 5:24 pm, edited 1 time in total.
User avatar
Propane Tank
Private First Class
Private First Class
Posts: 99
Joined: Mon Aug 17, 2009 12:44 pm

Re: Turret Plugin Release

Post by Propane Tank »

I am rather new to compiling. Could someone point me in the right direction? I'm on Ubuntu and I did compile BZFlag 2.4 on this same machine.
-Propane Tank
User avatar
Rob5a
Private First Class
Private First Class
Posts: 35
Joined: Tue Apr 01, 2008 1:49 pm
Location: Berlin, Germany

Re: Turret Plugin Release

Post by Rob5a »

Propane Tank wrote:I am rather new to compiling. Could someone point me in the right direction? I'm on Ubuntu and I did compile BZFlag 2.4 on this same machine.
http://wiki.bzflag.org/Plug-ins#Third_Party_Plug-ins

In this case, the plugin name would be "Turret".
User avatar
Propane Tank
Private First Class
Private First Class
Posts: 99
Joined: Mon Aug 17, 2009 12:44 pm

Re: Turret Plugin Release

Post by Propane Tank »

There isn't a makefile, so does the example one work or did you do something wrong? The directions say to delete everything then copy the plugin contents and edit the bzf makefile.whatever and add a line to the plugin makefile.
-Propane Tank
User avatar
Rob5a
Private First Class
Private First Class
Posts: 35
Joined: Tue Apr 01, 2008 1:49 pm
Location: Berlin, Germany

Re: Turret Plugin Release

Post by Rob5a »

Propane Tank wrote:There isn't a makefile, so does the example one work or did you do something wrong? The directions say to delete everything then copy the plugin contents and edit the bzf makefile.whatever and add a line to the plugin makefile.
The makefile of the turret plugin is in the archive I've posted. (Makefile.in & Makefile.am)
User avatar
Propane Tank
Private First Class
Private First Class
Posts: 99
Joined: Mon Aug 17, 2009 12:44 pm

Re: Turret Plugin Release

Post by Propane Tank »

Which one do I link to? There is the two with an extension but the documentation says to one without the extension. Remember, I'm new to the whole compiling so not too sure what I'm entirely doing. But with easy to follow instructions, I can do it (the reason why I was able to compile bzflag)
-Propane Tank
User avatar
blast
General
General
Posts: 4931
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Re: Turret Plugin Release

Post by blast »

Propane Tank, this isn't the place to ask about general building instructions.
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image
User avatar
Propane Tank
Private First Class
Private First Class
Posts: 99
Joined: Mon Aug 17, 2009 12:44 pm

Re: Turret Plugin Release

Post by Propane Tank »

If anyone is interested, I have compiled a .so of it on Ubuntu 10.10 for bzflag 2.4.x.
Attachments
Turret.zip
(167.77 KiB) Downloaded 293 times
-Propane Tank
Starmute
Private
Private
Posts: 3
Joined: Thu Feb 03, 2011 11:53 pm

Re: Turret Plugin Release

Post by Starmute »

It seems to be impossible to use this plugin on a Mac; either that or I am doing something wrong. Can you help me; i.e. post a mac version if possible? Thanks.
User avatar
blast
General
General
Posts: 4931
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Re: Turret Plugin Release

Post by blast »

Starmute wrote:It seems to be impossible to use this plugin on a Mac; either that or I am doing something wrong. Can you help me; i.e. post a mac version if possible? Thanks.
You'll have to compile it yourself. You won't be able to use a plugin built on Linux on your Mac.
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image
Post Reply