Sponsored By

Featured Blog | This community-written post highlights the best of what the game industry has to offer. Read more like it on the Game Developer Blogs.

Scraps is a vehicle combat game where you build your vehicle from parts, so vehicles can have all sorts of different weapon loadouts. This post goes into detail about how aiming is handled in the unique situation the game presents.

Bill Borman, Blogger

December 22, 2014

5 Min Read

Scraps is a vehicle combat game where you build your vehicle from parts, so vehicles can have all sorts of different weapon loadouts, and those weapons can be firing from all sorts of positions on the vehicle.

Weapon movement range is automatically limited to stop them shooting at your own vehicle, but beyond that there are further complications with perspective. Scraps uses multiple crosshairs - one primary one and one more for each weapon - to give players a better idea of what their weapons might actually hit. This post goes into detail about how that all works.

This post was originally aimed at existing players - to see it in action, a demo of the game is available here (the full verision of Scraps is not released yet).

The aiming system in Scraps

So what do all those cross-hairs on the screen mean anyway?

The short answer is that the white cross-hair is where you're currently aiming, and the various coloured cross-hairs show where your selected weapons are actually aiming, which will be as close to the white cross-hair as they can get. The different colours are for different weapon types.

Even accounting for weapon movement range limits, and the time it takes for them to move to a new position, the cross-hairs don't always line up. In the below screenshot, 2/3 of the weapons on the the player's vehicle are shooting the other vehicle, even though the main (white) aiming cross-hair is way above it. And the 3rd gun is aiming right at the cross-hair! Why is that?



It's because you're not looking straight down the gun barrel, you're looking from above it, so your point of view and the gun's point of view are different. Because of that, something can be in the way of the guns (in this case, two out of three guns are blocked by the other vehicle) but not in the way from your perspective (your main aiming cross-hair isn't hitting the vehicle at all from your point of view).

In an FPS game, your line of vision and the angle of your gun are often considered essentially the same. In third person games, the character is sometimes placed with their gun right in the middle of the screen, which also removes the problem (since your view and the gun's "view" are then the same). Neither of those were appropriate for Scraps.

In Scraps, your weapons always try to aim directly at whatever the main, white aiming cross-hair is currently aiming at, though they may not be able to due to limited movement range. Since you're dealing with two different points of view, the coloured cross-hairs exist to show you what your weapons will actually hit, assuming they fly dead straight. For projectile weapons, you may also need to manually account for bullet drop due to gravity.

This can sometimes be a little counter-intuitive. For example:



Here we're aiming at the box, and so is the machine gun. The cross-hairs line up.



Now we've aimed up a little, and the gun has aimed...down?

This is because we're now aiming at the back wall instead of the box - and hence so is the machine gun. But the box is in the way of the gun and not in the way of our view, since our point of view is above the vehicle. The gun has adjusted its aim to (theoretically) hit the back wall exactly where we're aiming, and the blue reticle is showing that the gun will actually hit the box, at that point.

Now you might be thinking, wouldn't it be way better if the guns just always aimed so they lined up exactly with the cross-hair?! Avoid all this weirdness!

But it's actually impossible:



If the gun aims high enough to clear the box, it'll be aiming way up, above where the cross-hair is. If it aims down to meet the cross-hair again, it'll start hitting the box, ending up below the cross-hair. There's no valid solution that makes the cross-hairs line up. Unless....well.

 A point for potential discussion

There's an aiming issue I'm currently thinking about. It's nice being able to have all your weapons selected at once to get maximum fire-power, but as the weapon options in the game increase, this becomes less viable due to different projectile speeds. A projectile that's meant to be lobbed at an enemy at an angle will hit too early when aimed straight from a distance, but other weapons may need to be aimed straight to hit.

I have some nifty code that I wrote for the AI to use that automatically adjusts the aim angle of any projectile to hit any point within range. I'm tempted to have it on for players as well because although it'd remove some skill required in aiming, I like it when things just work without being fiddly.

The problem is that with AI, I know what they're trying to hit. Scraps doesn't have a targeting system and I'm not keen to implement one just for this - there are enough buttons to press already. So my best guess for targeting is what the player's aiming at.

For slow projectiles, you'll often want to lead your shots, aiming in front of your target if they're moving perpendicular to you. If projectiles auto-adjusted their angle to hit what you're aiming at, in that case it'd be something behind what you actually wanted to hit, and they'd sail over your target. So manual weapon switching may remain the best option. Or just select all and shoot all over the place because really that's the Scraps way.

Read more about:

Featured Blogs

About the Author(s)

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like