1. Diving into code

      written by Ray Benefield
      Uh oh... it happened again. I'm late on a blog post. I won't let myself slack further. At least I'm writing it now and not just waiting to the next weekend. Procrastination is a bitch. I made a big step this weekend and that is why this is late. I was busy writing out the first bit of code in Aggro Tactics.



      Up to this point



      So one of my goals was to be more documented this time around. I sat down and created some spec'ed out designs of the Console system and the Animation system before ever writing a single piece of code, the weekend before this last one. It took quite a bit of time to try to consider the various possibilities that I needed to consider for, but I got it done. And because of that I was able to dive into some code this weekend, and it was awesome. My goal is to make sure I try my best to spec out a system prior to actually writing the code for it. But it is impossible to fully plan for everything. The idea is to get out as many scenarios as you can before touching the code so you reduce the amount of frustration that is involved in debugging code that you didn't fully understand. Code that you build while you go can lead to a very tangled mess. Not this time...



      Step 1



      A big part of the polish in the last version of Aggro was the smooth animation sequences that I setup for the UI. It worked out nicely and I wish I could have used that system for the in-game objects. Sadly the Tweening system was made for that UI system alone and I didn't put the work into branching it out into other stuff. Also it was very basic and intended just for that system. I had found another Tweening framework that I really wanted to use. Oh and by the way Tweening is short for "in-betweening", it is a term used for getting from one value to another. There are different styles of tweening, some are linear, some have an "ease in" effect, or an "ease out" effect. Perhaps there is a spring effect at the end. The idea is that there is more than one way to get from point A to point B and each way can create a different feeling.

      One of the first things I did was design my Animation system for this new Aggro to use iTween, the framework that I originally wanted to use. iTween has some awesome smooth features. It is intended to make animating easy with just a line or two of code. So I wrapped my code around the iTween system. I wanted a system where I can store animations and keep track of their progress. I designed an "animationChain" system that are made up of "animationLinks". Each link is an individual part of the animation... a move, or scale, or rotation, etc. It lasts a certain amount of time and has defined characteristics. An animation chain is a series of links that create a full-blown animation. Chains can have all of the links play at the same time or delay links to play later for a dramatic effect. For example if you want to slide a widget onto the screen, then shake it and change its color when it was done. And by making this system I can make reusable links that can be placed in tons of different chains.



      Actually writing the code



      So I did jump into the code. I spent a lot of time focusing on how I wanted my code to be structured. How I was going to split it into regions, and how I was going to comment it. Structure is important as it improves readability and makes it easy to find what you are looking for. All those extra minutes add up. I originally typed all the files out prior to compiling and seeing if it was even properly syntaxed. And when I did try to compile it I had like 100+ errors. lol... but I cleaned it all up and got it working. I had a couple of holes in my logic that I had to go fix, but in the end I have a system where I can create a string of animations. The next goal is to clean it up and start adding features.



      Building up the potential



      Once I take the time to clean up the code and start adding the needed features onto the Animation system I can build something that hasn't been done in any previous version of Aggro. I'm creating an in-game console in which I can modify variables in real time so that way tweaking animations for polish and getting them to the right amount of pizaz is quick and easy. It will be handy in other places as well. This will be my first go at writing a system that reads commands and does what needs to happen, but I think things should go well and I look forward to making use of it. Like I stated before, every saved minute matters. Now is the time to put out the initial work so future work goes smoothly. Maybe this weekend I'll have a video of the animation system at work. One of the main goals is to push the animation system to work with the UI system that I used in the last Aggro. Then 3D and UI objects can be animated with the same system. Should be awesome.

      2 comments:

      Captain Pineapple said...

      It's good to have you back. You taught me all about level design back in Halo Reach and that was the most fun I've ever had in a video game. Good luck on your future endeavors in the gaming industry.

      GodlyPerfection said...

      Thanks a ton Captain. Your support is greatly appreciated. Like a lot. It is a HUGE goal, but I'm striving to reach it. Good to hear from you man. :)