Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  What exactly defines an entity?  (Read 2224 times)
0 Members and 1 Guest are viewing this topic.
Offline Glass

Senior Newbie





« Posted 2012-03-29 03:11:04 »

What makes an entity an entity, what special features does it have? What do entities do?

EDIT: entity as in the ones commonly used in games for a superclass(i think thats the right term)
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 128
Projects: 4
Exp: 3 years



« Reply #1 - Posted 2012-03-29 03:16:43 »

An entity for what? "Entity" is kind of a vague term.
Offline theagentd
« Reply #2 - Posted 2012-03-29 03:48:05 »

Google "definition of life"! xD

An entity usually contains all the variables and functions that are shared by all objects in the game, for example position and an abstract draw() function, e.t.c.

Myomyomyo.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline sproingie

JGO Kernel


Medals: 202



« Reply #3 - Posted 2012-03-29 04:24:30 »

It's as vague a word as "Thing".  In fact that's exactly what it means, it comes from the Latin word for "thing" (entis).  An Entity is a Thing, and outside one specific context (below) it doesn't mean anything more than that.

You'll sometimes hear about "Entity Systems" or "Entity Component Systems", and that's more to do with an Entity-Relational model that decomposes objects into much finer-grained related components that can be assembled in ways that's too inconvenient for a static type system.  Views on entity systems range from "Silver Bullet" to "Tits on a Bull".  

In these systems, an Entity is a collection of components, but is only used for its identity to project its related components from, while separate systems act on the "vertical" collections of components.  Think of each entity as a row in a database and components as columns, and that's where you get the notion of "verticality" from.

Offline Roquen
« Reply #4 - Posted 2012-03-29 05:47:46 »

Yeah there is not solid definition as the notion will vary programmer to programmer and project to project.  Generally an "entity" or a "game object" are two different terms for the same thing.  I'll refer to the stuff I do as an "Entity System", although I don't use a component model and I think of it as the logically block that separates engine side activities from the scripting/world building side.
Offline Damocles
« Reply #5 - Posted 2012-03-29 05:55:50 »

The entity is one of the upper squares in your Class-UML.
The things lower connected to it are specific children of it.  Wink

I would define entity as something that is contained in a level. And can change.
And is not an Asset or a pure Metaobject.

Offline Glass

Senior Newbie





« Reply #6 - Posted 2012-03-29 06:29:35 »

So it's a general thing, without much of a stone-set definition. Besides a draw function, and its position in the screen, what else does the entity superclass need in it? Not all the entities will move, so you can't have moving functions, and health/stamina seem too specific too. What else could you possibly put in there that defines every single 'something' in the game?
Offline Roquen
« Reply #7 - Posted 2012-03-29 06:43:48 »

Without a specific game design...it's hard give any specifics.  And with a given design, you'd get a lot of disagreement about what route to take.  Some points that most of us would probably agree on is:  use a data driven model and the more complex the needed interactions are use some method of "design by composition" instead of "design by inheritance".  So if you're thinking about "Chair" or "PotionOfSuperDuperHealing" classes...you're heading in the wrong direction.
Offline ReBirth
« Reply #8 - Posted 2012-03-29 14:42:01 »

Entity in programming, is the result of combination between fields (attributes) and methods (behaviours) which are showing how it will interact, how important it is, etc.

Offline actual

JGO Coder


Medals: 23



« Reply #9 - Posted 2012-03-31 17:37:57 »

So it's a general thing, without much of a stone-set definition. Besides a draw function, and its position in the screen, what else does the entity superclass need in it? Not all the entities will move, so you can't have moving functions, and health/stamina seem too specific too. What else could you possibly put in there that defines every single 'something' in the game?

Although it is less fashionable as of late you can use inheritance. So your GameEntity is basic and only provide fields or method hooks that are general to all.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
abstract class GameEntity {

   public int id;

   public Entity(int id) {
      this.id = id;
   }

   public void render(Graphics2D g)

   public void update(long frameTime)

}


Then your specific entities would inherit from GameEntity and provide more specific behavior

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
public class Tank extends GameEntity {

   // Tank specific fields
 int ammo = 100;
  int damage;
  int speed;

  public Tank(int id, int damage, int speed) {
     this.damage = damage;
     this.speed = speed;
 }

 public void update(long frameTime) {
      // Put in your tank specific update code
}


 public void render(Graphics2D g) {
      // Put in your code to draw a tank
 }
}



So while your game will have many things that are Entities, nothing in your game will be just an Entity.





Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Riven (18 views)
2014-07-29 18:09:19

Riven (13 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (31 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (42 views)
2014-07-24 01:59:36

Riven (41 views)
2014-07-23 21:16:32

Riven (28 views)
2014-07-23 21:07:15

Riven (29 views)
2014-07-23 20:56:16

ctomni231 (60 views)
2014-07-18 06:55:21
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!