Harris6310 Posted February 18, 2012 Author Share Posted February 18, 2012 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 More sharing options...
The New World Posted February 18, 2012 Share Posted February 18, 2012 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;drAn 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 More sharing options...
Godlord Posted February 18, 2012 Share Posted February 18, 2012 @[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 More sharing options...
Harris6310 Posted February 18, 2012 Author Share Posted February 18, 2012 Thank you for your replies, I'll get reading. Link to comment Share on other sites More sharing options...
Harris6310 Posted February 18, 2012 Author Share Posted February 18, 2012 An entity system is really not what I thought it was. All I am making is a small breakout clone. Entities seem a bit advanced? Link to comment Share on other sites More sharing options...
The New World Posted February 18, 2012 Share Posted February 18, 2012 Not at all, it's just a convient way of handling .. all your blocks for example.> if(Block(i).isBroken()) { Block(i).Remove(); } Link to comment Share on other sites More sharing options...
Guest Posted February 18, 2012 Share Posted February 18, 2012 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 More sharing options...
Harris6310 Posted March 3, 2012 Author Share Posted March 3, 2012 I know that I posted this a long while ago, but I would like to say thanks for your help. I went through the tutorials you posted and found one of my own. I now understand the concept and have built one of my own. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now