[SOLVED] Entity Systems, Custom Controls, Interfaces. I don’t think I understand…

Hi there,



I’ve read a little about Entity Systems and it does sort of make sense to me to some extent.

I do however, have a few questions:



Arent jMonkeys Custom Controls similar to an Entity System?

If I want a new Entity, I can take 2-3 existant Controls if they are designed correctly.



Also from my understanding it is possible to create something similar to an ES by using Interfaces.

This approach does take longer and in the long run the ES would be more productive.

Is this true?

Well suing interfaces you can get a similary powerfull system, but you need to implement the same logic like a 100 times for every object that implements the interface.

An entity system has entities which are essentially IDs… and components which are JUST DATA. So, no… controls are not similar to an entity system. Entity systems are more of a game data model.



JME controls are good for implementing the “systems” in an entity system based game… but the “entity system” is a separate thing.

Yes, the entitiys itself are just descripting objects that can be persistet (db save file whatever)

@pspeed said:
An entity system has entities which are essentially IDs... and components which are JUST DATA. So, no... controls are not similar to an entity system. Entity systems are more of a game data model.

JME controls are good for implementing the "systems" in an entity system based game... but the "entity system" is a separate thing.

So it goes more in the direction of "marker interfaces" that contain no methods?

I understand that its dead simple to save an entity into a RDBMS or similar DBMS.

P.S. I am reffering to the effect of the system, not the system itself that manages the entities.
@zanval88 said:
So it goes more in the direction of "marker interfaces" that contain no methods?

I understand that its dead simple to save an entity into a RDBMS or similar DBMS.


No. No interfaces at all. Components contain data. So maybe you have a Hitpoints component... and a Position component, etc.. An entity with hitpoints and position would have both of those components.

Systems then can operate on a set of entities that have the requisite components. This is the key.

I tried to create my ES. Possibly it will be useful: http://code.google.com/p/jme-simple-examples/source/browse/#hg%2FJMESimpleExamples%2Fsrc%2Fcom%2Fentitysystem

Ahh my english. I meant to compare Controls to Components.



An Entity itself contains no data, that is clear (maybe I wrote it unclear earlier).

I had a HitPointsControl and a MovementControl for each Entity (Spatial in this case) that can be moved.



From what I have read on the internet, if I get Input, I could tell an EntitySystem:

“move all Entities that have the input and the movement component”



In Jme I dont have a Collection of Entities that have specific controls. (by nature)

And this missing collection (and thus, the missing management) of Entities/Spatials with specific controls would be what limits me most?





Sorry for not being able to write 100% precise on this topic, seems my english is slightly rusted.



P.S. thanks @mifth , just made a checkout, looking at that code right now

A JME control is code. It may also have data but it first and foremost has code/logic.



A component in an entity system is only data. No code. Just data.



A control would be part of a “system” in an entity-system based game.



You might have a “movement system” that every update would loop over all entities with a Position and a Velocity and move them. It might also use an Acceleration component.



Input from the player (or AI) would then just be setting the Acceleration or Velocity components.



A spatial and control would be mostly part of a “rendering system”.

2 Likes
@pspeed said:
You might have a "movement system" that every update would loop over all entities with a Position and a Velocity and move them. It might also use an Acceleration component.

!!!CLICK!!!

Thanks, now I found the missing piece :)
@zanval88 said:
!!!CLICK!!!

Thanks, now I found the missing piece :)


Wee. I love it when I get to see the spark! :)

Hi,



I have found this page about entity system. It can help as introduction I think.

@H said:
Hi,

I have found this page about entity system. It can help as introduction I think.

Not really whats meant here.
@H said:
Hi,

I have found this page about entity system. It can help as introduction I think.


This Blog covers what were talking about here :)

Hi @zanval88,



I just want to help. Pardon me if I brought more confusion!

@H said:
Hi @zanval88,

I just want to help. Pardon me if I brought more confusion!

You didn't confuse me, but I thought you misunderstood the thread.
So I wanted to help you :)