Works been insane, preparing for a big demo next week - however I found some time to start roughing in my crosshairs/shooting code. So I want to allow for weapons to lose accuracy as you shoot, have different recovery times and min/max accuracy rates as well as defined accuracy loss, many not just linear.
So here's what things look like in game now:
You can see my crosshairs (epic 5m effort in GIMP lol) - as you shoot they 'bloom' out. But what surprised me was how to make this happen in unity3d - using an AnimationCurve. It turned out really well (in my opinion!). Basically I use the curve and a time index (0 - 1), to determine where on the curve to find the accuracy, 0 being no shots fired/full aim, and 1 being spray and pray mode.
Here is what the weapon script looks like thus far (see below) - you can see how the curve looks for a given weapon, in this case my shotgun is pretty much linear for loss of accuracy, and its degrade rate basically jumps 0.5 on the time scale with each shot (2 shots quickly brings you to worst aim rate for the shotgun). The recover rate is fairly fast though, so pausing between shots for just a second will keep aim predictable - otherwise get up close and personal :).
What's cool is that I can edit the curves so that weapons have a "dead zone" - for instance the first 3-4 shots of a pistol hardly adjusts its accuracy at all, after that things start to go hairy. A SMG on the other hand gets 2-3 shots before accuracy starts going haywire. My plan is to give each weapon a distinct feel in this area, rifles for instance will definitely have really high max accuracy but lose it after 1-3 shots (depending on weapon, upgrades, etc).
And yes, there might just be upgrades - for certain there will be skills to enhance your ability with certain weapon groups .. but i'm considering upgrades. Not sure on that yet, it may obfuscate the game a bit more than i'd like, will determine that as I get further along here .. perhaps skills to adjust handling and recovery rates, etc... and mods to manage sound, clip length and such.
No comments:
Post a Comment