Sprite

Share

What is a Sprite in a Game?

A sprite is an image in a game that moves and changes, that has animation, specially in the context of 2D games. Sprites are usually images of characters, enemies, monsters, spells, and other effects.

Generally, game graphics are divided into 3 categories: the background imagery, which is static and doesn't move—this is often implemented using a tileset; sprites, which do move around; and other effects such as particles and filters (shaders).

When you have a small graphic that moves around the screen, specially if it's controlled by the player or the CPU, that's a sprite.

Media

Sprites can be created using various digital art media, such as vector art, pixel art, "hand drawn" high-resolution digital illustrations and paintings, and even pre-rendered 3D models.

Animation Techniques

There are many methods to animate sprites, let's take a look at how some of them work.

Sprite Sheets

A "sprite sheet" is a single image that contains all animation frames of the sprite. The game can load this single image file and algorithmically display the part of the image that contains a specific frame when necessary.

An image with a grid of 2 rows by 4 columns of animation frames. The first row is an idle standing animation, the second a running animation. At the right of each row, the resulting animation.
A pixel art sprite sheet next to the animated sprite of a brawler character. Artwork: Chasersgaming on OpenGameArt.org. License: CC0.

It's worth noting that it's always a performance benefit to put pack all graphics into a single file. In 3D games, the same technique is called a texture "atlas." Even on the web, a webpage can be made more performant by putting all icons into a single file (called a "CSS sprite") and loading that instead of having one file per icon.

Transformation Matrixes

High resolution digital artwork and vector art may make use of transformation matrixes to animate parts of the image such as joints (arms, legs, etc.). I think Aquaria (2007)1 was a game that used this technique.

Horizontal Mirroring

In general, sprites tend to only feature the character looking at one side, e.g. right. When the character faces left, the game program just draws the graphic mirrored. This makes sprites simpler to create and manage.

Leveraging programming to save resources in asset creation has always been important in games, and has always restricted what can be done in 2D games.

Most 2D platformers use this technique, and it's likely a reason why so many video-game characters are perfectly symmetrical.

For example, high-resolution artwork would lead you to believe that Megaman can only shoot from his right arm (including in Megaman X's intro), but in the Nintendo, Super Nintendo, and Game Boy games the sprites are just flipped.

Similarly, if a character uses a sword, they're ambidextrous and switch the sword from right to left hand when they turn around.

Observation: I suppose one technique to mitigate this it to draw the sprites right-facing if your game is designed such that the player goes toward the right more often than the left, which is commonly the case in linear 2D platformers. If it's a Metroidvania, like Metroid or Castlevania, then this won't help much.

We have plenty of isometric 2D strategy games, like Sim City 2000, Age of Empires, Final Fantasy Tactics, and Ogre Battle, because it's easy to flip isometric tiles like roads and buildings.

In RPGs where the view is slightly from above, like Chrono Trigger, Harvest Moon, A Link to the Past, Terranigma, ActRaiser, etc., it's necessary to draw a sprite looking up and down, since the version looking will show the character's back, but it's not necessary to draw both left and right as the asset can just be flipped.

Top-Down Rotation

In top-down games like GTA 2, you can just draw one sprite and rotate it programmatically to all 360 degrees.

This was only possible thanks to Playstation's powerful hardware. In previous generation consoles, games couldn't really rotate sprites by an arbitrary amount of degrees because that was too computationally expensive. It's possible to achieve 90, 180, and 270 degree rotation with simple algorithms, and perhaps even other specific angles, but "rotate this by 58 degrees" isn't as simple. I think maybe Nintendo (the company) could achieve it, considering what they did with Yoshi Island (1995), but they were making software for the hardware they created themselves, so they could achieve a lot more than third-party game developers.

References

Comments

Leave a Reply

Leave your thoughts! Required fields are marked *