r/unity_tutorials • u/LlamAcademyOfficial • Nov 01 '22
Video Learn how to implement procedural recoil based on a range, or even a texture for more "predictable randomness" on your bullet spread! Gun Series Part 2 Full Tutorial in Comments!
4
2
Nov 01 '22
As someone who has never made a game and wants to make a shooter, all that code is intimidating lol
2
u/LlamAcademyOfficial Nov 01 '22
😅 don’t be scared! This is part 2! We did a lot of that in part 1. There is a non-trivial amount of code here, but for a highly configurable system with a lot of guns, it takes some code!
1
Nov 01 '22
Thanks for the reply! I have to learn some basics but I was hoping that it would make sense and be less scary once I got started.
2
u/LlamAcademyOfficial Nov 01 '22
You can do it! Start small, understand the basics of how scripts work in Unity and build up from there. Making a shooter can be pretty complicated, so probably not the best starter project. Once you understand the basics I think you can check out this series and understand what’s going on.
If you have questions, don’t be afraid to ask!
Edit: You also don’t have to use texture-based randomness, that was just something fun I added for more granular control.
1
Nov 02 '22
Why does it look like an ad you would see on YouTube shorts
2
u/LlamAcademyOfficial Nov 02 '22
Well…. This trailer is actually a square-cropped version of the YouTube Shorts version of the video 🙂
2
3
u/LlamAcademyOfficial Nov 01 '22
Full Tutorial on YouTube
Hey all! Happy #TutorialTuesday!
This week is part 2 of the gun series, where you'll learn how to make, from scratch, a highly-customizable scriptable-object-based gun system that supports all kinds of things, like what we're doing today - procedural recoil!
If you're going to have more than a couple of guns in your game, you'll likely find a prefab-based workflow becomes cumbersome to keep cleanly structured and in sync as you extend functionality, add VFX, and want to reuse configurations.
In this video I'll be covering 3 modes of recoil/bullet spread
"None" - you're always perfectly accurate
"Simple" - choose a random value between some limits, getting closer to those limits the longer you "spray"
"Texture-Based" - choose an offset based on weighted random selection of pixels to give a more "predictable" spray, sampling larger areas the longer you "spray".
This is only part 2 in what's going to turn out to be a relatively long series. I'm going to cover other topics like:
Reloading
Fire Modes (burst/automatic/single shot)
Sounds
Projectile-based guns
Damaging enemies
Modifiers
Attachments
Skins
And more 🙂!
As always, the full project for this video is available on GitHub!