Sprite (computer graphics)

A sprite (English, among other things for a spirit, goblin ) is a graphic object that appears on the graphics hardware on the background image and the remaining contents of the screen. The positioning is thereby completely handled by the graphics hardware. For example, most graphics cards provide a hardware sprite for the pointer available.

The name comes from the fact that a sprite on the screen " haunt " and is not to be found in the graphics memory. Over time, the term has also be extended to all objects that look like that, even if they are generated by software and be in video memory.

Today the real sprite technique is outdated, especially since computers have become fast enough without problems represent thousands of sprite -like objects on the screen and at the same time restore the background in original form. Also, the disk storage needed has become less important.

Related terms

Often, the term sprite is also used for generalizing objects by software (instead of graphics hardware ) appear over the background. However, this is, strictly speaking, a shape, which is usually referred to as "Software Sprite ". The same applies to an object that is copied by means of hardware routines in the graphics memory, but without being fully managed autonomously by the hardware; here is a BOB ( blitter Object) or MOB ( Movable Object Block ).

In 3D games, the term sprite is sometimes used for flat objects with an animated texture. This is almost a software sprite in the classical sense, but it is inserted by means of 3D graphics routines as a flat 3D object in the 3D scene.

Operation

The sprite is inserted at the desired position in the image of the graphics hardware ( GPU ) for display time. The contents of the graphics memory is not changed - in contrast to the MOB or BOB need new graphic data do not always return to this to be copied. By this discharge of the main processor Sprites hardly claim system resources and are also easy to program.

The graphic data for the sprites are made by the same methods as the graphics data for the normal screen layout available - examples including the C64 and the Amiga called where this is done by DMA memory accesses the GPU to specific areas of main memory.

The control data for the sprite display (especially the screen position ) either directly in registers of graphics hardware maintained (example: C64, width and height of sprites are fixed) or in specific RAM areas to which this hardware has enough quick access. An example of the latter variant, the Amiga, wherein the control data is transmitted from the memory together with the graphic data by DMA method. In contrast to the amount of C64 Amiga sprites is not limited.

To the movement of a sprite, it is sufficient only to change the x -and y- coordinates in the control registers; the complicated calculation of the address in the graphics memory is omitted, which also relieves the main processor. The graphics processor adds independently at the specified coordinates the sprite in the construction of the next image. Also animated sprites are possible; to only the data of the sprite graphics have to be replaced by the next frame in memory. If necessary. may simply be something other storage area for the next frame.

A sprite is rectangular in principle. But even irregularly shaped sprites are possible by the border will be transparent - either by a specific color, which is represented by the graphics processor transparent, or through a mask that defines the points at which the sprite opaque and where it should be transparent.

Importance for computer games

The advent of sprites in the 80s revolutionized the possibilities of computer games, because then the processor performance was insufficient to move complex graphics data on the screen ( see also home computers, such as C64, Amiga). The sprites were replaced by shapes (C16) or supplemented ( C128 ) or to BOBs (Amiga ) supplements.

A further improvement for computer games was the sprite - sprite collision detection. Once the GPU when creating an image seen that two sprites overlap, this is the software via interrupt flag or event is notified. Thus, most computer games are relatively easy to program, because the program does not have to worry about collision detection and consumed for this no computing power. A reasonable collision detection is present in almost all graphics processors, which also dominate BOBs or sprites.

Sprites are related to Tiles, which are also called tile graphics. In many 2D games such as Jump ' n' Runs both techniques are used in parallel. Tiles are also small graphic elements. For them, the game world is put together and they form walls and platforms, so always remain at the same place. In this way, memory is saved since repeating patterns to be stored only once in small Tilegrafiken, which are arranged according to a tilemap.

Software - Sprites

The "Software Sprites " or " shapes " that are not real sprites, usually only two things with real sprites have in common: first, they are raster images that are moved across the screen, secondly, they have non-rectangular shapes, so a mask or transparent areas.

The advantages of real sprites, such as low processor load or automatic collision detection, fall away. But one gets an advantage that as the physical constraints on the number and size of the sprites disappear, these limits are set by the newly available computational time for implementation in software.

Unlike real sprite of the background on which the shapes are drawn, must be redrawn again and again. The fastest way to by caches to complete the scene background in memory and copied again and again over the last picture, but needs the additional space. Would be space Gentle when you created the background over and over again for each new image, to earlier computers were too slow. In cases where also the background can change for each image, these considerations will naturally fall away. At most, certain optimizations for rolling scenarios are conceivable.

There are various methods for the storage and display of software sprites. They differ in the computation time for the sprite and the additional storage requirements for the marking of transparent pixels:

  • In the first method, a binary mask is defined next to the picture. Associated with this mask one pixel of the shape is practically like real sprites only drawn if a bit is set at the appropriate point in the mask.
  • But you can also using the mask a "hole" in the image that is in the graphics memory, produce, and then copies the transparent image of the sprite into it. "Transparent " means that only deleted bits ( 0) by set bits (1 ) of the shapes are replaced in the image memory, already set bits are not cleared. So you have to create a "hole " in which deleted all the bits in the graphics memory ( 0), where later the image of the shape should go. Otherwise, the set bits of background and shape would mix.
  • The "modern " version is to define a transparent color (which was, however, at the latest available at the hardware sprites of C64). When drawing each pixel of the shape replaces the subsoil; only where the Shape the transparent color is used, nothing is done, so the background remains unchanged. This method has the main disadvantage that you can not use a color in a shape, what, a certain limitation posed to the days where you had only 16 colors or less the same time. In addition, the necessary code for it was best to program for performance reasons in assembler. In the early PCs appropriate hardware support was for such advanced bit blit operations ( see blitter ) rarely present.
  • For the 256-color mode that was common in PCs in the 1990s, a compressed storage of the image data was used for mostly sprites. Here are alternately a counter for the transparent points and then to display image data. Then again the transparency counters, etc. The advantages of this method are a reduced memory requirements and an accelerated generation of the display, since no additional mask is required and transparent pixels can be skipped. There is also no color "lost" because the transparency is stored independently of the image data.

All procedures for software sprites have in common is that the surface must be restored because it is destroyed by the software sprites.

The easiest way to solve the problem is caching the entire background or just the point at which the shape is, as well as the subsequent copying back when a new scene is to be drawn. The background must not change during this time. For backing up and restoring multiple shapes cut-outs in the reverse order of securing must be used when restoring. If you do not, it could lead to artifacts when overlap individual shapes. Such artifacts are known, among other things cursors on Windows -based platforms, if they have not been realized as real sprites and one of the programs running on the system has a problem.

Sprite animation

Since the beginning of the use of sprites was sought from realism reasons, etc. continue to animate at least human characters and other creatures as enemies, monsters. Especially with the representation of a human Helden it is important that move the legs when moving to the right or left on a two-dimensional screen. Therefore, there is such a figure in modern games of several sprites that are displayed behind each other rapidly as in an animated film to create a smooth impression of motion. To generate this animation sprites like the software Deluxe Paint (Amiga) used in previous years. Today there are for this purpose follow-up programs, such as Cosmigo Pro Motion. At the beginning of computer games, there has been next to other techniques. So Atari Basketball used in the late 1970s to very coarse shown lateral outline of a person standing straight as a game character. When " running " flashed at regular intervals abgestrecktes leg ( line) on which was copied to the character sprite.

CSS Sprites

In web design, the term Sprites used as the label for graphic files, which consist of several small individual graphics. These sprites are integrated with CSS in web pages in such a way that each of the required correspondingly cut part graphics are displayed by the web browser. Purpose of this technique is on the one hand to reduce the overall loading time of a website by reducing server requests and on the other hand preventing delays caused by reloading - would arise - for example, in Hovereffekten.

742919
de