-
Notifications
You must be signed in to change notification settings - Fork 8
Extending the eAdventure Schema
You can add new functionalitites to the eAdventure Schema in two different ways: creating a wrapper around some existing functionality, or creating a totally new functionality.
Either way, you need to create a new JSON Schema file in the schema package.
To regenerate all the Java model associated with the schema, you need to use maven:
mvn clean generate-sources -Pgenerate-schema -pl :schema
To exemplify this, we are going to take Spin effect as example.
Spin effect is an extension of Transform.
We need to tell the EditorConversor how to to transform a spin effect into a transform effect.
editorConversor.setConversor(Spin.class, new SpinConversor());public class SpinConversor implements Conversor<Spin> {
@Override
public Object convert(Spin s) {
Transform t = EAdEngine.factory.newInstance(Transform.class);
t.setRelative(true);
t.setDuration(s.getDuration());
Transformation tr = EAdEngine.factory.newInstance(Transformation.class);
tr.setScaleY(0);
tr.setScaleX(0);
tr.setRotation(s.getSpins() * 360);
t.setLoop(true);
t.setTransformation(tr);
return t;
}
}Currently, there are two easy ways of extending the eAdventure Schema: adding new effects and new renderers.
All extensions are defined by two parts:
- The schema part (and the Java class auto-generated associated), defining all the attributes for the extension
- And the engine part, defining the dynamic behavior in the engine.
For example, for Image renderer, we have the Image JSON schema (and the Image Java Class) and the Image Renderer in the engine.
NOTE: When defining the schema, bear in mind that the name of the properties cannot contain dashes (-), as these will be removed when the Java class associated is generated.
eAdventure - eUCM research group
- Setting up a Development Environment
- Contributing Guidelines
- Build Process
- Project structure
- Schema
-
Engine
- Files paths and FileResolver
- Binding Schema elements with Engine elements
- Managing the game view through Layers
- Game loop and scene management
- IO
- File Resolver
- Assets: Converting schema objects to engine objects
- Engine Objects
- Actors
- Effects
- Testing the engine
- Editor
- Remote communication
- Release Process
- Other documentation