-
Notifications
You must be signed in to change notification settings - Fork 113
Kryo Serialization
Oleg Yushko edited this page Mar 25, 2018
·
8 revisions
This module provides serialization to binary format using Kryo.
- Add
artemis-odb-serializer-kryo
module as dependency to your gradle/maven configuration. - Add the required manager and configure the kryo backend:
final WorldSerializationManager manager = new WorldSerializationManager();
World world = new World(new WorldConfiguration().setSystem(manager));
manager.setSerializer(new KryoArtemisSerializer(world));
final InputStream is = AnyClass.class.getResourceAsStream("level.bin");
manager.load(is, SaveFileFormat.class);
Anything already in the world is unaffected by the load, so you can incrementally load parts of a world.
final FileOutputStream fos = new FileOutputStream("level.bin");
manager.save(fos, new SaveFileFormat(entities));
entities
is an IntBag with entity IDs defining the scope of the save operation.
- Overview
- Concepts
- Getting Started
- Using
- More guides
- Plugins
- Game Gallery
- Tools and Frameworks
- API reference