What is an entity?

Started by
4 comments, last by Satharis 10 years, 12 months ago

So everywhere I look I see things about entities, what are they? What do they do? How are they used?

Thanks

Advertisement
They are things. Skeletons, treasure chests, trees, triggers, spell effects, rockets, balloons, sledgehammers... you name it.

What you are seeing is probably a lot of talk about the latest fad in computer game design: entity systems; also sometimes known as component systems.

In some entity systems, and entity is just an ID, probably a 32 or 64 bit integer ID, that is used by various sub-systems to look up the chunk of data managed by the subsystem for the given entity. In other systems, an entity might be an actual container object holding references to the data that the subsystems will manage. Some frameworks implement a backbone system to handle communication between entities.

It's a pretty widely varied field. You'd be well-served to read a few of the recently posted articles about component system design, as well as hitting google. This sort of programming (which basically boils down to object composition) can be pretty useful.

Pretty much like FLeBlanc said, an entity is anything that may exist in a game world, be it the player character, a projectile, a trigger (as in event trigger, not a gun trigger), etc.

One thing to note is that normally when we hear game world one usually thinks about the visible things (geometry), but an entity isn't necessarily something that needs to be rendered (although there may be people who only call entities to the things that need to be rendered).

It's not a concrete term, but the general understanding is that it's a 'thing' within the simulation that interacts with other things.

Players, NPCs, items, etc.

Not menus or sound effects, etc. (Usually.)

In your own game you make the call yourself where to draw the line.
void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

As previous posts suggested an entity is pretty much everything. It's for sure to complicated to explain in one post, articles are more suited for the job. I'm not gonna try explain to you what an entity is, but I want to give you an advice - everyone has different opinions about what an entity is, why you need one, how it is implemented etc etc. Everything you read about the matter should be read with a pinch of salt (and in some cases a handful of salt!). You can't read an article and assume what that article explained to you is true in another article, that I learned the hard way.

The most common approaches of Entity Systems have unofficial labels that you will come across whence you lurk more... People talking about, for example, T-Machine ES (Entity System) are generally talking about the same approach of entity system. You might want to memorize the unofficial labels names each type of ES has been given and what's special about that entity system, it will help you from mixing up the different concepts of different entity systems.

Here's some helpful articles that helped me understand ES:

http://t-machine.org/index.php/2007/09/03/entity-systems-are-the-future-of-mmog-development-part-1/ (T-machine entity system)

http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/ (Objects (entities) as pure aggregation)

While it might be mind-boggling to read get into ES-concept, it is well worth it. I personally feel Entity Systems give the programmer much more freedom and it becomes easier to structure your game. Decoupling is very easy to manage.

I can answer your questions very briefly how I did it:

1. An entitiy is an integer, GUID (Globally Unique IDentifier), that is used to index arrays for it's components (data-collections). In my implementation it is NOT a class.

2. The entity GUID index arrays to access it's components.

3. Systems has access to relevant components. My moveSystem have an update function which can iterate through all positionComponents and velocityComponents and do the logic upon these, altering the component values.

If you don't understand the stuff written here, please sharpen your C++ skills.

As a few others have pointed out entities are basically your "dynamic" objects in a game world. If you use something like an old n64 game like banjo kazooie, the thing like enemies, friendly npcs, collectible items and other things would generally be considered "entities." Sometimes entities are used as a phrase for component based systems but in the general scheme of game development entities are just all that stuff you interact with that isn't part of the game world geometry.

This topic is closed to new replies.

Advertisement