Page 1 of 2

Turret Plugin Release

Posted: Mon May 18, 2009 5:44 am
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

Re: Turret Plugin Release

Posted: Tue May 19, 2009 1:25 am
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)

Re: Turret Plugin Release

Posted: Fri Jun 26, 2009 3:28 am
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

Re: Turret Plugin Release

Posted: Thu Sep 17, 2009 12:58 am
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

Re: Turret Plugin Release

Posted: Thu Sep 17, 2009 4:54 am
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 ;) ?

Re: Turret Plugin Release

Posted: Fri Sep 18, 2009 11:07 pm
by Starski
I downloaded the turret attachments but i dont know what to do from their.

Re: Turret Plugin Release

Posted: Sat Sep 19, 2009 3:07 am
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.

Re: Turret Plugin Release

Posted: Sat Sep 19, 2009 6:22 am
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?

Re: Turret Plugin Release

Posted: Sat Sep 19, 2009 12:38 pm
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.

Re: Turret Plugin Release

Posted: Wed Nov 04, 2009 11:50 pm
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?

Re: Turret Plugin Release

Posted: Wed Nov 25, 2009 1:16 pm
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!


.

Re: Turret Plugin Release

Posted: Wed Nov 25, 2009 11:56 pm
by Anxuiz
Try not specifying an angle extent or setting it to 0 and 360.

Re: Turret Plugin Release

Posted: Tue Aug 09, 2011 3:10 pm
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.

Re: Turret Plugin Release

Posted: Tue Aug 09, 2011 3:53 pm
by joevano
For BZFlag 2.4? The source code will need to be updated to work with the 2.4 API.

Re: Turret Plugin Release

Posted: Sat Aug 13, 2011 4:11 am
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.

Re: Turret Plugin Release

Posted: Sun Jan 22, 2012 6:10 pm
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. :)

Re: Turret Plugin Release

Posted: Mon Jan 23, 2012 3:26 am
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.

Re: Turret Plugin Release

Posted: Mon Jan 23, 2012 11:26 am
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".

Re: Turret Plugin Release

Posted: Mon Jan 23, 2012 3:04 pm
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.

Re: Turret Plugin Release

Posted: Mon Jan 23, 2012 3:41 pm
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)

Re: Turret Plugin Release

Posted: Mon Jan 23, 2012 3:56 pm
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)

Re: Turret Plugin Release

Posted: Mon Jan 23, 2012 5:03 pm
by blast
Propane Tank, this isn't the place to ask about general building instructions.

Re: Turret Plugin Release

Posted: Mon Jan 23, 2012 11:29 pm
by Propane Tank
If anyone is interested, I have compiled a .so of it on Ubuntu 10.10 for bzflag 2.4.x.

Re: Turret Plugin Release

Posted: Sat May 11, 2013 5:02 pm
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.

Re: Turret Plugin Release

Posted: Sat May 11, 2013 5:34 pm
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.