|
|
|
Fight Automation Documentation |
|
Goal: On this page I plan to go document everything I have done for this class. This will include documenting all of my code. Breakdown: First Technique (keyframed stuff) Final Technique (useing clips)
The method I used here was to duplicate a single character X number of times based on how my different clips were needed. Then for each of the duplicated character call them X0, X1, X2 ….. I take all of the key frames for a particular clip that I want to use in my animation and I copied them to each of the X objects. So now I have a total of n characters each with a different animation on them and each is key framed. Once this has been completed I proceed with the over all goal of the project which was to be able to create z number of characters and have them run q number of the X animations. With the above in mind we need to first create the z number of characters that will have the random q animations, call them Z0, Z1, …. Once with have these characters, I create a two dimensional loop (nested for loop) which proceeds through every character (Z) and for each character duplicates the key framed keys of a randomly selected character (X). The nested loop then continues by repeating the process. This allows for ever (Z) to have m number of random animations. This method has some horrible drawbacks. The render time of the simple characters in the clip took about 20 minutes for the short clip. Add in tons more characters and exponentially more complicated characters and this method my simply not be possible. Secondly animation imports may have been a rather large problem. Why I did it this way. It was early in the quarter and I was very unfamiliar with anything that maya could do. However even though none of this code was used and it took my forever to do, it gave me some great experience for my next technique. Final Technique Combat Code Scene Code Movie After talking with Cara she really helped me out with a better way that she had just found out how to do herself. First of all maya actually has clips which do pretty much what my code was trying to do with copying keyframes. It also allows some great features which I will discuses later. So with clips and the trax editor in mind I set out on a completely different idea of how I was going to create this randomized clip adder. The most basic way of explaining this is the following. There are a set number of clips, for each character which is to have these clips the clips are selected at random and duplicated and placed onto the character. How the code works. The system is created inside a script node which is set to be run every time the frame is updated (each frame). Once the system is called it checks it cycles through every Circle Character on the combat field. Then checks the ib (inbattle) flag if the value is equal to COMBAT (2) the system is called. Once the character is in the combat system the clipdone flag is check to make sure the character is not in the middle of a action and if that is not the case we move on. Then circle guy finds out who his opponent is which is a flag on this character. Once this is done a random number is selected from 1-8. Numbers 1-3 are for Circle guy attacking, 4-6 are for square guy attacking, 7-8 are for the deaths of Square guy or Circle guy. Once the number is selected if it is 1-6 the clip that lines up with the number is attacked to the Square guy and the Circle guy. Then the clipdone flag is updated to indicate when the next action is to take place. If 7-8 is selected this indicates that one of the characters is to be killed. So the clip is loaded just like before and the clipdone updated. Then the ib flag is changed to (1) to make the guy who won the fight return to the flocking system and the ib flag of the guy who died is set to (3) indicating he is dead and will no longer participate in the battle. This continues until no characters are in combat. Adding Blending. After this basic combat system was created the problem with it is the attacks seemed to snap in place and not give us a nice smooth blend that we would like to see. So I did some research and was able to find a way to blend clips in maya. The problem with the clips which were to be blended needed to both already be on the trax editor and they needed to be overlapped to created the blend effect. So in-order to do this I added a new flag to every character which saved the name of the current clip so that I would be able to blend the new clip with the old. Then I updated the clipdone value so the clips would have an overlap value. Later using the same method I added a blend for the guys from the walk into to combat and from the combat into the walk. This was very difficult because I had to edit the flocking code (which is fairly complex) to get this to work properly. Problems. The main problem we had was integration with the flocking code. The flocking team used the geometry to hold all of there variables and I used the characters to hold the variables. Since the flocking team had their hands full I went ahead and volunteered to change my code. To do this I created variables one the character and on the group which linked each other together and from there it was just a look up fest to get the variables I needed.
|
|