An Entity System for Ploobs

About Artemis

An Entity System for Ploobs

Mensagempor thelinuxlich » 10 Mai 2011, 14:39

For more on this subject, read http://t-machine.org/index.php/2007/09/03/entity-systems-are-the-future-of-mmog-development-part-1/

This is a work in progress, a C# port for a high-level entity system in Java called Artemis, which combines performance and clean separation of data, logic and view. It is a whole paradigm shift, to think of data/aspects for game features, but once you grasp the concept, you'll go "EUREKA" :)
I think it would be a nice addition to Ploobs, so I welcome any help here.

C# Source: https://github.com/thelinuxlich/artemis_CSharp
Java Source(so we can compare side-by-side): http://gamadu.com/svn/artemis/
Example Game(using the Java version): http://gamadu.com/svn/tankz/

WARNING: The original source mess a lot with Generics stuff and I see that it is not so trivial porting it from Java to C#(I'm not a .NET advanced programmer), the conversion was made blindly in my spare time and is broken at the moment because of these minor issues.

Quoting the author:
This framework requires different thinking when it comes to game programming. No longer are entities just self-contained objects, but consist of data/state components which are processed by systems/aspects.

Entity is an irrelevant object, it however still exists for design simplicity and convenience.

Components are attached to entities and they contain data or state for that entity. Imagine a components like Transform and Velocity.

Systems "process" certain "aspects" of entities. You can imagine one aspect being "Movement", and you would create a MovementSystem which processes all entities containing the Transform and Velocity components.

Currently there are 4 types of systems you can extend from:
- EntitySystem: the very basic raw system, which simply allows you to handle the processing loop however you want.
- EntityProcessingSystem: used to process individual entities of a certain aspect sequentially. If you always need to process all entities use this.
- IntervalEntitySystem: a very basic and raw system but is only executed at certain intervals, e.g. it runs processing every 100 ms. This way you can tune your game better for performance.
- IntervalEntityProcessingSystem: like EntityProcessingSystem but runs in intervals.
- DelayedEntitySystem and DelayedEntityProcessingSystem: executes only after a specified period.


This is a very fast system and offers a lot of flexibility, whilst keeping your code clean.
thelinuxlich
TechDemo
 
Mensagens: 152
Registrado em: 09 Mai 2011, 16:29
Area: Programador

Re: An Entity System for Ploobs

Mensagempor thelinuxlich » 10 Mai 2011, 14:42

Once the C# version works, we can port the example game to Ploobs Engine and then start thinking about an cool GUI for managing Entities, Components and Systems
thelinuxlich
TechDemo
 
Mensagens: 152
Registrado em: 09 Mai 2011, 16:29
Area: Programador

Re: An Entity System for Ploobs

Mensagempor tpastor » 10 Mai 2011, 15:03

as i said before, i will give support in everything you need (helping coding will be dificult, but i will be able to help with doubts about the engine, give sugestions, help testing, give feedbacks ...)

I liked the idea pretty much, we really need a system like this in the engine.
Probably Bruno (a member of the team) will be very interesting in this project.
PloobsEngine
Creator and Developer
ploobs.com.br/?page_id=1381
Avatar do usuário
tpastor
TechDemo
 
Mensagens: 700
Registrado em: 25 Mar 2011, 16:40

Re: An Entity System for Ploobs

Mensagempor bruno.duartec » 10 Mai 2011, 15:24

I am going to read all that i think if it´s worth to create this to the techdemo
PloobsEngine
Creator and Developer
ploobsengine.codeplex.com
ploobs.com.br
Avatar do usuário
bruno.duartec
TechDemo
 
Mensagens: 345
Registrado em: 08 Abr 2011, 14:54

Re: An Entity System for Ploobs

Mensagempor bruno.duartec » 11 Mai 2011, 10:06

I liked a lot that stuff.

This week i will make an analize of the model and make a simple one, to use in the techdemo for a while
PloobsEngine
Creator and Developer
ploobsengine.codeplex.com
ploobs.com.br
Avatar do usuário
bruno.duartec
TechDemo
 
Mensagens: 345
Registrado em: 08 Abr 2011, 14:54

Re: An Entity System for Ploobs

Mensagempor tpastor » 11 Mai 2011, 10:27

thelinuxlich is already implementing one.
ask for repository permission and work together as a team =P
PloobsEngine
Creator and Developer
ploobs.com.br/?page_id=1381
Avatar do usuário
tpastor
TechDemo
 
Mensagens: 700
Registrado em: 25 Mar 2011, 16:40

Re: An Entity System for Ploobs

Mensagempor thelinuxlich » 11 Mai 2011, 11:46

I've been talking with the Artemis author, he updated the engine site with better docs:

http://gamadu.com/artemis/

Hey Bruno, join me at github! The engine is not that complex, it's just that I need to fix some Java-to-C# stuff like Generics to make it work :)
thelinuxlich
TechDemo
 
Mensagens: 152
Registrado em: 09 Mai 2011, 16:29
Area: Programador

Re: An Entity System for Ploobs

Mensagempor tpastor » 11 Mai 2011, 12:24

Pretendo dar uma olhada no codigo esta semana.
porem nunca usei github na minha vida :)
existe algum cliente windows ? oq vc recomenda ?
PloobsEngine
Creator and Developer
ploobs.com.br/?page_id=1381
Avatar do usuário
tpastor
TechDemo
 
Mensagens: 700
Registrado em: 25 Mar 2011, 16:40

Re: An Entity System for Ploobs

Mensagempor thelinuxlich » 11 Mai 2011, 13:04

Hoje em dia GIT tem um bom suporte no Windows também, use msysgit -> http://code.google.com/p/msysgit/downloads/list

De todas as plataformas web de controle de versão, o github tem se mostrado cada vez mais o melhor, só usando pra entender heheheh
thelinuxlich
TechDemo
 
Mensagens: 152
Registrado em: 09 Mai 2011, 16:29
Area: Programador

Re: An Entity System for Ploobs

Mensagempor thelinuxlich » 11 Mai 2011, 16:23

With the astonishing help of tpastor, almost everything was ported from the Java version. Now, I will start a separate project to port Starwarrior, a 2D example game made with Artemis(using Slick, a Java 2D Game Framework) to C#/Ploobs.

I can use the help of experienced Ploobs developers here, it's not complex, just a bunch of polygon instances setting color, coordinates, keyboard input and drawing on a screen. With our entity system, things will be clearly separated.

In Artemis, we have the concept of Spatials, which is a specialized Component for rendering stuff.

See this example from the game code:

Código: Selecionar todos
public class EnemyShip extends Spatial {

  private Transform transform;
  private Polygon ship;

  public EnemyShip(World world, Entity owner) {
    super(world, owner);
  }

  @Override
  public void initalize() {
    ComponentMapper<Transform> transformMapper = new ComponentMapper<Transform>(Transform.class, world.getEntityManager());
    transform = transformMapper.get(owner);

    ship = new Polygon();
    ship.addPoint(-10, -10);
    ship.addPoint(10, -10);
    ship.addPoint(0, 10);
    ship.setClosed(true);
  }

  @Override
  public void render(Graphics g) {
    g.setColor(Color.red);
    g.setAntiAlias(true);
    ship.setLocation(transform.getX(), transform.getY());
    g.fill(ship);
  }
}


All Spatials have a render method that will be called by a RenderingSystem intercepting seamlessly Spatials added on Entities of the game. Graphics and Polygon are Slick classes that need to change to Ploobs API.

StarWarrior source is here: http://gamadu.com/games/starwarrior/starwarrior-src.zip
thelinuxlich
TechDemo
 
Mensagens: 152
Registrado em: 09 Mai 2011, 16:29
Area: Programador

Próximo

Voltar para Artemis C# Entity System

Quem está online

Usuários navegando neste fórum: Nenhum usuário registrado e 1 visitante

cron