Search Unity

Spell Casting Best Practices?

Discussion in 'Game Design' started by RecursiveRuby, Jan 17, 2016.

  1. RecursiveRuby

    RecursiveRuby

    Joined:
    Jun 5, 2013
    Posts:
    163
    Hey ok so I'm trying to figure out the best way to create a spell casting system in games like diablo, torchlight etc. Originally when I was designing it I did not even think about animation and had each spell lock casting for a bit based on the spell. For example a bullet may lock casting for 0.05seconds where an area blast may lock casting for 0.25 seconds. This was just so some spells couldn't be spammed so rapidly. Take a look at the following video to get an idea


    I'm now trying to get the spells to match up with the actual animation. So I've got some animation and I created some animation events on each animation signalling when spell casting should take place. Basically when you cast a spell now it will trigger a spell cast controller which accepts the details of the spell to be cast, it will do some pre cast effects depending what spell it is and when the animation signals it should be cast, it will cast the spell.

    So basically the system relies on animations to determine the time at which spells are cost in between each other not rather than a specific time. I've noticed some issues I'd need to fix before I implement it completely. But one thing I'm concerned about now is not having proper animations to create the specific spell mechanics I want.

    Would this new method be the best practice in handling how spells are cast and such? It looks a lot better in my opinion anyway. But it essentially leaves a lot of gameplay control up to the animations and how the mecanim. Which I'm not sure if this would be considered good or bad.

    I'd show off a video of the new system but Unity keeps crashing everytime I try to build. An Issue for another thread I guess. Any advice would be appreciated anyway!
     
    LostJourneyman likes this.
  2. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    Is that your video it looks pretty good
     
  3. RecursiveRuby

    RecursiveRuby

    Joined:
    Jun 5, 2013
    Posts:
    163
    Yeah it is and thanks ^_^ but yea in the video you can see how the spells and stuff are cast. I'd use another one to show it off but I don't really have any raw footage laying around.
     
  4. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
    i would add two animation for the hand with animator mask so you can play them over the mask

    -when you throw aimed projectile player put his hand in front of him and you cast everything from his hand
    -with aoe spells and not targeted spells, player just raise hand upwards
     
  5. AndrewGrayGames

    AndrewGrayGames

    Joined:
    Nov 19, 2009
    Posts:
    3,821
    LostJourneyman and Martin_H like this.
  6. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    While I respect @Asvarduil as a game designer, I have to disagree with this post. The attic also works well for summoning.

    Joking aside, the problem of inconsistent magic rules is normally not a big deal in games. The rules are hardcoded in. The only time it's really possible to break the internal logic is during cut scenes. Let's just spam a party member with potions every time they are injured. Except in that dramatic scene were they die with a thousand potions in their pack.