Skip to content

Upgrading Checklist 1.0.0

Mykola Zekter edited this page Oct 2, 2015 · 24 revisions

WIP

Upgrading from older versions to odb 1.0.0

1.0.0 is a major release, with substantial changes to API. Porting is not exceptionally difficult. If you get stuck hop on gitter for help.

Entity changes

Methods

Before After
Entity#getComponent(c) ComponentMapper#get(e) or ComponentMapper#getSafe(e[,fallback])
Entity#setComponent(c) ComponentMapper#create(e) or ComponentMapper#set(e,toggle)
Entity#removeComponent(c) ComponentMapper#remove(e)
Entity#deleteFromWorld() world.delete(e)
Entity#edit() world.edit(e)
Entity#isEnabled(), Entity#enable(), Entity#disable() see Migrate disabled entities below
Entity#getUuid() See Migrate UUID below

Flyweights

Flyweights are no more! API accepts both Entity as int parameters where applicable. Where needed you can obtain an entity reference via world#getEntity(id). Migrate to int entity systems where performance is critical.

World changes

Before After
World.createEntity(e) world.create()
World.deleteEntity(e) world.delete(e)

System changes

1.0.0 brings back entity references by popular request. You can now choose between entity references or entity int identifiers. You can mix and match as required.

Migrating to int entity systems

Sit closer to the metal. Significant performance benefit. Slightly more verbose. Use this if not certain.

Before After
extends EntitySystem extends BaseEntitySystem
extends EntityProcessingSystem extends IteratingSystem

API accepts both Entity as int parameters where applicable.

Migrating to reference entity systems

Before (0.10+) After
#inserted(int entityId) #inserted(Entity entity)
#removed(int entityId) #removed(Entity entity)

Manager changes

Managers have been merged with the System hierarchy. Register your managers with world#setSystem(manager).

Manager is supported but discouraged. When possible, port any implementations to BaseEntitySystem using Aspect.all() or BaseSystem.

Manager#changed(int entityId) is no longer available as it was rarely used. Let us know what you used it for!

UUID changes

UUID is supported but discouraged due to performance. UUID convenience methods have been removed from Entity and World. UuidEntityManager remains. Interact with UUID via UuidEntityManager, or replace with your own unique id solution.

Disabled entity changes

Implement a Disabled component and Aspect.exclude() from relevant systems. Component Mappers provide easy control over component toggling.

Using Aspects makes entity behavior more predictable, more granular and easily serializable.

Dependency Injection changes @Wire

You can remove @Wire from all your systems and managers, except for non-artemis dependencies. By convention, @Wire(injectInherited=true) is now implied on all systems and managers. @SkipWire to suppress, @Wire to customize. Remove @Mapper altogether.

Other changes

Before After
extends VoidEntitySystem extends BaseSystem
Clone this wiki locally