-
Notifications
You must be signed in to change notification settings - Fork 114
World
Christopher Williams edited this page Apr 19, 2021
·
18 revisions
You need a container for your entities, systems and components. The World
is this container.
To assemble a world, you first configure it with WorldConfigurationBuilder
.
WorldConfiguration config = new WorldConfigurationBuilder()
.dependsOn(MyPlugin.class)
.with(
new MySystemA(),
new MySystemB(),
new MySystemC(),
).build();
// All systems initialized and injected.
World world = new World(config);
// Instance entities and assets here, or via your systems.
Typically games have a loop where the game gets updated and rendered each frame. Put the following logic in your game loop to have World
iterate over all systems in order.
world.setDelta(delta);
world.process();
The builder is where you alter and extend the artemis-odb framework. Here you register systems, plugins and inject Pojo's, and more advanced features like custom dependency injector
WorldConfiguration config = new WorldConfigurationBuilder()
.with( new MyManagerA(), new MyManagerB() )
.with( new MySystemA(), new MySystemB(), new MySystemN() )
.with( new MyPluginA(), new MyPluginB(), new MyPluginN() )
.register( new MyDIResolver())
.build();
Order of addition is preserved, but can be overridden. This is especially useful for writing plugins.
// Systems and managers are called from highest to lowest priority. Default is `NORMAL`.
.with( WorldConfigurationBuilder.Priority.HIGH + 1, new MyPluginA())
- Overview
- Concepts
- Getting Started
- Using
- More guides
- Plugins
- Game Gallery
- Tools and Frameworks
- API reference