Search Unity

melee combat system ideas

Discussion in 'Scripting' started by diegzumillo, Sep 16, 2012.

  1. diegzumillo

    diegzumillo

    Joined:
    Jul 26, 2010
    Posts:
    418
    Hey there, I'm trying to com up with a sword fighting system good enough to get two ai sparring with each other, defending and attacking etc.
    My first idea: each opponent has an input of incoming attacks (could be more than one opponent) and an output to send attacks to a specific foe. It has one single parameter that defines how much it wants to attack and how much defense. So it takes this parameter and creates a timeline with a distribution of attacks. An attack is defined as a movement that takes t seconds and when it ends it sends a signal to the opponent. For example: the parameter is 0.7, so the timeline is 75% covered with attacks, the rest is automatic defense.
    There could be additional parameters, like rate of attack and power (more but weak blows or less but powerful blows).

    Any thoughts? :p
     
  2. boco

    boco

    Joined:
    Dec 7, 2010
    Posts:
    373
    Use a list or an array that triggers corresponding animations and use Hit-Boxes. That is how a normal fighter is created as I have made one in DirectX before. As for AI aspect best case is to have them first move towards each other.. once you got that you can then work on having them throw a swing every so often once you have that going get another animation and a swing then once you have enough. Start to use random values to trigger each move in different combos while moving toward their enemy. Once you got that then you need to think about Defense so then you need an algorithm that will take into account their HP and their enemies HP probably. based on that they will either A go all out or B play defensively I.E. backing up and blocking a lot.
     
    Last edited: Sep 16, 2012
  3. diegzumillo

    diegzumillo

    Joined:
    Jul 26, 2010
    Posts:
    418
    Ah... I see. The list would work like my timeline. And it already handles the "signals" with the animations themselves and collision.
    Is this what you meant? well, I like it! :)
     
  4. boco

    boco

    Joined:
    Dec 7, 2010
    Posts:
    373
    Yes that is what I meant.. sorry I like to explain things out very detailed. Good Luck on your project.