Skip to content
Daan van Yperen edited this page Sep 24, 2016 · 8 revisions

Introduction

This module provides serialization to binary format using Kryo.

Dependencies

  1. Add artemis-odb-serializer-kryo module as dependency to your gradle/maven configuration.
  2. Add the required manager and configure the kryo backend:
     final WorldSerializationManager manager = WorldSerializationManager();
     World world = new World(new WorldConfiguration().setSystem(manager));
     manager.setSerializer(new KryoArtemisSerializer(world))

Usage

Usage examples

Load from file

     final InputStream is = AnyClass.class.getResourceAsStream("level.bin");
     manager.load(is, SaveFileFormat.class);

Save to file

     final FileOutputStream fos = new FileOutputStream("level.json");
     manager.save(fos, new SaveFileFormat(entities));

entities is an IntBag with entity IDs defining the scope of the save operation.

Clone this wiki locally