agrotera-lombok

Zero-overhead anti-boilerplate strategies for Artemis Entity System Framework.

License

License

Categories

Categories

Net Lombok Application Layer Libs Code Generators
GroupId

GroupId

net.onedaybeard.agrotera
ArtifactId

ArtifactId

agrotera-lombok
Last Version

Last Version

0.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

agrotera-lombok
Zero-overhead anti-boilerplate strategies for Artemis Entity System Framework.

Download agrotera-lombok

How to add to project

<!-- https://jarcasting.com/artifacts/net.onedaybeard.agrotera/agrotera-lombok/ -->
<dependency>
    <groupId>net.onedaybeard.agrotera</groupId>
    <artifactId>agrotera-lombok</artifactId>
    <version>0.3.0</version>
</dependency>
// https://jarcasting.com/artifacts/net.onedaybeard.agrotera/agrotera-lombok/
implementation 'net.onedaybeard.agrotera:agrotera-lombok:0.3.0'
// https://jarcasting.com/artifacts/net.onedaybeard.agrotera/agrotera-lombok/
implementation ("net.onedaybeard.agrotera:agrotera-lombok:0.3.0")
'net.onedaybeard.agrotera:agrotera-lombok:jar:0.3.0'
<dependency org="net.onedaybeard.agrotera" name="agrotera-lombok" rev="0.3.0">
  <artifact name="agrotera-lombok" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.onedaybeard.agrotera', module='agrotera-lombok', version='0.3.0')
)
libraryDependencies += "net.onedaybeard.agrotera" % "agrotera-lombok" % "0.3.0"
[net.onedaybeard.agrotera/agrotera-lombok "0.3.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.sonatype.tycho : org.eclipse.jdt.core jar 3.6.2.v_A76_R36x

provided (4)

Group / Artifact Type Version
com.github.peichhorn : lombok-pg jar 0.11.3
net.onedaybeard.agrotera : agrotera-api jar 0.3.0
org.kohsuke.metainf-services : metainf-services jar 1.1
net.onedaybeard.artemis : artemis-odb jar 0.3.2

system (1)

Group / Artifact Type Version
com.sun » tools jar 1.7

Project Modules

There are no modules declared in this project.

Agrotera

Zero-overhead anti-boilerplate strategies for Artemis Entity System Framework.

Nota Bene: RIP agrotera

Agrotera probably won't see much future development; a lot of the functionality provided by agrotera is now present in artemis-odb. Refer to this post for more details.

Features

  • Compile-time class engineering: no reflection overhead, no extra classes, no additional runtime dependencies, works with Android.
  • @ArtemisSystem for EntitySystems and @ArtemisManager for Managers.
    • Injects Aspect in constructor, unless already defined (only applies to EntitySystems).
    • Declares fields for referenced component mappers, managers and systems (only tested with Eclipse and maven).
    • Wires up referenced classes in initialize(), prepending to the method if already defined.
    • Generate Component Dependency Matrices via maven plugin (example).
  • @Profile EntitySystems
    • Injects conditional profiler call at start of begin() and before any exit point in end().
    • User-specified profiler class - adhering to ArtemisProfiler.
  • Inject abitrary classes with @ArtemisInjected.
    • Creates an initialize(World) method on the annotated class.

Installation

Minimal example

###What you type:

@Profile(using=Profiler.class, enabled=true)
@ArtemisSystem(
    requires={Renderable.class, Velocity.class},
	excludes={Cullable.class, AssetReference.class},
	managers={TagManager.class, GroupManager.class},
	systems=VelocitySystem.class)
public class TestSystem extends IntervalEntityProcessingSystem
{
	public TestSystem()
	{
		super(null, 0.05f);
	}
	
	@Override
	protected void process(Entity e)
	{
		// process system
	}
}

###What the JVM gets:

@WovenByTheHuntress // marker annotation; don't process class when present
@Profile(using=Profiler.class, enabled=true)
@ArtemisSystem(
    requires={Renderable.class, Velocity.class},
	excludes={Cullable.class, AssetReference.class},
	managers={TagManager.class, GroupManager.class},
	systems=VelocitySystem.class)
public class TestSystem extends IntervalEntityProcessingSystem
{
	private final Profiler $profiler;
	private ComponentMapper<Renderable> renderableMapper;
	private ComponentMapper<Velocity> velocityMapper;
	private VelocitySystem velocitySystem;
	private TagManager tagManager;
	private GroupManager groupManager;

	public TestSystem()
	{
		super(Aspect.getAspectForAll(Renderable.class, Velocity.class)
			.exclude(Cullable.class, AssetReference.class), 0.05f);
		$profiler = new Profiler();
		$profiler.setTag(getClass());
	}

	@Override
	protected void initialize()
	{
		renderableMapper = world.getMapper(Renderable.class);
		velocityMapper = world.getMapper(Velocity.class);
		tagManager = world.getManager(TagManager.class);
		groupManager = world.getManager(GroupManager.class);
		velocitySystem = world.getSystem(VelocitySystem.class);
	}

	@Override
	protected void begin()
	{
		$profiler.start();
	}

	@Override
	protected void end()
	{
		$profiler.stop();
	}

	@Override
	protected void process(Entity e)
	{
		// process system
	}
}

Behind the veil

Agrotera consists of two intermingling parts.

agrotera-lombok

Responsible for declaring the fields, inferred from annotations, ensuring that the IDE doesn't complain about unresolved fields.

Provides @Profiler, @ArtemisSystem, @ArtemisManager and @ArtemisInjected, processed alongside lombok-pg (you know, that fork of Project Lombok - because I couldn't get type resolution working under vanilla lombok).

agrotera-asm

Transforms the entity systems and managers; wiring up dependencies and injecting profiler calls. Conceived as a post-compile step run via the agrotera-maven-plugin or with an eclipse builder.

Artemis Maven dependency / Shameless self-promotion

Our fork of Artemis:

<dependency>
    <groupId>net.onedaybeard.artemis</groupId>
    <artifactId>artemis-odb</artifactId>
    <version>0.5.0</version>
</dependency>

Contact

junkdog at onedaybeard dot net - twitter: @junkdogAP

Versions

Version
0.3.0
0.2.1
0.2.0
0.1.1