Advertisement

2d sprites - how many directions for smooth rotation?

Started by January 28, 2011 09:03 PM
7 comments, last by audigex 13 years, 10 months ago
Hey guys. I'm putting together a sort-of-remake game mostly for my own use: a Sid Mears Pirates style sailing game (although not a remake of that).

I've settled on sprites because I'm crap at 3d modelling, and static images are easier to work with: but I've hit a snag.

The only sprites I've made up until now have been for OpenTTD - standard 4/8 direction isometric stuff. ie a front and back view each for / - \ and | directions. However I want my new game to allow the vehicle to rotate smoothly, so obviously 4 directions isn't much use: it's pretty blocky, and I'm not going for an isometric style.

So, how can I make a rotation smooth? The sprites are vaguely rectangle, if that makes a difference.

I was thinking of having a base which rotates smoothly, and changes slightly perhaps 30 times per rotation. So if I'm making one rotation every 60 seconds, and it updates 10x a second, I'll rotate the sprite 20 times, then replace it with the next direction for another 20 loops.

Does this sound reasonable? I know it will still have some jerkiness, but the differences between subsequent directions should be sufficiently small to make it smooth-ish.

Thanks
Remember the original Starcraft? The sprites in that game were in 16 directions(well technically 9 and 7 directions were flipped to make 16). The sprites rotations appeared smooth enough to give the illusion of being completely 3D.
Advertisement
Ah I never thought of flipping! That'll save me half the work to start with - especially if I start with symmetrical lighting. That's brilliant, thanks. I'll run with that. Did the starcraft work in the same way as my thought of rotating 1 degree 20 times, then switching to the next (similar) sprite?
The Up/Down facing sprites aren't flipped. With flipping, 8 direction sprites are really just 5 images with 3 of them flipped. Respectfully, 16 frames(9:7), and 36 frames(17:13).
If you mean rotating 20 degrees then switching to the next sprite, essentially yes; However Starcraft's sprites are rotated in 22.5 degree increments. To have your frames rotated in 20 degree increments you will have 18 of them, which means you won't have directly north/south/east/west facing sprites, which will make them look odd when moving in those directions. My advice is to stick with factors of 2.

On the technical side, most 2D games keep track of the rotation(or direction), then at the end up the update cycle switch the sprite accordingly.
Yeah I see that's how most games do it, but I think mine will look pretty strange with jerky sprites - and the game I'm basing it on is smooth-rotating. It would be strange if the sprites rotated every 20 degrees. I'd rather keep it pointing in the right direction! The exact number isn't fixed yet, perhaps 12/16 - I'll see how long it's taking me to draw, and adjust accordingly. I can always double it later by adding in halfway sprites, when I'm back in the mood for drawing.

It's a sailing ship game, so it would lose a lot of the effect if it wasn't smooth, I think.
Also, note that animating on 1's for flipbook animation isn't usually necessary. You know the old school Warner Bros cartoon? They were almost entirely animated on 2's at 24 fps, which meant 12 frames per second. Unless you are close up on the action, the vast majority of people wouldn't know the difference if you had 12 frames of animation or 60 frames of animation.

If you're going with a sailing game, and you want particularly smooth sails, then animate the rest of the boat on 2's and then animate the sails on 1's, just duplicating your drawings for the boat.
laziness is the foundation of efficiency | www.AdrianWalker.info | Adventures in Game Production | @zer0wolf - Twitter
Advertisement
The sails are probably the least issue - they'll usually be at an angle relative to the wind and will only change small amounts at a time, or occasionally a larger movement. The hull will be doing most of the movement, but I take your point, thanks - I'll bear it in mind when setting the target/minimum frame rates and update rate :-)
You probably need 16 directions minimum, if not 32. This is also dependent on the size of the object on-screen -- smaller things have less apparent change per degree of rotation, bigger things less -- you probably want to think of this in terms of distance from the center of rotation to the furthest point on the image.

This doesn't mean, necessarily, that you need to hand-draw 16 or 32 directions (especially keeping in mind that you may have to animate other animation cycles for each of the 16-32 directions) but do keep in mind that mirroring the image will also cause the left and right sides of the object itself to swap positions. For objects with central symmetry there's no issue, but objects without such symmetry can look off -- They guy carrying a sword in his right hand will suddenly be carrying it in his left when he crosses the border between a generally-easterly direction and a generally-westerly one, for example. If the exact form of the representation is unimportant to gameplay, then it may only be a curiosity for the most attentive players and the majority may never even notice, but if it figures into gameplay or strategy, then you probably need to animate each direction by hand.

throw table_exception("(? ???)? ? ???");

Smaller things have less, bigger things also have less? I'm assuming one or other is wrong but I don't know which way round?

This topic is closed to new replies.

Advertisement