Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

[RELEASED] BulletPro - 2D Projectile Workspace

Discussion in 'Assets and Asset Store' started by AlbinosMou, Oct 18, 2020.

  1. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    18



    Greetings, I’m here to present BulletPro, which will be your most practical solution to set up any projectile configuration for any 2D gameplay!

    BulletPro stands out by its instantaneous ease of use for every game genre that would require hitbox management: tower defense, platforming, top-down action games, and of course the most complex bullet hell patterns.


    This plugin is compatible with any version of Unity from 2018.4 to 2020.1, and comes with the following arguments:

    1 - Maximized ease of use:
    • BulletPro can create any 2D gameplay that involves projectiles, without a single line of code, in the most comfortable workspace: see images below.
    • But for experienced developers who prefer to use code, there are also scriptable bullet behaviours, and an Online Script Reference to this API - BulletPro can easily be extended.

    • WYSIWYG bullet layout editor: stack layout modifiers, draw stuff, work from textures, and so much more

    • Multiple alternative workflows:
    • Convert AnimationClips to bullet behaviours
    • Make any prefab into a bullet
    • Make use of infinite nesting levels so your bullets also shoot bullets
    • Instant integration workflow: when needed, change your assets in Play Mode!
    2 - Endless design space:
    • No limiting presets: instead, hundreds of combinable parameters that allow for any behaviour. Everything is modular!
      Of course, there are still dozens of example patterns provided in the package so you can use them as a basis.
    • Easily randomize any of these parameters, and/or make it depend on other external data, such as game difficulty.


    • Works with any collider shape: circle, line, composite/custom.
    • Lasers!
    • Homing behaviours!
    • Fully functional in any 2D space: XY, XZ, or any rotated plane.

    3 - Greatest performance available:
    • Handles collisions in the most efficient way, using GPU calculations
    • Handles sprite animations, VFX and SFX
    • Complete pooling system
    • Works on any device with hundreds to thousands of bullets.


    Here are the most important links once again:


    I hope you will enjoy using BulletPro as much as I enjoyed making it! I’d be glad to read your reviews and answer your questions.

    Cheers,

    Simon
     
    Last edited: Nov 14, 2020
  2. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    65
    Great work on this asset Simon! It is really fantastic.

    Imagine that you have a run n gun game and you want a "muzzle flash" sprite animation to play at the emitter origin when a bullet is fired and also you want an "explosion" sprite animation to play once a bullet collides. Is this built into the system, where you can slot these animations in? If not, do you have any recommendations for a good way to do this while using the system? Would you add it to the bullet prefab?

    Thanks for your ideas!!
     
  3. bsimser

    bsimser

    Joined:
    Sep 8, 2014
    Posts:
    99
    Just got this as part of the megabundle. Will be interesting to try it out. Documentation looks great! One question is the first example in the video isn't in the included scenes. Is it a commercial game or something? What is it from?
     
  4. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    18
    Thank you for your feedback!
    And sorry for the late response - I didn't get notifications from this thread, but I typically reply within one day via mail or discord.

    There are two built-in ways to achieve this, but one is clearly cleaner than the other:
    1) The hacky-but-faster way: you can fire a static bullet at the same time you fire your actual bullet. The static bullet can have its sprite animated to play the muzzle flash, then die.
    2) The clean way: bullets have an option called "Attach Prefabs and Behaviours". It allows you to attach the prefab of your choice as a child of a bullet whenever it gets fired. Not only the prefab can play your muzzle flash effect, but it will also carry a custom script that gets various bullet callbacks, such as OnBulletBirth, OnBulletDeath, and so on. Using this feature is all explained in the part 8 of the docs.


    It's part of a playable browser game I did to showcase the asset's possibilities. In place of the Inktober Challenge, I made one different bossfight a day during October 2020. It's called Doodleshots, and it's still playable for free on my website : click here
    The point was making complete fights in a really short timespan (around 30mn per scene), so the gameplay only relies on BulletPro and nothing else.
     
    Last edited: Aug 23, 2021
    bsimser and brittany like this.
  5. leooi

    leooi

    Joined:
    Sep 3, 2021
    Posts:
    9
    can support 3D game?
     
  6. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    18
    Hello, yes you can use it for any 3D game (or 2.5D), as long as the shooting action takes place on a single plane. (ie. the bullets travel along the same plane)
    This plane can be any rotated plane with any direction (not just XY or XZ!), this kind of project is always supported.
    Your bullets can also carry Mesh Renderers instead of Sprites, with the shader of your choice.
     
    leooi likes this.
  7. DoctorRafikii

    DoctorRafikii

    Joined:
    Sep 4, 2021
    Posts:
    1
    Just got this in a bundle, great tool so far! But I have one question. What is the easiest way for a bullet & player collision to kill the player? I have collisions working as I can see the bullet disappear on collision, but it doesn't execute my killplayer function?
     
  8. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    18
    Thank you for your feedback!

    Your bullet dies upon collision because both the Bullet and the BulletReceiver have their "kill bullet on collision" boolean set to true. For enabling other effects, you need to use the Events provided in the BulletReceiver component. For instance, OnHitByBullet() will be automatically invoked and pass a reference to the Bullet component that hit it, as well as the exact position of impact (Vector3).
    upload_2021-9-11_20-23-5.png
    You can plug your code in this event, that's where it bridges with your own game logic so you can use this information and kill your player.

    (Protip: if you need to obtain more data from the collision, your bullet can have any number of Custom Parameters, of any type. For instance, an amount of damage, an elemental property, a text, or even a reference to a ScriptableObject with complex effects of your own.)
     
  9. leooi

    leooi

    Joined:
    Sep 3, 2021
    Posts:
    9
    How to use my own prefab (3d) as a bullet
     
  10. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    18
    Hi, you can attach any prefab to a Bullet Component thanks to Bullet Behaviours, which effectively uses your prefabs as bullets if you turn off the other default modules such as Rendering or VFX.

    To make use of BulletBehaviours, you just have to follow these four steps:
    1) Create a BulletBehaviour script into your project. (Assets > Create > BulletPro > Behaviour Script)
    2) Add this script to your prefab.
    3) Drag that prefab in the "Attach Scripts & Objects" section of your bullets.
    4) Register the prefab in your Scene Setup's Bullet Behaviour Manager.

    The full user manual gives a more detailed explanation in its part 8.
     
  11. unity_ULEttr3FrCE33Q

    unity_ULEttr3FrCE33Q

    Joined:
    Jul 16, 2019
    Posts:
    10
    Why cant I use other than line and circle colliders in bullet receiver? I have straight walls in my game which cant use the circle collider type. Also the line collider only works on y-axis and on top of that it doesn't for some reason register collisions even though the circle collider does
     
  12. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    18
    Hello, although circles and lines are the only two primitives available for performance reasons, you can switch your bullet receiver to Composite Mode, which allows for any shape by combining multiple Circle and/or Line receivers.

    Line receiver is aligned with the object's local Y-axis so you can rotate the object's transform in any fashion. They're precisely designed for your use case (straight walls). It's often a good practice to have this kind of component on a separate GameObject (especially if you intend to use Composite Receivers afterwards), so its Transform can be moved, rotated and scaled at will.

    Finally, if you encountered problems with the collision detection, I suggest you make sure that both your Receiver and your bullets belong to the Scene Setup's plane (ie. make sure they have the same Z-coordinate if you play on the XY plane, or the same Y-coordinate if you play on XZ, and so on).
     
    unity_ULEttr3FrCE33Q likes this.
  13. leooi

    leooi

    Joined:
    Sep 3, 2021
    Posts:
    9
    Homing on XZ plane not working.
    upload_2021-9-29_18-7-21.png
    the enemy bullet is not chasing my player, it spawn away from player.
     
  14. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    18
    We just discussed this in Discord, but I'll also answer here for future reference: the issue has been found and the fix will be deployed in version 1.3.1.
    It should most likely be available by next week. (Asset Store validation time)
    Edit: 1.3.1 is now available, the issue has been fixed!
    My sincere apologies for the inconvenience, thank you for your patience!
     
    Last edited: Oct 6, 2021
    leooi likes this.
  15. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    65
    I'm making a platform shooter and not sure how I feel about tracing around all my terrain with bullet receivers. Is there a way to use Unity's collision system with Bullet Pro? The tilemap can automatically make colliders which is very expedient. But I am also wondering about the performance benefit of your system. To go to the trouble of having this custom collision system, it must be much more performant. In your tests, what is the performance benefit compared to using Unitys collisions?
     
  16. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    18
    You could add regular Unity colliders to the bullets, through the Bullet Behaviour system which lets you attach any prefab to a bullet - but it's really not the intended use, and the Receiver system exists because Unity's collision system is too heavy for handling hundreds of bullets.

    If you're using TilemapCollider2D, an alternative would be using Bullet Behaviours but without colliders, and then process collisions with the OverlapPoint() function from the TilemapCollider2D class.
     
  17. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    65
    When you are using Bullet Pro to make a platform shooter, how do you recommend handling collisions between the player and the ground, walls, ceiling, platforms, etc? Use regular colliders on the player and terrain and then also use bullet receivers on the player to collide with bullets and also line the terrain with bullet receivers so bullets will hit the terrain as well?
     
  18. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    18
    Exactly, collisions between the player and the ground/walls don't involve bullets, so they should use Unity's default collision system. There's no interaction with BulletPro here.
    Then, on top of that, you add BulletReceiver components to anything that could get hit by a bullet (such as player hitbox or obstacles).
     
    brittany likes this.
  19. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    65
    Thank you for your help! I am wondering if a bullet receiver can be attached to a tile, so that when I draw or edit my terrain tilemap, the bullet receivers are placed along with the tile automatically. That would make it much more manageable. I'll have to look into that. From your end do you see any issue with doing it that way? Thanks again for helping me understand the system.
     
    AlbinosMou likes this.
  20. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    18
    You're welcome!
    There should be no issue with placing bullet receivers directly on tiles, just make sure you don't exceed the receiver limit as set in your Project Settings.
    This limit defaults to 200 at once, you can manually raise it if needed. (Edit -> Project Settings -> Bullet Pro)
     
    brittany likes this.
  21. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    65
    I'm setting up a basic Emitter Profile that just shoots a single shot straight forward (to the right). Originally the bullet was being shot straight up and I didn't see anyway to change that in the emitter profile settings, so I rotated the bullet emiiter object by -90 on the z axis. Now the bullet moves in the correct direction, but of course the sprite is now also rotated and looks like its pointing down instead of straight ahead. Where is the setting to control this? I looked around and didn't notice anything but I'm sure I just missed it.
     
  22. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    18
    I'm not sure I understand the question - regardless of any object's rotation, the bullet will always move towards its own local "up" vector, so you should always have a correct sprite orientation as long as the texture you're using shows the bullet facing up. Is that the case?
    Then, the emitted bullet will have its rotation impacted by its parent bullet (if any), the shot it belongs to (if there's a parent bullet), and the bullet emitter transform itself.
     
    brittany likes this.
  23. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    65
    Ah ok so I have to draw my sprite that way. My game is horizontal so I was drawing all my bullets in a horizontal way. I will rotate the bullet in my graphics program and import the new sprite. Thank you for explaining that to me!
     
    AlbinosMou likes this.
  24. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    65
    I have a Bullet Receiver that is a Line. When I shoot bullets at it around the center, they collide properly, but if I move towards the last quarter of the line, on either side, top or bottom, the bullets just go through the line. I can look in the scene view and see the line is there but the bullets only collide in the middle half. What could be causing this?

    Edit: It is weird, I adjusted the collider on the bullet to make it more accurately fit the shape of the bullet and now it collides on the sides, but there is a small section in the middle where the bullets go through the line.
     
    Last edited: Jan 21, 2022 at 8:07 PM
  25. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    18
    This looks like a case where your two objects do not have the same Z-coordinate, which can create errors in the collision detection. It might be a bit counter-intuitive, but the Z-coordinate is actually used in calculations, so your gameplay plane can be rotated in the event you would want to make a 3D game.

    To clarify, you need to make sure every bullet and receiver has the same depth. If the problem persists, maybe you can also find help in the "Troubleshooting" part of the manual.
     
    brittany likes this.
  26. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    65
    I checked the bullets and the receiver and they are all on a Z position of 0. Nothing in Troubleshooting seemed to apply to this case. If I made a small demo project would you be willing to look at it?
     
  27. AlbinosMou

    AlbinosMou

    Joined:
    Mar 6, 2015
    Posts:
    18
    Sorry to hear this, it was the most common source of this problem. Sure you can send me a demo project and I'll look at it!
     
    brittany likes this.
  28. brittany

    brittany

    Joined:
    Feb 26, 2013
    Posts:
    65
    Thank you! I sent the project.
     
    AlbinosMou likes this.
unityunity