Diagonal poses in top-down games

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Diagonal poses in top-down games
by on (#65020)
Top-down games have four schemes for allocating sprite cels to movement directions:

In a 4-way cardinal scheme, sprite animations face north, east, south, and west. Sprite flipping can generate west and possibly some cels of south and north, though it may create artifacts too. Pac-Man, The Legend of Zelda, and Pokemon use this because their movement code emulates a 4-way joystick. A Link to the Past and Link's Awakening use "rounding": they allow diagonal motion, but the animation uses the last pressed cardinal direction. I don't know whether RPG Maker uses 4-way movement or rounding, but all the sprite sheets I've seen for RPG Maker have only front, side, and back views.

In a 4-way diagonal scheme, sprite animations face northeast, southeast, southwest, and northwest. Again, the west cels may be flipped. This is seen in "isometric" games like Q*bert and Solstice.

An 8-way scheme has cels from both cardinal and diagonal schemes. Overhead levels in Super C are like this, as are Ikari Warriors and Mission: Impossible. So is Super Mario RPG. Schemes with more angles are possible in games whose characters move in circles like race cars, such as Galaga and R.C. Pro-Am.

One disadvantage of a scheme with a lot of directions is that it takes a lot of memory and thus a lot of time to load the tile images into memory. ROM is cheaper than it used to be, but RAM is still limited. With fewer directions, you can load the cels and forget them, but with more directions, you may have to keep swapping them in more often during gameplay. Another disadvantage is that it can prove harder for a pixel artist to keep all directions in proportion and in sync, and it takes more memory. I'm learning Blender so that I can make proper 8-way references to trace over with pixels.

by on (#65025)
Quote:
In a 4-way diagonal scheme, sprite animations face northeast, southeast, southwest, and northwest. Again, the west cels may be flipped. This is seen in "isometric" games like Q*bert and Solstice.


This has the advantage you can have only 2 views flipped, but the game has to be isometric, then it's not top-down as you say on the start of your post.

Quote:
A Link to the Past and Link's Awakening use "rounding": they allow diagonal motion, but the animation uses the last pressed cardinal direction.

Dragon Skill, the game I'm developing does this. It's really simple to code, and fluid. It also has the sword as a separate sprite so that I can have my sprite always use the same hand to handle it.

Having a character look west or north when walking northwest will be okay, but have a character looking northwest when walking west or north is likely to look horrible.

by on (#65027)
It's not really mentioned, but I don't see tile use as the problem with games like this, unless you're using NROM.

I've made HUGE (16 x 32) eight direction walking sprites for an adventure game I might make after I finish my current game. The main character's hair is slightly asymmetrical and I keep her head (16x16) consistent since I only use 3 tiles more the each flipped direction. (east/west 1, northeast/northwest 1, southeast/southwest 1.)

I gain those tiles (and I think one more) back because I can reuse a few tiles again to form the back of her head. (Black haired character).

Standing eight directions (head and body) is like 32 tiles for these huge sprites. Then only the body changes, and it's 32 more for the two frames of walking she'll do. 4*3 for everything but north and south for one frame. Flipping makes it 3 and not 6. +2 for North since it can be flipped so its use is divided for the other frame. Same for south. So (4*3+4)x2. For the remaining walking tiles.

That's 64 total. I admit that's a lot but these sprites are huge, and NPCs don't need eight directions. Depending on if they move they might just need one.

For smaller sprites, it comes out at (4*3+4)*3 = 48. Take some for re-usuability. If you only have 2 frames it's only 32.

tepples wrote:
One disadvantage of a scheme with a lot of directions is that it takes a lot of memory and thus a lot of time to load the tile images into memory.


I haven't thought much on the implementation, but I'm pretty sure I could get something decent with CHR RAM. If I keep the main characters tiles in RAM at all times I can always delay NPC tiles from loading if say... two want to change frames at the same time. It's harder, but I'm positive I can do it. :) with well designed CHR ROM banks I'd even say it's easy.

tepples wrote:
Sprite flipping can generate west and possibly some cels of south and north, though it may create artifacts too.


I wouldn't bother doing it for a fighting game, but I've always liked preserving asymmetrical features of sprites across directions. My current platform character(16x16) actually has an asymmetrical walk animation. His right and left foot do different things. But because of how he's put together it costs me very few tiles to preserve this across his 16 directions. 30 tiles for all that plus a crouching animation. Character design that lets you reuse tiles goes a long way.

One thing to be careful about when doing things Link's Awakening style movement, is to avoid moonwalking. In Link's Awakening after doing nearly any action, it's possible to make Link walk backwards. Grab a rock to your right. While picking it hold up + left. You're walking backwards. Swing your sword right. (Don't hold the button down, that causes an intentional backwards walk.) While it's swinging press up or down/left. Or while facing right just press up and left in the same frame and hold them. You can walk backwards facing any direction. They don't bother changing direction if two directions are pressed at once. Though I actually think it's pretty fun to do whenever possible. Maybe the developers thought so too.

Edit: Depending on the game, there's also the option of assigning one direction to the diagonals. In an older game I made, moving up/left or down/left would play the left walking animation. Up/right or down/right would play the right one. Though in a game with sword attacking like Link's Awakening you'd lose some precision doing this.