VariaBULLET2D Projectile System (Create Patterns Visually)

A place for people with an interest in developing new shmups.
User avatar
casualcoder
Posts: 346
Joined: Sat Apr 21, 2012 4:35 am
Location: West Coast, Canada

VariaBULLET2D Projectile System (Create Patterns Visually)

Post by casualcoder »

Hey everyone!

I have been working on a 2D projectile system in the course of developing my game... a game which I'm sure will come up in these parts some time in the near future.

Anyways, I ended up realizing I can make the projectile system available to other Unity developers, so that's what I did.


Image

Watch the trailer:
https://www.youtube.com/watch?v=FMS_mq87fm8

About VariaBULLET2D
-----------------

It just launched today and this is the first place I thought to mention it. Hopefully some of you might find it useful or will pass it along to other's who might.

Put simply the system is highly extensible at the coding scale, but is also highly visual and most of the patterns and behaviors can be set in the editor.

A few other solutions that exist - and I had tried - mainly depend on a 100% scripting system that parses XML definitions... which is great but can also be boring to work with, obtuse and inefficient.

Other solutions I found to be very closed and don't adapt well to specific scenarios or extensible behaviors... so that's why I decided to make my own system.

The system works equally for player1 ships, bosses, platformers, run n' gun, vertical/horizontal/omnidirectional shooters. Basically any kind of 2D game that requires projectiles.

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

KEY FEATURES
A snippet of some of the features of interest to shmup developers in particular:
  • - Set emitters visually in the editor
    - Nest and automate emitter groups
    - Omni-directional firing
    - Simple shot animation frames and rotations
    - Simple and efficient one-click object pooling
    - Timer and emitter-death event system
    - Storable presets and realtime preset switching
    - Slowdown and CPU throttling emulation
    - Flexible collision and explosion system
    - Potentially 1000's of bullets at 60FPS
    - Simple audio event system
    - Shot parenting and release events
BASE SHOT TYPES
As mentioned, you can easily extend base shot behaviors in code but the system comes with the following already made:
  • - Linear (Physics/Non-Physics)
    - Accelerating (Linear/Exponential)
    - SpeedWave
    - Bouncing (Physics)
    - Gravitational (Physics)
    - Homing (Non-Physics/Inertial)
    - Re-Angle
    - Boomerang
    - Laser Beam
    - Laser Packet
    - Bullet With Emitters
    - Exploding Bullets


You can get the asset package here:
VariaBULLET2D on the Unity Asset Store

Extensive documentation can be found here:
VariaBULLET2D Documentation

A QuickStart video that shows some of the very basics as simply as possible:
https://www.youtube.com/watch?v=INAL4-myBWo


Please let me know if you have any questions, thoughts or suggestions!
Last edited by casualcoder on Fri Feb 28, 2020 5:51 pm, edited 1 time in total.
User avatar
MrJBRPG
Posts: 231
Joined: Wed Jan 04, 2017 10:42 pm

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by MrJBRPG »

That reminded me of the time that I tried to make shooting game prototypes using Unity, especially with another plugin called Uni Bullet Hell. It seemed quite decent and addressed a few problems such as not being able to freely direct shots when it came to omnidirectional.

I also attempted to make shots that allowed you to hold and then release by coroutine, but they were messy compared to doing that through the update loop.

I like to try this later on.

I wonder if you played with UniBulletHell? If so, what were your impressions?
User avatar
casualcoder
Posts: 346
Joined: Sat Apr 21, 2012 4:35 am
Location: West Coast, Canada

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by casualcoder »

MrJBRPG wrote: I also attempted to make shots that allowed you to hold and then release by coroutine, but they were messy compared to doing that through the update loop.
Yeah coroutines can be pretty messy (and costly) as they are their own event based subroutines that need to be managed. Sort of like another Update. But it certainly makes sense if it's an uncommon process that doesn't have to run on every frame and is costly to run on a per frame basis.

I used a simple rate slider to control shot rates in VariaBULLET2D.. it runs on every frame but it's not costly.

For release, it I just put in a custom event. This allows shot parenting and then upon release unparent the shot... along with a bunch of other stuff.
MrJBRPG wrote: I wonder if you played with UniBulletHell? If so, what were your impressions?
I did not try UniBulletHell. I was almost done developing VariaBULLET2D before I noticed it.

I can't really figure out what its specific angle is (like how to determine shot trajectories/behaviors)... no pun intended.

I think people will really like VariaBULLET2D if they actually get a chance to use it. Getting something like this into people's hands is a mystery to me.

I'm already thinking I should maybe lower the price to an introductory point to stimulate sales and get some ratings. Do you have any pointers on that?
User avatar
MrJBRPG
Posts: 231
Joined: Wed Jan 04, 2017 10:42 pm

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by MrJBRPG »

Probably a good idea to have base price between $15-25 at first.

Since you made the asset for Unity, it would be recommended to have a support thread as well on Unity. I go there regularly when I had questions in regards to the specific aspects that I have yet to understand or have problems.
User avatar
casualcoder
Posts: 346
Joined: Sat Apr 21, 2012 4:35 am
Location: West Coast, Canada

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by casualcoder »

Thanks for the suggestions.

Yeah I did start a thread in the Unity Forum but like everywhere else it seems to have gone unnoticed:
https://forum.unity.com/threads/variabullet2d-projectile-system.744173/
User avatar
casualcoder
Posts: 346
Joined: Sat Apr 21, 2012 4:35 am
Location: West Coast, Canada

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by casualcoder »

I took your suggestion and dropped the price to 50% OFF for the first two weeks.

Seems to have made the difference :)
User avatar
MrJBRPG
Posts: 231
Joined: Wed Jan 04, 2017 10:42 pm

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by MrJBRPG »

I have toyed around with your asset since yesterday and I feel more motivated to experiment thanks to your in depth tutorials on video and website.

I do have some suggestions to possibly improve the product:

I noticed that several aspects of the timing, such as shot rate, pause rate, and pause length are recorded in frames after experimenting in play mode, yet the words alone does not make it clear. Perhaps utilizing a tool-tip to describe components can make it more clear.

As a stretch goal, maybe also consider the option to switch between time in frames and seconds as toggle.

I also noticed that the shots can be controlled through button press command with key command, which is great for testing, but might not be useful when using it for a full game because some developer would want to use it with custom control mapping solutions, like Rewired or InControl, for gamepad controllers and more.

One way to get around from my experience is to set fire command to Automatic and then use the Trigger Auto Fire since they are both public variables. I can then use the public variables with my custom control scripts to enable and disable Trigger Auto Fire to get the same effect for pressing custom button to fire shots.

Perhaps you should consider integrating Fire Command aspects with Rewired so it can be easy to tie it with button press and button press auto hold.

Here is the link to Rewired. Spend some time looking over and determine if it's worth integrating with your asset.
https://guavaman.com/projects/rewired/

By the way, I wonder what is the difference between regular and Auto Hold on the fire commands, especially with button press and automatic?


Edit 1:

I found out that some shot prefabs do rotate, and I did not know until later, within the Shot folder of the scripts, that the rotation speed was actually set higher than 0. You should have a checkbox option, at ShotBase, to disable rotation and colorize settings so it becomes easier to control rotation of particles rather than having to digging too deep into dealing with numbers.


Edit 2:

I have discovered that when turning on the Trigger Auto Fire when Fire command is automatic, the first shot is done and takes twice as long for shot delay until the next shot, with the correct frequency. It may have something to do with fire bullet cs script under AutoFire which relies on two conditions instead of one, which may explain the cause of the unexpected additional shot delay.
Last edited by MrJBRPG on Wed Jan 01, 2020 7:38 pm, edited 1 time in total.
User avatar
n0rtygames
Posts: 1001
Joined: Thu Mar 15, 2012 11:46 pm
Contact:

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by n0rtygames »

Well done on releasing the asset!

I'm going to moan a bit - I saved all the compliments til the end to make you feel better <3

My gripes: Object pooling on its own really sucks. I've learned this the hard way. It takes you so far. You don't want to have thousands of bullets which all have their own transforms, sprite renderer and so on. How are you detecting collisions? Does each bullet have its own collider?

The best approach here is instanced rendering (and not just ticking the 'gpu instancing' box on the material, you'll need to make a custom shader with instancing enabled and other trickery for doing animations) and arrays of matrices that you update in bulk, sorting and referencing by int index which you can swap between alive/dead lists.

This would allow you to have 1000+ fully animated bullets per draw call and understanding this approach really is a necessity for anyone looking to go full danmaku on lesser hardware. That's over a thousand per -draw call-.

I don't see mention of this in your description though?


That being said - tech stuff out of the way - holy crap dude. That's a lot of sounds/sprites and for £20 this is basically a no brainer for anyone wanting to pick up Unity and hit the ground running on a shmup with not too much coding experience. I have explored some off the shelf packages and yeah, now I just roll my own because it's just far easier and I know what I'm doing. If this was around when I was looking at off the shelf stuff then it would've been an insta buy just to relieve some of the heavy groundwork.
facebook: Facebook
User avatar
MrJBRPG
Posts: 231
Joined: Wed Jan 04, 2017 10:42 pm

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by MrJBRPG »

I tested your asset more and tested more on the controller (shot patterns in particular) and turned a few points into nodes to make more shots.

I found out that when pressing a key on the parent controller, it only fires its parent emitters that are not nodes and does not reach to child nodes that search for controllers.

I wonder if it is possible to implement an option to give users a boolean checkmark for "Allow shooting from nodes", which means storing a list of controllers (point's child must be a controller), which make all of the child nodes' controllers fire from the parent controller. That way, players can shoot elegant patterns from branching nodes as well.
User avatar
casualcoder
Posts: 346
Joined: Sat Apr 21, 2012 4:35 am
Location: West Coast, Canada

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by casualcoder »

Hey guys, thanks for the feedback. Sorry that I didn't notice earlier. Had a family issue recently and missed the notification.

I'll try to answer best as I can below.
MrJBRPG wrote: I noticed that several aspects of the timing, such as shot rate, pause rate, and pause length are recorded in frames after experimenting in play mode, yet the words alone does not make it clear. Perhaps utilizing a tool-tip to describe components can make it more clear.
I agree, its ambiguous. I'll look into making that more clear.

MrJBRPG wrote: As a stretch goal, maybe also consider the option to switch between time in frames and seconds as toggle.
As it stands it's probably best thought of as delay frames. I tend to think in frames rather than seconds but I'll think more about the suggestion.
MrJBRPG wrote: I also noticed that the shots can be controlled through button press command with key command, which is great for testing, but might not be useful when using it for a full game because some developer would want to use it with custom control mapping solutions, like Rewired or InControl, for gamepad controllers and more.
I mentioned in the doc how ButtonPress is best for testing. I left the exposed bool up to the user to implement with their own input system, pretty much as you say you ended up using it. I have Rewired but haven't really worked with it much. If I can get it working nicely I'll definitely think about integrating support with VB. Afterall, I'll probably end up using ReWired for my own game, so may as well!

MrJBRPG wrote: By the way, I wonder what is the difference between regular and Auto Hold on the fire commands, especially with button press and automatic?
AutoHold holds the the firing for an amount of frames depending on the value set in AutoHoldDuration. Probably best described here: http://neondagger.com/variabullet2d-qui ... ring-shots
MrJBRPG wrote: I found out that some shot prefabs do rotate, and I did not know until later, within the Shot folder of the scripts, that the rotation speed was actually set higher than 0. You should have a checkbox option, at ShotBase, to disable rotation and colorize settings so it becomes easier to control rotation of particles rather than having to digging too deep into dealing with numbers.
Might be a good idea. I usually prefer to keep things as simple as possible and avoid a ton of check boxes so that's why I default to "0" meaning "off."
MrJBRPG wrote: I have discovered that when turning on the Trigger Auto Fire when Fire command is automatic, the first shot is done and takes twice as long for shot delay until the next shot, with the correct frequency. It may have something to do with fire bullet cs script under AutoFire which relies on two conditions instead of one, which may explain the cause of the unexpected additional shot delay.
My best guess is this has to do with the engine having a hiccup on play, particularly in the editor. But it could evidence itself in an actual build. Right now there's a WaitForSeconds() set in the BasePattern/SpreadPattern Awake() which I think delays execution by a frame or so. You can add to this value to make sure everything's loaded up and there's no hiccup. The next build should have a Coroutine which allows you to set whatever delay time you want and expose that via a property. I can post it here a bit later as its just a few lines of code.
n0rtygames wrote:Well done on releasing the asset!
My gripes: Object pooling on its own really sucks. I've learned this the hard way. It takes you so far. You don't want to have thousands of bullets which all have their own transforms, sprite renderer and so on. How are you detecting collisions? Does each bullet have its own collider?
I considered making the system based on sprites vs material/shader. In the end I went with sprites because I wanted to preserve as much of an oldschool feel as well as make it dead simple. Also I basically started implementing my game using BulletML and later decided to make my own system, so being happy with the gameobject/sprite model in BulletML I went with that. I benchmarked along the way and was pretty happy with the results using a very old test bench. Notice how Unity improved its collision system dramatically in newer iterations drawing a closer performance gap between particles and gameobjects:

https://neondagger.com/variabullet2d-ti ... test-bench

Bottom line is I would expect 2000+ concurrent bullets with throttling/pooling enabled running under a recent version of Unity on any system within the last 10 years, approximately (?)

And if you remove the colliders, you can probably easily do 10,000+ bullets without a framedrop (according to Unity... I didn't test it as I stopped testing at around 4000 bullets). I figure this might be used by some who want a ridiculous amount of bullets and can roll their own collision detection. Most users I don't think will need more than 1000 bullets at the top end though, probably (?)

n0rtygames wrote:Well done on releasing the asset!
If this was around when I was looking at off the shelf stuff then it would've been an insta buy just to relieve some of the heavy groundwork.
I appreciate that, thanks. I started with it being my own solution and around half-way thought, what the hell, I'll release it and maybe it'll be useful to other people and help fund my own gamedev ventures. Pretty hard to accomplish one of those let alone both!

MrJBRPG wrote: I wonder if it is possible to implement an option to give users a boolean checkmark for "Allow shooting from nodes"
Good point! I think that's another good suggestion that should end up in the next build :)
User avatar
n0rtygames
Posts: 1001
Joined: Thu Mar 15, 2012 11:46 pm
Contact:

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by n0rtygames »

Mostly my performance related stuff comes from the fact I've been devving for the switch lately too (dont say it too loudly.. people will start asking me for a port..) - this is really what I meant by lower end hardware.

Generally my target is to coat the entire screen in normal sized bullets and get 60fps

Great response btw, I'm still considering picking this up anyway.
facebook: Facebook
User avatar
casualcoder
Posts: 346
Joined: Sat Apr 21, 2012 4:35 am
Location: West Coast, Canada

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by casualcoder »

I'll definitely follow up but wanted to quickly mention a performance optimization that I came up with that I'll try out and see if it's worth implementing.

Since the vast majority of the bullets are coming from enemies, it should be a pretty big performance boost in principle to disable enemy bullet colliders by default and do a simple proximity check to the player, turning the collider on only when within a certain radius, basically. That should allow for a lot more bullets without the added physics overhead of all of those colliders that aren't going to collide anyways.

One problem I immediately notice is the bullets should no longer collide with terrain or any objects other than the player. Though I don't think that's very common in most shmups anyways.

EDIT: I realize that removing the collider entirely and rolling a simple proximity check would basically solve the issue. Thousands of bullets should be no problem and pseudo-collision detection will be just as accurate. Will have to divert re-pool in this case as the OnCollisionEnter2D event won't be raised. Easier and more performant but might be confusing and result in an ugly inheritance structure. I'll run some tests and see what the costs/benefits are but it should be a big boost.
User avatar
n0rtygames
Posts: 1001
Joined: Thu Mar 15, 2012 11:46 pm
Contact:

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by n0rtygames »

Honestly, the deeper you go in to this you'll eventually reach the conclusion that you don't need gameobjects at all :D
facebook: Facebook
User avatar
casualcoder
Posts: 346
Joined: Sat Apr 21, 2012 4:35 am
Location: West Coast, Canada

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by casualcoder »

n0rtygames wrote:Honestly, the deeper you go in to this you'll eventually reach the conclusion that you don't need gameobjects at all :D
Probably, but I'm seeing some conflicting info on the pros/cons - from efficiency to platform constraints on GPU instancing (mobile, mostly). Mainly, I just don't know if the knock-on effects of replacing the gameobject/sprite model will result in more difficulty with other aspects, as simplifying rendering/draw calls is just one aspect to consider in an entire system.

I find it useful treating shots as gameobjects with components so you can flexibly determine a lot of other behavior. And it's a model people are used to whereas working with shaders can be a bit more obtuse.

I'll look into this idea of mesh renderers/GPU instancing but incorporating it would probably result in a total re-write and I would have to weigh the pros and cons. In the end, simplicity and flexibility is more important to me than squeezing out every last performance gain, especially if I can get the engine to reliably pump out thousands of bullets on low-spec hardware.
User avatar
casualcoder
Posts: 346
Joined: Sat Apr 21, 2012 4:35 am
Location: West Coast, Canada

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by casualcoder »

Early tests are very promising. When restricting (temporarily disabling) colliders, getting a complete curtain (3240 bullets) while staying around 60FPS @ 1080p on my 10 year old test bench system.

Keep in mind that none of these bullets are repooling (as they're too slow to leave the screen) and I've used an slightly more aggressive throttling than needed (28% slower engine, though still not very perceptible and it kicks in gradually). So with tweaks can certainly improve on this.

Image
User avatar
casualcoder
Posts: 346
Joined: Sat Apr 21, 2012 4:35 am
Location: West Coast, Canada

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by casualcoder »

Here's a quick animation of the concept in effect, modified bullets to "light up" when in close enough proximity to the ship, turning on/off the colliders in response.

Image

It's a lot of bullets, hard to imagine most cases as wanting more than that.

I like the idea of maintaining this basic system for most bullet scenarios. It's just nice to be able to animate with frames and keep things very simple. But if users want a metric-ton of bullets/particles then I don't see the problem of also using a mesh-renderer+gpu instancing option. Maybe could get up to 20,000 bullets by doing that, with the trade-off that they'll likely look a lot more bland owing to the single-object draw call. Working on it...
User avatar
casualcoder
Posts: 346
Joined: Sat Apr 21, 2012 4:35 am
Location: West Coast, Canada

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by casualcoder »

By the way, the current sprite/gameobject system VB uses results in 8 batches (draw calls). And it doesn't increase. So if performance tops out at 4000 bullets then that's 2 batches per 1000 bullets.

Kind of surprising as I thought draw calls were the one thing the mesh+GPU-instancing option dramatically improves. Can anyone shed light on this?
pieslice
Posts: 200
Joined: Sat Mar 01, 2008 12:15 pm
Location: Finland

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by pieslice »

gpu instancing has maximum limit of 1023 draw calls per batch. dynamic batching has limit of 300 triangles per batch, but there is cpu overhead to generate the batches. Keep mind that for the gpu instancing to work, both geometry and material must be same. With cpu based batching, only material is needs to be same.
If you absolutely must have to draw all bullets in 1 pass, you must use gpu, but I think that is overkill.
User avatar
casualcoder
Posts: 346
Joined: Sat Apr 21, 2012 4:35 am
Location: West Coast, Canada

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by casualcoder »

pieslice wrote:With cpu based batching, only material is needs to be same.
Currently VB uses spriterender with only the typical sprites-default material.

I'm getting 8 batches per >4000 bullets, 8 set pass calls (draw calls), 8k tris, 16 verts.

So what you're saying is I'm currently getting the benefits of batching/lower draw calls with the current setup, though if I wanted to I could bring this down to a single pass draw call by using gpu instancing, with the trade-off of being really simplistic looking bullets (?)

I'm a bit confused because I'm hearing that I could probably get 20,000 bullets @60FPS with GPU-instancing, whereas I'm getting 4,000 bullets @60FPS with the current setup. That's a big difference, and yet the draw calls difference doesn't seem all that disparate between the two methods.

Mind you, I'm only going on what I'm hearing in regards to the performance of GPU-instancing. I haven't tested it because in order to integrate the test in VB I have to mess with my inheritance structure, which assumes sprite frames/renderers. I know it sounds lazy but this is not the first time I've heard of a magic-bullet (pun intended) and just ended up wasting my time trying to implement it.

You've been a big help already so if you can't elaborate much I understand.
pieslice
Posts: 200
Joined: Sat Mar 01, 2008 12:15 pm
Location: Finland

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by pieslice »

Gpu instancing is the most optimal way to draw stuff out of the box (even when the batch count might end up being higher than with dynamic batching, cpu does mot need to *weave* the batch unlike with db so you end up with less overhead and save cpu cycles).

With gpu instancing, maximum batch size is 1023 draw calls per batch so the most optimal batch count is bullet count/1023. You can create more complex shader (experiment here, I have managed to do alpha and glow in single pass by using premultiplied blendin and multitextures) to render more complex bullets, and you can pass per instance data for animation, sprite uvs etc.

For tens of thousands of bullets I suggest you delve into the ECS territory and (possibly) compute shaders to create the geometry
User avatar
casualcoder
Posts: 346
Joined: Sat Apr 21, 2012 4:35 am
Location: West Coast, Canada

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by casualcoder »

n0rtygames wrote:Honestly, the deeper you go in to this you'll eventually reach the conclusion that you don't need gameobjects at all :D
OK, ran some tests and... guess what? I didn't see any significant performance increase between VariaBULLET2D sprite rendering vs gpu-instanced.

In fact, performance is almost identical. With throttling VariaBULLET2D is actually better, but that is a bit of a cheat I guess.

Batching is the only real performance gain using instancing, but if you only have a single frame bullet in VariaBULLET2D it creates 8 batches per 4000 bullets while I'm getting 2 batchers per 4000 with instancing. But for whatever reason this isn't really much of a performance gain.

I would be interested to see what messing around with shaders would yield in terms of more interesting bullets vs performance. But messing with shaders just isn't my bag.

pieslice wrote:For tens of thousands of bullets I suggest you delve into the ECS territory and (possibly) compute shaders to create the geometry
Yes, ECS is definitely the way to go moving into the future. All of these rendering aspects seem like hacks to me. But from what I can understand ECS is still very early stage in Unity. I believe you have to roll your own physics systems and other aspects that come out of the box in Unity's OOP gameobject/component model. So, probably still a ways off from that being mainstream enough to work in it and for users to find it user friendly.
pieslice
Posts: 200
Joined: Sat Mar 01, 2008 12:15 pm
Location: Finland

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by pieslice »

it is clear that batching is not the most demandining task in most sprite based games so you should not prematurely optimize the batching part. Batch counts will become bottleneck in the range of thousands, so diffrence between 2 batches to 8 really should make no difference. modern aaa games usually have from 2000 to 4000 batches per frame, and mobile games also exceed 100. For the mobile projects I’ve been doing in the last 2 years, we have about 400 draw calls per frame but we rely heavily on gpu instancing
User avatar
casualcoder
Posts: 346
Joined: Sat Apr 21, 2012 4:35 am
Location: West Coast, Canada

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by casualcoder »

So, VariaBULLET2D V1.03 update is out!

Many of the prior suggestions were implemented. A list of the main additions:

- Added persistent shot banking (global pooling) capability.

- Added Master controller capability, allowing a top-level controller to control shot triggering for nested controllers.

- Added inspector tooltips for fields in core scripts.

- Added ColliderFlux option to bullet shots (dynamic colliders = big performance boost = 1000's more bullets)

- Added more flexible emitter pitch controls.

- Added ShotOverlap field to FireBullet scripts. Allows layering subsequent shots over/under previous shots.

- Added TriggerDelay for delaying triggered shots on start.

- Added global RateScale which can be used in tandem with SpeedScale to create a simple global difficulty adjustment.

- Added TurretFollower script for following a moving target.

- Other various optimizations.


A very short video showcasing some of these additions:
https://www.youtube.com/embed/9SebrTJHvR4


While the engine can now accommodate thousands more bullets at lower cost, I'm still looking into eventually improving performance even more with the prior mentioned GPU-instancing option and, long term, entity component system. Early tests haven't really worked out for me so far. Not sure if my system/GPU is outdated or if I just need to read up on these things more but as it stands I'm pretty confident the engine can support 6000+ concurrent bullets on limited hardware, which is probably considerably more bullets than any bullethell game I know of. But, improvements are improvements so will keep digging!
User avatar
9uile
Posts: 50
Joined: Mon Jan 13, 2020 4:57 pm

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by 9uile »

Hi,
Regarding the dynamic colliders which is great for perfs, it means that bullets can't detect collision with others gameobjects when they're far from the player ? Actually, i wonder how do you detect the way bullets return to the pool.
User avatar
casualcoder
Posts: 346
Joined: Sat Apr 21, 2012 4:35 am
Location: West Coast, Canada

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by casualcoder »

9uile wrote:Hi,
Regarding the dynamic colliders which is great for perfs, it means that bullets can't detect collision with others gameobjects when they're far from the player ? Actually, i wonder how do you detect the way bullets return to the pool.
Exactly right. I noted this in the documentation. It's a trade-off. I notice in a lot of bullethell games with a lot of bullets the shots don't collide with any world objects other than the player (Deathsmiles is a notable exception).

So... depends on how important it is for you to have bullets hit walls. If you have a section in the game where you do need them to hit walls or something like that, you can just use bullets for that which don't use the dynamic collider option. And just leave the dynamic collider option for areas with insane amounts of bullet floods (usually boss battles, in which case wall collisions likely aren't needed anyway).


RePooling is usually triggered by either hitting a collidable object or going out of bounds (outside of the screen). Some cases have their own repool overrides. Example: boomerang shot repools when it comes back to its source emitter.

So you can easily override/create your own repool behavior simply with calling RePoolOrDestroy() at any point in your custom shot code and/or overriding the base RePool() method.
User avatar
9uile
Posts: 50
Joined: Mon Jan 13, 2020 4:57 pm

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by 9uile »

Thank you for your answer. it's true that it depends of the level structure. i'm not a big fan of danmaku but it's a good way to test a bullet system ! I didn't know that colliders have a signifiquant impact on perfs.
User avatar
casualcoder
Posts: 346
Joined: Sat Apr 21, 2012 4:35 am
Location: West Coast, Canada

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by casualcoder »

9uile wrote:I didn't know that colliders have a signifiquant impact on perfs.
Yeah it was a bit surprising to me as well just how costly they can be.

I also found out you can cut down on cost considerably if you treat colliders as triggers and use OnTriggerEnter2D instead of OnCollisionEnter2D.

The reason I didn't use the trigger method is because it doesn't check collision intersect location when the collision occurs, which makes instantiating explosions in the correct place (and a few other things) a bit messy.

But none of this even makes a difference with the new dynamic colliders addition, so I think it's definitely worth using if you plan on having well over 1000 bullets onscreen at once and on low-spec hardware. Otherwise, for non-Danmaku games, you will be completely fine not using dynamic colliders - even on an old Pentium probably!
User avatar
MrJBRPG
Posts: 231
Joined: Wed Jan 04, 2017 10:42 pm

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by MrJBRPG »

I have experimented with your update once more and I am pleased of the results made so far, especially with the master trigger being the big help.

While experimenting your asset with my small prototype, I have noticed a few things that could be improved:


Shouldn't the "Make point node only" be at the top of the bullet option? That way it becomes easier for the user to decide when to extend the node with another controller. Also when toggling the node option, it should enable and disable bullet components depending on mode.

When playing with the shot controller, I also noticed that when trying the symmetry with two emitters with 180 degrees, for both spread degrees and pitch, the two nodes do not exactly line up together like reflection from the mirror or clear frozen lake. It is somewhat offset by some small amount that I cannot adjust. I have sent a separate email with more pictures and details.

That is as far as what I have discovered for improvement so far.
User avatar
casualcoder
Posts: 346
Joined: Sat Apr 21, 2012 4:35 am
Location: West Coast, Canada

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by casualcoder »

MrJBRPG wrote:Shouldn't the "Make point node only" be at the top of the bullet option? That way it becomes easier for the user to decide when to extend the node with another controller.
Yeah it's a small detail but I think you're right. I'll change that in the next update.
MrJBRPG wrote:Also when toggling the node option, it should enable and disable bullet components depending on mode.
This one I thought about early on in development and decided against it. Unity is really messy when it comes to enabling/disabling as you always need to keep a reference to the component to control that process... because once it's disabled, it can't re-enable itself! Which means the user would have to hit the toggle and also manually re-enable the script as well. Which may not be obvious. Kind of silly issue but in the end the performance cost is very low and the user can just disable the script after turning it into a node and at least in that case they will know why the node doesn't switch back when changing it to the point indicator.
MrJBRPG wrote:When playing with the shot controller, I also noticed that when trying the symmetry with two emitters with 180 degrees, for both spread degrees and pitch, the two nodes do not exactly line up together like reflection from the mirror or clear frozen lake. It is somewhat offset by some small amount that I cannot adjust.
Oh! That was you! Lol, was reading this and thinking what are the chances some other guy noticed the exact issue within hours of someone else. I guess you got the fix then. As mentioned I'll add those updated sprite indicators in the next update.

Thanks again for all of your awesome feedback.
User avatar
MrJBRPG
Posts: 231
Joined: Wed Jan 04, 2017 10:42 pm

Re: VariaBULLET2D Projectile System (Create Patterns Visuall

Post by MrJBRPG »

I am now in the process of trying out the collision hit with your prefabs, and I have been hit with an error:

"ERROR: " + sender + " requested Explosion named \"" + name +
"\" was not found. Make sure the Explosion prefab name or request string is correct."

I have used your pre-exisitng prefabs with correct string name, but the problem is that it cannot find the prefabs.

Wouldn't it be easier if you can drag and drop the prefabs into the places instead of typing the string.

I have noticed that your game demos work and my game prototype did not.

I have named my prefabs section _prefabs deliberately because I wanted it at the top of the my main game project.

Do you have any tips on how to properly utilize the collision name recognition? I have not seen much documentation on that.
Post Reply