Singular animation for multiple weapons

Get help using Construct 2

Post » Thu Oct 05, 2017 10:29 am

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:
Image

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?
ImageImageImageImage
B
32
S
9
G
7
Posts: 274
Reputation: 5,725

Post » Thu Oct 05, 2017 11:33 am

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.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
19
S
9
G
158
Posts: 2,401
Reputation: 84,429

Post » Thu Oct 05, 2017 3:21 pm

@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.
B
32
S
9
G
7
Posts: 274
Reputation: 5,725

Post » Thu Oct 05, 2017 4:11 pm

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:
plugin-csv-csv2array-csv2dictionary_t64326
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
19
S
9
G
158
Posts: 2,401
Reputation: 84,429

Post » Thu Oct 05, 2017 10:27 pm

@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.
B
32
S
9
G
7
Posts: 274
Reputation: 5,725

Post » Fri Oct 06, 2017 3:48 am

@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.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
19
S
9
G
158
Posts: 2,401
Reputation: 84,429

Post » Fri Oct 06, 2017 7:24 am

@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!
B
32
S
9
G
7
Posts: 274
Reputation: 5,725


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests