Published: July 18, 2023
26
628
5.8k

There are lots of ways to solve the problems that come up from this great illustration of 3rd person aiming/shooting. Especially when dealing with projectiles. I’ve wanted to talk about our solution for this on TLOU2 for a while and seems like there’s no better time than now! 🧵

I’m going to focus on the bow because there are even more complications when dealing with slow projectiles. As mentioned above, where does the arrow go along the camera vector when fired? What happens with discrepancies in collision? Let’s breakdown 2 common methods

1. Treat the bow more like a grenade The original TLOU does this. The 2D reticle is replaced with an in world GUI arc. The player has near perfect info on the path of the projectile. The projectile is no longer shot from the camera and the problem is circumvented all together.

Image in tweet by Derek Mattson

Some drawbacks with this method Aim skill matters less. With perfect accuracy info, all that matters now is timing. When does the player fire and how long will the projectile take to arrive. How far do I have to lead the target? This lowers the skill ceiling for the weapon.

Shooting into walls on accident. The in world GUI helps let the player know that this is going to happen, but shooting arrows into walls on accident always sucks regardless of whether the player has been given adequate feedback to avoid doing so.

Image in tweet by Derek Mattson

2. Just shoot the projectile from the camera I’m not certain, but I’m pretty sure this is how Tomb Raider does it. Shoot the projectile from the camera and add some fx from the bow to sell that it came from the bow. This works esp. well for faster projectiles.

Image in tweet by Derek Mattson

Potential drawbacks: When used with slower projectiles you can see them coming from the camera. You might lose some feedback from the arrow being shot from the bow. (i.e. tracer arc) It can make a bow “feel” so much like a gun it loses its identity.

In TLOU2, as I think many modern games do nowadays, we ended up with a hybrid. There are tons of ways I can imagine this being done, but I’ll break down how we did it. After several iterations, we ended up with a dual probe system. Meaning for every shot we shoot 2 projectiles.

As you might imagine we do send a probe along the camera through the reticle as referenced in the initial post. It collides w/ everything as you might expect. The environment, enemies, etc. It’s doing the majority of the work. BUT! This probe is invisible. 👻

Image in tweet by Derek Mattson

The second probe comes from the bow. We use the projected collision point from the initial probe to back calculate the arc of the 2nd probe. This probe is what has the art. The arrow, the tracer fx, etc. But the key to this probe is that it only collides with enemies!

Image in tweet by Derek Mattson

No more shooting into walls! Some people opt to not have a 2nd probe at all, but the negative aspect of that case is what if this wall was an enemy! Then we shoot past an enemy that the player character is aiming directly into which can feel like the game is “robbing” you.

Image in tweet by Derek Mattson

This worked extremely well for us, but may not work for every game. This is a single player only game so we don’t have to worry about negatively impacting other players. For faster projectiles this matters WAY less since they are usually already 10s of meters away at spawn.

Been meaning to do more breakdowns of this kind of stuff. Maybe I’ll actually get my act together come blocktober and do a more in depth analysis. Big shout out to Erin Daly and Kan Xu for who worked with me on this stuff during T2 dev. Couldn’t have done it without them.

One more shout out to our Combat QA on T2 most notably Victoria Law and @TheAttackKat who were invaluable in helping us catch all the edge cases.

@thedmatts This reminds me of something I saw back when Kirby and the Forgotten Land had just come out--that game stretches its hitboxes based on camera direction, so that if Kirby swings a hammer and it LOOKS like it should hit, it hits.

@dani_breez Yeah, I love that presentation!

@thedmatts By probes, do you mean raycasts?

@DjorGRI More or less yes. We used sphere casts projected along an arc that the projectile traversed over time.

@thedmatts I just want to thank you for being part of the team that created the game that has had such a huge impact on my life. Anyone who worked on these games is a GOAT in my book.

@thedmatts Learned a lot from the thread! Thank you🤩

@thedmatts The second probe only colliding with enemies is so smart! Got something similar but not this detail which'll help a lot. Thank ya for sharing, love reading about these kind of things.

@thedmatts The amount of thought that goes into things like this is always a treat to sift through

@thedmatts Thank you for this! Fascinated by this sort of breakdown of "how games work"

@thedmatts I think splatoon handles this very well, there are two seperate reticles; one reticle that shows the middle of the screen and the expected placement of the weapon's full range, and another reticle that shows where the projectiles will actually hit/land.

@thedmatts Clever solution!

@thedmatts This is great and eliminates most of the targeting issues. As someone who has worked on TR I can confirm your suspicions.

@thedmatts this is so fascinating, thank you for sharing the process!!

@thedmatts Awesome thread! I always loved how the bow felt in TLOU2. Some games get don't get bow gameplay quite well, but TLOU2 made it feel really good. Bow shot cancelling is another thing I think about in games that some get right and some kinda don't.

@thedmatts Thank you for sharing this! Incredible info.

@thedmatts Converted this thread into a step by step experience https://www.openthing.xyz/thed...

@thedmatts What would be the problems with something like raycasting from the camera's reticule and then having the character aim at that? The only thing I can think of is if an object passes in front of the reticule just as the player fires and throws off the projectile path.

Share this thread

Read on Twitter

View original thread

Navigate thread

1/32