What is the difference between "Entity" and "Sprite"?

Started by
21 comments, last by Daaark 11 years, 2 months ago

Just that. Thanks.

Advertisement

Depends on the context wink.png

An "entity" is a thing. Usually in game engines, every object in the world is an "entity".

A "sprite" is a 2d image. Some game engines might have a sprite-entity, which is a thing that can be drawn using a picture.

Well, both are fairly abstract terms, so there isn't strictly a definition of either.

Generally a sprite is a visual object drawn to the screen, often a single texture or image contains multiple sprites ( called a spritesheet ). Sprites can represent the visual representation of all kinds of things... the score, the player, enemies in the world, etc...

Entity generally is at a higher level. Let's take PacMan as an example, there might be a dozen sprites repesenting PacMan in his various frames of animation. The Entity would be PacMan itself, but in addition to graphic information, it could also hold values like number of lives remaining, current facing direction, current frame of animation, etc.

Depends on the context wink.png

An "entity" is a thing. Usually in game engines, every object in the world is an "entity".

A "sprite" is a 2d image. Some game engines might have a sprite-entity, which is a thing that can be drawn using a picture.

So should I mantain these concepts separated? Or for the sake of simplicity, can I manage them together?. I mean if I could "mix" graphics issues with game object logic...

Depends on the context wink.png

An "entity" is a thing. Usually in game engines, every object in the world is an "entity".

A "sprite" is a 2d image. Some game engines might have a sprite-entity, which is a thing that can be drawn using a picture.

So should I mantain these concepts separated? Or for the sake of simplicity, can I manage them together?. I mean if I could "mix" graphics issues with game object logic...

Definitely separate. While an entity may have a sprite, the doesn't mean all entities will be sprites, nor necisarily that all entities will even have a sprite and quite possibly an entity will have a number of sprites..

At the end of the day though, entity is whatever you make it, if you choose to use such a class at all. ( While sprite has a pretty well defined meaning, and shouldn't really be used to be anything other than a 2d image ).

Spawners are a great example of an entity that is not a sprite.

Doors/portals, waypoints, and other invisible things are all game objects without visible components.

A "sprite" is a 2d image. Some game engines might have a sprite-entity, which is a thing that can be drawn using a picture.

But, as mentioned, it depends. Some games don't consider 2D tiles to be 'sprites', but will consider character and NPC animations to be composed of sprites. A GUI button might not be considered a sprite, but the particle effect image for a fireball might be. So it really is vague and varies from game engine to game engine.


Typically, and as simply as possible: These terms can and will be redefined, reused, and used interchangeably by other users and any engines.

In pong, the paddles and the ball are entities. A paddle entity would consist of a size and a position. The ball entity would be a size, position, and a velocity.

The sprites are the images that are drawn to the screen to represent those entities visually.

*Sprites are also soft-drinks and fairy like creatures. biggrin.png

Typically, and as simply as possible: These terms can and will be redefined, reused, and used interchangeably by other users and any engines.

In pong, the paddles and the ball are entities. A paddle entity would consist of a size and a position. The ball entity would be a size, position, and a velocity.

The sprites are the images that are drawn to the screen to represent those entities visually.

*Sprites are also soft-drinks and fairy like creatures. biggrin.png

And how can i managed sprites and entities in separated way? I think I need to read some resources about entities, and how interconnect it with sprites.

And how can i managed sprites and entities in separated way? I think I need to read some resources about entities, and how interconnect it with sprites.

That's entirely up to you. Everyone's implementation is different.

If you are writing a simple game, they might not know about each other at all. Your rendering code will just loop through the list of things you want to draw, and hardcode everything.

If you were writing an engine, or a had a system with a generic entity that could be used for anything, you'd have a pointer or reference to a sprite to be used, along with all the other data that entity needed.

This topic is closed to new replies.

Advertisement