Search Unity

Refining loose melee lock-on

Discussion in 'Scripting' started by Sendatsu_Yoshimitsu, Nov 25, 2014.

  1. Sendatsu_Yoshimitsu

    Sendatsu_Yoshimitsu

    Joined:
    May 19, 2014
    Posts:
    691
    The control scheme for my third-person game is very resident-evil esque, where W moves forward, A/D turns, and S backs up. As a tactical concern, you can't rotate the camera beyond your character's facing: if you want to look at something, you need to be rotated so you can see it. For exploring and stealth this is a great system, but now that I'm working in melee combat I'm thinking about ways to integrate fun, flowing combat without adding an entirely new system.

    To this end, I'm trying to make a compromise between Arkham Asylum and brawler games with a very loose, hidden lock on: if your aim is close (within 5-10 degrees of a bad guy), you swivel a tiny bit and successfully hit. For forward-facing enemies this is easy, I just check a cone whose center is aligned on the player's transform.forward, but I'm a little stuck on how to do it to either side and behind me: ideally, if you see an enemy behind you, use WSAD to indicate his rough direction, and hit attack, I would like to pivot and attack him. Where I'm stuck is, how do you make this functional, but not overpowered? I could just take the vector of your horizontal + vertical inputs and test that like I test the transform.forward, but it's much harder to be precise when you can't quite determine what direction you're aiming. On the flip side, if I make it too easy to hit somebody who isn't directly in front of you it will feel very fake, and become more of a timing game than a skill game. Is there some easy middle ground I'm neglecting?
     
  2. fox4snce

    fox4snce

    Joined:
    Jan 25, 2014
    Posts:
    74
    Hard to get exactly what you mean.

    Why don't you just do the same thing on the sides and behind?

    Why not just take the transform forward, multiply it by -1 and you should have the vector for behind you. Use transform.right for left and right?

    Is it a sword.. is it a foot? what kind of weapon... if I were making a brawling game.. I'd consider that any move behind me is going to have less accuracy... something with better range, wider arc... but less power might be the way to go. This solves your problem of accuracy.

    Instead of an attack, make it a dodge... oh.. I hear something behind me.. duck*

    I'm not sure timing and skill are different.
     
  3. Sendatsu_Yoshimitsu

    Sendatsu_Yoshimitsu

    Joined:
    May 19, 2014
    Posts:
    691
    I'm trying to write a very generic system that can work for both weapons and unarmed attacks- I simply give it the range, AoE, and timing profile for each attack, and I can pretty quickly customize a diverse range of fighting styles. For prototyping, however, it's very linear punching and kicking, at least until I get the feel and flow right.

    With timing vs. skill, I was just trying to articulate that I want the player to aim at least a little bit-Arkham has great combat flow, but they also have this thing where you essentially don't have to maneuver at all, as the attack button while move you adjacent to the closest guy in the general direction of your attack. Let me play around with dodging versus precise attacks versus broad attacks though, you might have an excellent idea there. :)
     
  4. fox4snce

    fox4snce

    Joined:
    Jan 25, 2014
    Posts:
    74
    I'm glad I helped find an avenue for you to explore. It sounds like you've got an interesting system set up.
     
  5. Sendatsu_Yoshimitsu

    Sendatsu_Yoshimitsu

    Joined:
    May 19, 2014
    Posts:
    691
    I'm 90% sure it's interesting to me, hopefully when it's finished it will be interesting to other people too- thank you for the feedback :)