viernes, 7 de junio de 2013

Animations, Actuators, Stacking and an Icon... Also, IndieDB

This week i tackled the animation problem for the first time in my engine, worked a little with the actuators (to fire animations and scripted events) and enhanced the inventory system with stacking. Also, i published the game on IndieDB, which was all in itself a nice idea.

Animations

Blender has a quirky way to store animation data when using NLA. You see, all the animations in blender are represented by what they call FCurves, those FCurves are almost always represented by 2D bezier curves with the X axis being the frame number and the Y axis the value of each component that the given FCurve modifies. The default animation of every object is represented by an action which is unfreezed, if you click on the freeze button you transform the given default animation in a Non-Linear Action or NLA for short.
"THE" freeze button
Each NLA is located in each object's "animation_data" property, which in turn has many "tracks" that contains "strips" composed by the FCurves. The real quirk here is that each strip has a property called "action" (huh? confused?) that contains the FCurves, it doesn't has the FCurves directly. So to resume, to acces the FCurve of a given NLA in an object represented by the variable "obj" you do:
track = obj.animation_data.nla_tracks[x]
fcurve = track.strip[y].action.fcurves[z]
points = [pt for pt in fcurve.keyframe_points]
There, you have it, bezier points every time of the day! Pheeew... That's a lot of trying and failing for one day. Btw, the default non-NLA of an object is on obj.animation_data.action, there you go.

Actuators

Because i spent the week bashing my head against Blender and its quirky way to implement its animations, i decided to implement the actuators in a dead simple way. So simple, it is shameful. Each "actuator" is a common collision or animation object, with a custom property which fires an animation or an event, depending on the property name. So, for instance "anim_ontouch" occurs when the player touches the object, and it fires an animation. How do you specify the object and animation to fire? "OBJECT_NAME.NLA_NAME" and if you want to fire the same object's animations, just do ".ANIMATION_NAME"... simple.


Stacking

So, if you played the demo previously, you'll know that the inventory grows endlessly big with each ammunition cartridge you pick, which is hard to handle and is a bad user experience. So i decided to implement stacking. It is in its early days, but it already looks WAY cleaner and organized.

Icon

We have a new icon, check it out!

IndieDB

And finally, i included KeeYA on IndieDB. It is looking good, stats are getting better and better with each passing day. If you're an indie dev, go NOW and publish your game there.

Also, publishing in Desura when you're listed on IndieDB is a no-brainer. Go... stop reading!

No hay comentarios:

Publicar un comentario