Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (780)
Games in Android Showcase (233)
games submitted by our members
Games in WIP (857)
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  
  [entity system framework] artemis-odb 0.5.0 and agrotera 0.3.0  (Read 4239 times)
0 Members and 1 Guest are viewing this topic.
Offline junkdog
« Posted 2013-11-28 10:20:09 »

If you haven't heard of artemis or entity systems before, the blurb:

Artemis is a high performance Entity System framework for games, written in Java, and is a framework to manage entities in a game world. It is inspired by Entity Systems are the future of MMORPG blog series by Adam Martin. We also borrowed ideas from Ted Brown who implemented a simple high-performance Entity System in Processing based on Adam Martin's blog.

The framework is based on the concept that entities in a game world exist as pure identifiers, their components contain only data, and systems process entities based on their aspects. This promotes separation of concern and simplifies game design tremendously.

artemis-odb aims to preserve the simplicity of the original artemis framework while at the same time extending it with new features. The recently released 0.5.0 introduces "packed" components and pooling of entities and optionally components.

agrotera is a small annotation-driven compile-time plugin for reducing boilerplate associated with configuring EntitySystems, Managers and - new in 0.3.0 - general classes. Since agrotera solely relies on compile-time weaving, there is no performance or memory cost associated with its features.

artemis-odb compared to original artemis:
- All known bugs present in original artemis have been resolved.
- Less object allocation.
- New component types:
  - PooledComponent: automatically recycled.
  - PackedComponent: single instance component backed by a static array
- Optional compile-time bytecode weaving: @PooledWeaver and @PackedWeaver annotations rewrites normal com.artemis.Component classes into the requested type.
  - Since weaving takes place during compile-time, this works on android too.

The PackedComponent implementation, while harboring noble ideals, is somewhat naive at the moment:
 - Requires setters/getters for all values (I personally much prefer direct field access for components).
 - Assumes that the component will be present in all entities (internally, the entity id is used as index in the component's backing array). Still applicable for Position and similarly ommipresent properties.
 - @PackedWeaver requires that all fields share the same primitive type.

Future releases will offer more flexibility in regard to automatically weaving packed components (see here).

The benefit of using the @*Weaver annotations is that the components still look like "normal" POJO components and hence are less prone to mundane errors. Additionally, it may make debugging slightly easier since reverting a woven component back to a normal is a simple as removing the annotation.


agrotera removes nearly all boilerplate from systems (well, it could be argued that it's simply been moved to annotations instead, but the net result is less code):

// inject profiling, invoked at start of begin() and before any exit points in end()
@Profile(using=Profiler.class, enabled=Profiler.PERF_PROFILE)
// Injects ComponentMapper fields for all referenced component types
// and any referenced systems and managers.
// Eclipse's editor/compiler is aware of any injected fields.
    requires={Position.class, Thrust.class, PrecomputedThrust.class, GravityAffected.class, RepulseAffected.class},
public final class PrecomputedThrustSystem extends EntityProcessingSystem
    public PrecomputedThrustSystem()
        // null is replaced with the appropriate Aspect, deduced from @ArtemisSystem
    protected void process(Entity e)
        Position position = positionMapper.get(e);
        Thrust thrust = thrustMapper.get(e);
        gravityFieldComputer.cachedGravity(thrust, position.x(), position.y());

From the annotated classes, agrotera can generate a system overview from artemis' point-of-view:

Bytecode weaving - for both artemis and agrotera - is quite fast. On my laptop (i7 @ 3ghz):
[INFO] --- artemis-odb-maven-plugin:0.5.0:artemis (default) @ hallucinolog-core ---
[INFO] Processed 10 PackedComponents and 11 PooledComponents in 67ms.
[INFO] --- agrotera-maven-plugin:0.3.0:agrotera (default) @ hallucinolog-core ---
[INFO] Processed 25 EntitySystems, 5 Managers and 1 Injected types in 75ms.

- There's a pretty heavy reliance on maven (for bytecode weaving), although most things can still work outside a maven context, as an eclipse builder or as part of an ant script.

- (only agrotera) lombok-pg and lombok aren't compatible, and lombok-pg hasn't been updated for some time. I've seen some forks that have been busy keeping lombok-pg up to date with lombok - should look into those in the future. lombok-pg is responsible for injecting fields early enough for Eclipse to see them.

- (also mostly agrotera) Eclipse is the only IDE officially "supported", with projects preferably setup as maven modules. Furthermore, lombok-pg (a fork of the my all-time favorite Project Lombok) is required to make agrotera fly. I'm not sure to what degree other IDE:s are used, but let me know if you think I should add support for others.

artemis-odb: bugfixing and performance optimized fork of artemis ECS
Pages: [1]
  ignore  |  Print  

hadezbladez (761 views)
2018-11-16 13:46:03

hadezbladez (394 views)
2018-11-16 13:41:33

hadezbladez (758 views)
2018-11-16 13:35:35

hadezbladez (200 views)
2018-11-16 13:32:03

EgonOlsen (2401 views)
2018-06-10 19:43:48

EgonOlsen (2581 views)
2018-06-10 19:43:44

EgonOlsen (1486 views)
2018-06-10 19:43:20

DesertCoockie (2149 views)
2018-05-13 18:23:11

nelsongames (1967 views)
2018-04-24 18:15:36

nelsongames (2648 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 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‑
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!