Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

[Released] 2D Shooter Bullet and Weapon System

Discussion in 'Assets and Asset Store' started by gamedevassets-sean, Jul 27, 2014.

  1. gamedevassets-sean

    gamedevassets-sean

    Joined:
    Jul 26, 2013
    Posts:
    76
    Hey all,

    My 2D shooter bullet and weapon system (plus player movement) asset was released just the other day.



    You can check the asset out here on the store:

    http://bit.ly/1pdOPA6

    New version out now! (1.4.1)

    • New mirror bullets mode added
    • Added full code XML documentation throughout and linked asset store listing to code documentation site
    • Fixed a small bug in the turret tracking demo scene
    • Made the EquipWeaponConfiguration method public so that weapon configurations can be easily changed from other scripts
    • Added some different, extra bullet prefab samples
    WebGL demo (v1.4.1): http://bit.ly/25MBCGy













    Info:

    The 2D Shooter Bullet and Weapon System asset provides you with a highly customisable bullet pattern and weapon system, custom weapon configuration editor with inventory manager, along with a bullet pooling manager which is simple to drop into your Unity game or project and start using right away. The system is simple to drop into your Unity game or project and start using right away.

    In addition, you also get a customizable player movement script which allows for two modes of player movement controls (top down shooter and shoot-em-up / shmup), as well as a multitude of extra sprites, SFX, prefabs and demo scripts relating to the 4 x demo scenes that are included.

    The system allows for many different bullet pattern configurations and customizations, as well as ricochet (bounce) and bullet impact effects like sparks and blood. The WeaponSystem.cs script contains sliders for every property on the weapon allowing you to easily control properties like bullet count, fire rate, bullet randomness, spread, offsets, and even alternate properties like spread size on an alternating timer system. There are also options to assign ammunition, magazine configurations, reload options and SFX on the weapon configurations you create to fire your custom bullet patterns. This amounts to a huge number of possible bullet patterns and weapon types.

    The WeaponSystem script also makes it easy for your player to change weapon types in-game. Either use the built-in weapon configuration and inventory assignment system (with support to re-order, add or remove weapon configurations in-editor to use in-game), or simply set the weapon preset property to one of the 13 default preset weapon types/bullet pattern types.

    Older version info:


    Version 1.3 includes the following new features and improvements:
    • Custom inspector / editor with support to create weapon configurations for use in-game, and to manage, re-order/delete/create new configurations using the editor tools
    • Ammunition support added with various properties to go with it
    • Magazine and reload support added along with various properties to go with this (magazine size, reload time, etc...)
    • Weapon configuration and inventory support - create as many configurations as you wish with the editor (that have different bullet patterns and other properties (more than 30 properties to use to customise your weapons!) and then add them to an inventory system that is used in-game
    • blood hit particle effects added
    • SFX clips added for weapon reloads and shooting
    • New events added to subscribe your other game logic to - For example, ReloadStarted, ReloadFinished, WeaponChanged, etc...
    • 2 x new demo scenes and update of existing demo scenes
    • Added support for SFX to be optionally assigned to some actions like shooting, reloading
    • Maintained backward compatibility for existing users who upgrade

    You can try out the version 1.3 webplayer demo here:
    http://bit.ly/1aPdmt0

    Version 1.2 includes the following improvements:
    • Ricochet bullet support with customisation to enable/disable and set the chance for ricochets to occur
    • Bullet hit effects (particle) on collision with 'hittable' objects
    • Much improved player control system for top-down shooter mode (test it out in the webplayer demo)
    • Adjusted top-down demo scene with new props and items to shoot at/test the ricochet and new bullet hit effects
    • Updated object pooling solution to include bullet hit effects
    • Ability to enable/disable hit effects on bullets
     
    Last edited: Jul 3, 2016
  2. gamedevassets-sean

    gamedevassets-sean

    Joined:
    Jul 26, 2013
    Posts:
    76
    Coming soon in version 1.1 (has been submitted for review!):

    Try the web player demo: http://bit.ly/1otUx1C



    • Free aim controls in addition to the current vertical/horizontal shmup type controls
    • More preset bullet pattern types to use (and more customisation options to create even more unique ones of your own)
    • Second demo scene - top down shooter with free aim and movement controls
    • Zombie character walk animation included with the second demo scene
    • Another backdrop graphic
    • Improvements all around for customisation
    • Improved demo scene customisation options and a new bullet pattern preset
    • Another parameter added for the bullet system (minimum ping pong spread value) - allows for even more interesting pattern customisations
    Here are a couple of screenshots showing the second demo scene and the free aim mode:



     
  3. gamedevassets-sean

    gamedevassets-sean

    Joined:
    Jul 26, 2013
    Posts:
    76
    Version 1.1 has been released - with the added ability to use the bullet system at any angle in your 2D games, plus many more improvements:

    Try out the web demo
    Get the new 2D Shooter Bullet and Weapon System Asset
    • Free aim controls in addition to the current vertical/horizontal shmup type controls
    • More preset bullet pattern types to use (and more customisation options to create even more unique ones of your own)
    • Second demo scene - top down shooter with free aim and movement controls
    • Zombie character walk animation included with the second demo scene
    • Another backdrop graphic
    • Improvements all around for customisation
    • Improved demo scene customisation options and a new bullet pattern preset
    • Another parameter added for the bullet system (minimum ping pong spread value) - allows for even more interesting pattern customisations
     
  4. gamedevassets-sean

    gamedevassets-sean

    Joined:
    Jul 26, 2013
    Posts:
    76
    Hey guys, I have an update to this coming out soon - it will include ricochet bullet support (customisable) and bullet hit effects (based on bullets hitting colliders).

    Here is a sneak peek:



    Let me know what you think :)
     
  5. gamedevassets-sean

    gamedevassets-sean

    Joined:
    Jul 26, 2013
    Posts:
    76
    Hello everyone!

    Version 1.2 of the 2D Shooter Bullet and Weapon System is now released and available on the Unity asset store!

    Demo showing some of the new features and improvements (plus ricochet support!) - sorry about the recording size, just go fullscreen and use 720p @ 60FPS in Youtube!




    Playable web demo


    Version 1.2 includes the following improvements:
    • Ricochet bullet support with customisation to enable/disable and set the chance for ricochets to occur
    • Bullet hit effects (particle) on collision with 'hittable' objects
    • Much improved player control system for top-down shooter mode (test it out in the webplayer demo)
    • Adjusted top-down demo scene with new props and items to shoot at/test the ricochet and new bullet hit effects
    • Updated object pooling solution to include bullet hit effects
    • Ability to enable/disable hit effects on bullets
     
  6. Yukichu

    Yukichu

    Joined:
    Apr 2, 2013
    Posts:
    420
    Is this on the XY or XZ plane, or able to choose between? Does it use 2D physics or raycasting? Is it deterministic for the ricochets, so if I tried to use them in a networked game... it might work?
     
  7. gamedevassets-sean

    gamedevassets-sean

    Joined:
    Jul 26, 2013
    Posts:
    76
    Hi Yukichu,

    The system works on the XY plane (as per Unity's 2D co-ordinate system). The bullets are not pushed around by 2D physics, but rather by translating their Transform components. There is an element of determinism in the ricochets in the way that each WeaponSystem component you use (that fires the bullets) is set with a 0-100% chance that the bullets emitted will ricochet (you can set it on each Weapon Configuration that the system loads and uses), however you could change this easily to ensure the same chance percent is adhered to I guess.

    The ricochet system works by determining point of impact on any 2D collider component, and then using a Vector reflect method to calculate the outward angle of reflection to send the bullet toward after the impact occurs.

    I have not really been too involved with multiplayer coding so I can't answer your question directly, but hopefully the above gives you enough information to answer it for you :)
     
  8. gamedevassets-sean

    gamedevassets-sean

    Joined:
    Jul 26, 2013
    Posts:
    76
    Hello everyone!

    The latest version is now live! (Version 1.3)

    You can try out the version 1.3 webplayer demo here:
    http://bit.ly/1aPdmt0

    Version 1.3 includes the following new features and improvements:
    • Custom inspector / editor with support to create weapon configurations for use in-game, and to manage, re-order/delete/create new configurations using the editor tools
    • Ammunition support added with various properties to go with it
    • Magazine and reload support added along with various properties to go with this (magazine size, reload time, etc...)
    • Weapon configuration and inventory support - create as many configurations as you wish with the editor (that have different bullet patterns and other properties (more than 30 properties to use to customise your weapons!) and then add them to an inventory system that is used in-game
    • blood hit particle effects added
    • SFX clips added for weapon reloads and shooting
    • New events added to subscribe your other game logic to - For example, ReloadStarted, ReloadFinished, WeaponChanged, etc...
    • 2 x new demo scenes and update of existing demo scenes
    • Added support for SFX to be optionally assigned to some actions like shooting, reloading
    • Maintained backward compatibility for existing users who upgrade



     
  9. hodge_podge

    hodge_podge

    Joined:
    Feb 22, 2015
    Posts:
    30
    I love this asset, I would like to thank you for it and I hope to see the project continue. Is there any plans for Unity 5 support? I've tried using Unity 5 with the 1.3 version and it seems to mostly work fine with its physics system.

    The minor behavior things that I noticed (and mostly easily fixed with one or two changes) is stuff like the player bullet's get destroyed if they collide with each other (for some reason, on Unity 5 the layers don't correctly port over) or the default 2D ship shooter object having gravity (You just fix this by zeroing the gravity scale on the player's object) and
     
  10. gamedevassets-sean

    gamedevassets-sean

    Joined:
    Jul 26, 2013
    Posts:
    76
    Hi hodge_podge,

    Thanks for grabbing a copy :)

    Yes, Unity 5.0 is supported - I have tested it out on the latest Unity 5.0 release and it all works great. The reason you see that bullets collide with eachother, as well as the gravity issue is because I don't port Layer names, gravity settings and layer collision matrix settings across in the asset, so you just need to quickly create the layers and set them correctly after importing the asset to your own project.

    If you take a quick look at the readme.txt file under the Documentation folder you'll see a "Setup" section that explains the process to quickly create the layers and set the collision matrix and gravity up :)

    But it looks like you figured that all out yourself without seeing the documentation anyway so kudos to you!

    Side note on Unity 5.0 - I've noticed that the collision and physics interactions are quite a bit quicker in 5.0 compared to 4.3 - this must either be down to the new PhysX support in Unity 5.0 or just more efficient code in the engine, so either way, you'll be able to fit even more bullets on screen :)
     
  11. hodge_podge

    hodge_podge

    Joined:
    Feb 22, 2015
    Posts:
    30
    Great, thanks for the quick reply. The documentation of course did the trick and Unity 5 does indeed support more bullets on a scene.

    I am looking forward to version 1.4.
     
  12. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,013
    Can this be adapted to work in 3D?
     
  13. gamedevassets-sean

    gamedevassets-sean

    Joined:
    Jul 26, 2013
    Posts:
    76
    Hi magique,

    I had this question recently from someone else and the simple answer is no, not without going through the components and modifying the code. You do get the full source, but it is a bit of a job to change for 3D. Sorry! I am considering adding a 3D version in the near future though. Watch this space.
     
  14. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,013
    Would the new 3D version be part of this package or a separate package to buy?
     
  15. gamedevassets-sean

    gamedevassets-sean

    Joined:
    Jul 26, 2013
    Posts:
    76
    I'm thinking it would be best to include it in this package, and just advertise 3D support as one of the features - it would still be called "2D shooter bullet and weapon system" though. I can't promise the 3D support soon though - I'm busy working on another project at the moment, so my hope would be to finish this in the next couple of months.
     
  16. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,013
    Sounds good. I already own this, but now that I'm getting around to using it I realize my mistake in thinking it would work for 3D as well. I will continue to use my own system until such time as this is 3D and then I'll re-evaluate.
     
  17. gamedevassets-sean

    gamedevassets-sean

    Joined:
    Jul 26, 2013
    Posts:
    76
    Ah thanks for the support magique. I'll definitely update this thread when it is ready.
     
  18. gamedevassets-sean

    gamedevassets-sean

    Joined:
    Jul 26, 2013
    Posts:
    76
    So no 3D version as of yet, but I have had time to implement some features and requests I've had come through. Version 1.4.1 is out now!
    • New mirror bullets mode added
    • Added full code XML documentation throughout and linked asset store listing to code documentation site
    • Fixed a small bug in the turret tracking demo scene
    • Made the EquipWeaponConfiguration method public so that weapon configurations can be easily changed from other scripts
    • Added some different, extra bullet prefab samples



     
  19. MrJBRPG

    MrJBRPG

    Joined:
    Nov 22, 2015
    Posts:
    40
    I wonder how often you update your addon because I am having trouble using those demos in the latest version of Unity
     
  20. gamedevassets-sean

    gamedevassets-sean

    Joined:
    Jul 26, 2013
    Posts:
    76
    The asset has been updated for Unity 5.6.0.

    Did you follow the setup guide? You need to set up a couple of layers and the gravity if you are importing the asset into a new project or existing project first. Check the readme file under "Documentation" - there are a couple of setup instructions there that should get you going, and the demos will work perfectly after that :)

    Let me know if you are still having issues after trying that though.
     
  21. Cypras

    Cypras

    Joined:
    Oct 25, 2013
    Posts:
    64
    No 3D version coming?
     
  22. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,511
    Been wondering if the bullets uses 2d physics in terms of collider. What happens if fps drops and bullet was too fast to hit a thin wall? Will it pass through? what mechanism does it use to prevent that?
     
  23. gamedevassets-sean

    gamedevassets-sean

    Joined:
    Jul 26, 2013
    Posts:
    76
    Yes, you're correct, they use 2D physics components and as such will do this of your fps drops too low unfortunately.
     
  24. Velcer

    Velcer

    Joined:
    Mar 16, 2017
    Posts:
    21
    Hey, I'm using this - I was wondering how I can make the gunpoint face any direction without moving my characters rotation? think of a turret on a top down tank.
     
  25. gamedevassets-sean

    gamedevassets-sean

    Joined:
    Jul 26, 2013
    Posts:
    76
    Hi @Velcer

    Great to hear! I hope you are enjoying using the asset.

    A tank is pretty simple to wire up. I did a quick demo in about 15-20 minutes. See my attached GIF example.

    The color is a bit rubbish (bad GIF encoding), but this gives you an idea:

    Link to demo GIF: https://i.imgur.com/holpmaN.gif
    Or: https://i.imgur.com/holpmaN.gifv

    To wire it up, here is what I did:

    • Grabbed a couple of tank assets from kenney.nl
    • Grabbed a Car Movement script from this great quill18 tutorial
    • Created a new GameObject, added a RigidBody2D component, and the Car movement script. Set the rigidbody to dynamic, and mass = 3. Set the Layer of the new GameObject to the PlayerLayer (as per the asset setup instructions) this is so the bullets don't collide with the tank body. Added a box 2d collider to the tank.
    • Now I dragged the Demo scene's ZombiePlayer GameObject onto the new Tank Object and centered it's transform. The ZombiePlayer is now a child of Tank.
    • Disable the ZombiePlayer sprite and the ZombiePlayer's CircleCollider2D.
    • Add two new GameObjects as children of Tank. One has a sprite with the round tank turrent sprite (included in the asset already) and one usess a turret sprite from the Kenney asset pack linked above. I offset the turret gun sprite to the side and positioned it in the same orientation as the original Zombie Player's gun sprite.
    • I tweaked the Sprite renderer order settings to get them to appear on top of everything else.
    • Set up the movement forward/backward keys in quill's sample car script to be KeyCode.W and KeyCode.S instead of "Brake" and "Accelerate".

    That's it! The asset does all of the other work.

    You drive with W/A/S/D and control the aiming of the turret independently with the mouse. Left click is fire. Scroll mouse to change weapon configurations. (as per the original demo scene's control setup).

    If you PM me here I'll send you the modified project file with this demo scene included. Just send along your Unity Invoice ID that you got when you purchased the asset :)

    Cheers!
     
    Velcer likes this.
  26. gamedevassets-sean

    gamedevassets-sean

    Joined:
    Jul 26, 2013
    Posts:
    76
    Version 1.9.0 is now out. Price reduced slightly and some nice new features. Here's a quick teaser of some of the possible bullet patterns, and how it looks when combined with some post processing and URP:



    Remember, it's more than just bullet patterns, the asset gives you things like ricochet configuration, bullet hit particle effects, weapon inventory configuration and management and more :]

    Enjoy!
     
  27. gamedevassets-sean

    gamedevassets-sean

    Joined:
    Jul 26, 2013
    Posts:
    76
    Version 2.0.0 of the 2D Shooter Bullet and Weapon System has released!



    Added and updated features
    • Scriptable Object support for weapon configurations
    • Weapon pickups example using new Scriptable Object support
    • Unity InputSystem support added for control re-mapping
    • New bullet pattern configuration parameter for sine-wave like effects (sine wave vector)
    • Optimizations for included Object Pool (removed LINQ queries which could lead to small GC Allocs)