Thursday, April 05, 2007

The wonderful headaches of precision sprite animation.

Well, I was hoping to have already been working on the demo for the comic book convention by this point for Barricade, but time flows a lot faster then I would like in a day, or at least it'd be nice to

A. Have enough wealth so I wouldn't have to work to earn a pay check for the rest of my life, I could dedicate my time to that which I wanted(I'm working towards this one.)

B.Had more hours in a day.

C. Could manipulate time with my mind so that I could get more accomplished.(I'm working on this one also)

So, I'm not really that far behind schedule all things considered. Only a couple of weeks of what I was shooting for to get done in the month of march, but now I'm running into some other issues, that I recently had to solve, and are in the process of now being resolved.

The main issue, had to do with animations for my sprite class. I have no idea how other people handle this in their code. I haven't bothered to ask or do research, but the way I've been handling it is simply loading a sprite sheet into memory as one texture and then mapping the sections with the individual frames to be shown at the appropriate time.

Some pseudo code might look like
----------------------------------------------------------------------------------
LoadTexture
Sprite->Animate

Call to Animate Looks like

advance function hit count
get active frame

if enough hits have taken place advance the active frame number


MapTexture
for frame one show these texture coordinates

for frame two show these coordinates

ect..
---------------------------------------------------------------------------------

My actual codes a lot better structured and is organized object orientedly and works great. The problem is that when I go to manually map my textures in my current editor
(I'm concurrently building a new editor as these issues and the demo are being built)
I have to go in and manually manipulate the textures for the frames to show up correctly on the quads. This is where I'm sure it isn't the best approach, but I don't really know another one, (Aside from having the graphics artist create the sprite sheets very precisely, which seems to be as much trouble as I'm having on my end anyways.)There are slight shifts in the textures do to slight shifts in the textures when I'm going in to map them, and while the anomalies are small and would even possibly be unnoticeable to someone playing the game, they are pretty damn obvious to me.

The solution I've come up with thus far is to increase the precision of movement for mapping the textures and also come up with a more precise grid for aligning the texture on the quad. I'll be trying this out in the next couple of days when I have a little bit of time this weekend.

If anyone out there can make some suggestions or offer any similar experiences up, I would be thankful, although I'm not sure if anyone ever reads this anyways, but if you do thanks in advance for the comments.

No comments: