Better Blueprint Bullets

Please vote for this on the Trello Marketplace board.

I’ve seen some people asking around the forum on how to do “real” bullets.
Not the projectile from the 1st person example, and not the instant hit linetrace from the multiplayer shooter example, but “real” bullets with travel time and bullet drop.

So, I’ve gone ahead and made that.

So far, it is just the bullet travel, the drop and some drag applied to the bullet in flight.
The drop is fairly accurate compared to real life, but the drag is a rough calculation for now, a flat 20% drag pr. second.

&stc=1

The slight drop over time. Bullets fired straight up will come straight down again.

&stc=1

The bullet Blueprint right now.

Latest update of the system.
It is now works in a multiplayer environment.

That is actually pretty smart ^^

I believe the reason Epic hasn’t implemented this is because they want a generic extendable Projectile class. You might not want your spells, or effects, or well, everything, feeling gravity,drag,etc. And remember, UE4 isn’t just a gaming engine, hence, projectiles must be generic classes.

Don’t take me wrong, this is definitely a much needed addition!

If you need sources for formulas and data, here are a few links that may help you:

I’m not sure what you mean by this?
obviously this way of doing multiple line traces implemented in Blueprint isn’t the best way for performance. But why must a projectile be a generic class?

This makes no sense to me to be honest. It’s not an addition to the engine itself, it’s an “standalone” asset which you buy from the marketplace if you need it and it’s allowed to be made for specific use cases only.

I feel like it could cause some issues, but I am not sure as I would have to test it.
I think my main questions are
a) is it compatible with projects that use a similar weapon setups as the ShooterGame example?
b) does it work well with automatic/burst weapons?
c) how can I use your asset for different weapon setups? An assault rifle has a different bullet drop than a sniper rifle, just as an example.

I hope my questions make sense, as I am not really sure if I expressed myself clear enough >.>

A) Right now it is not working in a networked environment, this will be handled before release. It should be compatible with any and all weapon setups you can imagine when .
B) It should work fine, the mechanics of the bullet is what this handles so far, no weapon mechanics. Your Blueprint will have to handle bursts, this will handle the flight of the bullet.
C) You can tweak the velocity of the bullet, this changes the drop per meter travelled.

This is still in the early stages.
I will make some example weapons and include. These will be without animation most likely, but burst and auto will be there, as will single shot.

A note about drop rate.
The gravity on earth is around 9.8 m/s. So if you drop a solid object, it will after one second be travelling around 9.8 m/s. This goes a tennis ball weighing 1kilo, and for one weighing 20 kilos. There is a minute difference due to wind resistance being the same for both objects, but the mass is different, but for all intents and purposes, it has no effect on the bullets I try to simulate.

This means weight has no effect on the drop rate of the bullet. It will however have an effect on how the effects of drag is calculated.

I agree, you missunderstood me lol. What I’m saying is: this is a good project and addition, but its normal that Epic hasn’t added it to their source by default ^^

That’s a lot easier to understand than before :slight_smile:
But yeah, I like the idea, but if I would buy it depends on the price and what’s to come.

And an addition to my questions before: what I meant with “Does it work well with automatic/burst weapons?” is how it performs. I don’t care about networking, since I work on a SP only project, but what happens when you have hundreds of bullets flying through the air?

I can’t speak for this implementation, but I wrote something similar in Unity3D, and I was able to use thousands per second without any issue. And I was slicing time significantly thinner than this implementation because I needed as much accuracy as possible in the path the bullets took. I didn’t bother optimizing it but if I were to do so I know one optimization off the top of my head that would significantly speed things up. Not sure how I’d do it in Blueprints though, might only make sense in C++. (Or C# in the case of my old system.)

Obviously you’ll want to have ownership of bullets and to have them do damage. Whether that damage is based on the type of bullet or the impact is up to you. The further you get down the accuracy rabbit hole the more complex it gets though. A good compromise is to use the shape of the bullet, some constant damage value, and the speed of the bullet at impact to come up with the final answer.

Ricochets and penetration based on physics materials is nearly a must for a modern shooter, at least one that’s trying to be as accurate as you are.

You’ll probably want to allow importing .CSVs to define bullet data. There’s a lot of information out there already and the easier it is to get it into the engine, the better.

Slow motion is an interesting trick, because if you keep doing things like you do right now, it’s going to produce errant behavior where the same bullet in the same exact state will take two separate paths depending on whether you use slow motion or not.

Projected trajectories will help users that want to show players where the bullet is likely to end up, think Sniper Elite on lower difficulties.

Wind is a difficult problem if you want any level of accuracy whatsoever, and any amount of variety in your map. A general purpose implementation would be a normalized vector with a min and max strength, that would affect bullet position as well as drag depending on the angle relative to the bullet. Try to go much further than that and I expect you’ll have a hard time. Elevation is reasonably simple, but add indoor and outdoor areas, valleys, buildings, rooftops, cranes, etc… and you’re going to struggle to get correct behavior.

There should be absolutely no problems with performance in single player. That is off course unless the player controls 10 miniguns firing 100 shots per second and shooting extremely long distances.
For any “normal” use cases, this should easily perform well on any platform.

As for the price. I will probably release this for free to begin with, to get user feedback. Later, when the project becomes better, with implemented weapons, network support etc I might start charging a small amount.
I will have a new version ready monday or tuesday, and will submit to Epic then.

I’d like to hear about this :slight_smile:

I’ll probably do some calculations when the bullet hits. I’ll give a percentage of max speed the bullet is currently travelling at. I’ll make a calculation based on weight and speed and return that as a Joule value for realism.

Ricochets and penetration is beyond the scope of this project as of now.

I had thought about doing CSV import of bullet data, I think you just convinced me :slight_smile:

There is time dilation built into the engine, I will test this method as well as a quick and dirty math hack to make the bullet move slower. I’ll also test for consistency when slow mo bullets are used.

Wind effect is tricky yes, so is drag. I’m not going for perfect simulation though. “Good enough” is the goal. Not perfect. Even Arma3 has less than perfect bullet mechanics.

Thank you for you input. Things have been noted.

Just a quick video of the system so far.

A demonstration of how to set up a weapon.

  1. Yes!
  2. Not all FPS need bulletdrop, maybe a toggle to turn it off?
  1. Good.
  2. I’ll put in options to disable gravity and drag for the bullets.

Here is an updated list of what I’m going to work on:

  • Mathematical drag model that factors in weight and size of bullet.(This is changed from S-Curves since you can get “good enough” results with this model. Also, easier for you guys to make new weapons that way.)
  • A shooting range to test your weapons.
  • Full multiplayer support.
  • Wind effect applied to bullets to make longer shots harder.
  • More configuration options on the weapon.
  • Slow motion shots
  • Recoil(not just animation)

After watching your demonstrations and considering that my approach is a lot worse in terms of functionality (the damage is decreasing with distance, but there is no actually drop like in your work), I do think that I’m going to purchase it as soon as it’s available on the marketplace. It’s also what I actually wanted to create, but I wasn’t able to…
Keep up the great work!

I like this.

Now just curious would it be possible to do a shot gun with multiple traces?

EDIT: Also what about toggling between fire modes? Single fire, 3 round burst, Full Auto, etc. Would this be possible?

What are you planning on charging for this blue print?

Would it be possible to do Stationary Heavy Machine Guns (Example: M1918 BAR) and Rocket Propelled Grenades (Example: RPG-7) with this BP?

Is there a delay for reloading weapons via a variable? So we can match the speed of our weapon animations to the reload speed of the game logic?

Would it be possible to have wall penetration for rifles for thin objects? Wood Planks, Sheet metal, etc.

Would it be possible to have a variant of this Blueprint for Advanced Vehicles such as Aircraft and Tanks?

Just curious here :slight_smile:

  • HeadClot

A shotgun would take some work since it is a different beast completely. I could make an example though.

Toggling fire modes from full auto to single shot would be easy peasy. Bursts would take some work. Again, I could make an example.

Stationary guns is no problem, neither would remote controlled guns be.

Reload I could easily do with a delay. But you would have to provide the logic to check if your character has ammo anyway, so it wouldn’t be completely necessary. I can put it in easy enough though.

Penetration I plan to do, but it is one of the later things. Not because it isn’t important, but because it is one of the more complex issues. Not sure if this would be in the first shipping version, it will come though.

Tanks and aircrafts is beyond the scope of this project. But the guns could easily be fitted to whatever else you can think of. You could easily do a little Blueprint magic and have them fire from wingtips of your fighter or whatever.

As for pricing. I’m thinking around 20$.

Awesome!

At that price this is a 100% Sure buy for me :slight_smile:

Just a quick update as to why there are no updates.

I’m in the process of making the project working in a networked environment. This has resulted in some restructuring.

The project has expanded a little, it will be more or less a complete “realistic shooter” template.

Take your time. I do want this and I am willing to wait. :slight_smile: