Singular animation for multiple weapons

  • Hey there, I'm currently trying to make a game like Dark Souls and I'm working on the animations (since that is a pretty crucial part of the combat system), but it didn't occur to me how may animations I would have to make for each weapon until now.

    If you're not familiar with Dark Souls, for each weapon class (sword, spear, halberd, etc.) you would have between 1 and 3 attack animations, 1 animation to return the weapon to it's idle state and then an idle animation with your weapon, rolling, running, resting at a bonfire, etc.

    And to make matters worse, the player could also wear 4 different armor pieces at once and a shield.

    I later saw a GDC talk (youtu.be/pmSAG51BybY?t=7m4s | Minute: 7:04 - 8:30) where he talks about splitting the character in multiple parts and having them rotate and position themselves based on a text file.

    So I was thinking how to implement this inside C2 and I thought of using arrays like this:

    The problem is that this would be quite tedious to set up (since C2 only allows you to change one X,Y or Z value at a time) and I would need one array like this for each animation, which would be quite a lot of arrays...

    So, do you guys have any suggestions on how to do this?

  • Your plan seems good to me.

    I would probably do this with one 2D array object with a couple of instance variables.

    Store all animation sheets in text files (CSV, XML) and load them into the array when you need them.

    Say, when player picks up a new sword, you open LongSword_animations.XML and create a bunch of AnimationArray instances:

    1. create AnimationArray, set variable object_type="LongSword", animation_type="idle"

    2. create AnimationArray, set variable object_type="LongSword", animation_type="attack"

    etc.

    Then you fill in these arrays with data from the XML.

    You'll need to code a bunch of functions, but you'll only have to do it once and will be able to reuse them for all animated objects.

  • dop2000 Could you go into a bit more detail on how exactly to do this?

    I'm not familiar with XML files or how to fill them into arrays.

  • If you google "Construct 2 XML", there are quite a few tutorials.

    I assumed you want to use XML files because the guy in the video used it. (at least I think that was XML, not sure)

    You might choose CSV or some other format to store animation. By the way, how are you going to prepare all these animation sequences?

    I personally prefer CSV, there are a few handy plugins by rexrainbow to work with this format. One called CSV2Array, so I'm guessing it can parse CSV directly into the array:

  • dop2000 I see, I'll look for the tutorials.

    Also, if by prepare the animation sequences you are referring to how I set the values of the array, I was planning to copy each value by hand for each keyframe of the animation (not each frame) and use the time value to see how much I would need to move /rotate the object per tick.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • TRMG Creating this data manually keyframe by keyframe would be a really long and boring job and the results may not be very good.

    Why don't you look for a special software that can create simple animations and export them in text format?

    That guy used Adobe Flash, I had some experience with it and it's a great tool for creating animations.

    I watched the video again, he actually exported animations in JSON format, not XML.

    So you'll need to parse JSON strings, I'm sure it's doable and still must be much easier than preparing all animations by hand.

  • dop2000 I have been using another program to make the animations and I would've copied the values from the program for each keyframe. But I think I will switch to Adobe Flash if I can export the animations automatically.

    Thanks for the advice!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)