Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Entities?


Harris6310
 Share

Recommended Posts

Hello, I have recently being doing a bit of basic game programming. I'm enjoying it and learning it a lot. But there is a problem, I'm finding it quite difficult to manage my game objects and events between them. I have heard about entities, and entity managers. I'm not sure what they are though. Any care to explain how what they are and how they would work? Or link a tutorial to where I could find out?

I'm using Java, but as it's a game mechanic, it doesn't have to be language specific.

tl;dr: What's an entity?
Link to comment
Share on other sites

Well I've been developing my own sort of GDK in Java, and an Engine built off of that.

Within the Engine, there is a base class called Entity. This entity class has basic members, Name, X, Y, Sprite, and since these are private members, there are get and set member functions, getName, setName, etc.

But that's fine and dandy, a little base class for entities. But whats a way to manage it? Well with an array of course!

Personally I have a static array within the Entity class, and within the Entity constructor, the newly instanced Entity is added to the array. So from this array, I can access any Entity that I've created. There are many other methods to load the entities into the array, for example, FileIO, by using an objectStream to load and save the Entities.

The way I had more thoroughly described would constantly be holding the Entities in memory though. Which for me is a temporary thing. But that's the basics of it.

tl;dr

An Entity is basically any object in your game that could hold a component such as being a Power Up, Player, NPC, etc.

[This may help you further understand an Entity Manager](http://www.thegameengineer.com/2011/08/25/the-game-entity-%E2%80%93-part-iv-game-systems/)

**EDIT:** Stephen, I swear to god … >_>
Link to comment
Share on other sites

@[rose:

> link=topic=78277.msg839340#msg839340 date=1329583315]
> **EDIT:** Stephen, I swear to god … >_>

Hmm?

@Harris: read [this](http://t-machine.org/index.php/2007/09/03/entity-systems-are-the-future-of-mmog-development-part-1/), especially part two, three and five.

Yours faithfully
  Stephan.
Link to comment
Share on other sites

Create a game loop. Use the interaction to the game as a separate thread. Create a base class named sprite containing size, position, velocity and a movement and draw function.

Split the game into update and draw methods, update controls the current frame of the game (move the player, move objects, calculate collisions etc) and then use the draw method to display the updated objects on screen.
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...