Closed junkdog closed 5 years ago
what about some bandtwith-efficient approach rather than JSON? I'm thinking of https://github.com/Namek/artemis-odb-entity-tracker here
The kryo backend produces smaller output (2/3 or so compared to json); but if you want to optimize bandwidth you probably only want to send the deltas (I'd make components atomic units). The specifics are a bit illusive though, and not really supported by the current serialization mechanism - unless you roll a custom serialization backend which internally filters and sends the correct deltas.
development branch: origin/439-compiled-serialization
@junkdog is this salvageable? otherwise perhaps close.
Just some observations after updating the wiki and #510.
SERIALIZER
generic and abstract create
). Will make it a bit easier to understand and create custom implementations. EntityTemplate
/CachedEntityTemplate
?SaveFileFormat
could use a bit of quality of life and documentation improvements, for example allow fetching entities by id, docu for serializationtags and SaveFileFormat.get()
.BasePrefab hierarchy feels a bit smelly. It looks like a convenience harness but has some json logic leaking in.
Hmm, where do you mean? It's a dependency on artemis' serializer, but not json afaik. Should definitely provide a custom reader though - I thought there were at least some basic tests demonstrating custom ones.
The naming feels a bit unidiomatic.
I stole it from Unity3d; mostly
SaveFileFormat could use a bit of quality of life and documentation improvements, for example allow fetching entities by id,
Agreed; I'll see about expanding with more annotated examples. The impl itself begs for a cleaner rewrite, but that is unlikely to happen anytime soon.
Not sure about fetching by id, or which id do you mean? Any id recorded in the json is pretty volatile (id:s will likely change if re-saved).
Couldn't find it, is there DI for prefabs like for the component mappers?
yup; all new-ish artemis facilities auto-inject (where appropriate).
is this salvageable? otherwise perhaps close.
with some work, yes, but still quite a few things remain. I can "manually" run basic compiled prefabs on my computer (compiler + bytecode transformations not done). moved it to 2.3.0.
@junkdog cleaning out stale branches, still sponsoring this?
Ice-boxing this for now, but I wouldn't mind revisiting it - if it fulfills a need.
save to source or directly tocompile to class.class
load from classPrefab intercepts via@Prefab.Compiled(Class)
; set by artemis-odb plugin.class
, to simplify making it into an optimization at build-timecompile-prefabs
task)The auto-convert route is probably the most sane use-case; out-of-sync identifiers in json blobs are easier to fix than renamed references in class files. Only "release" code really benefits from faster loading times/less GC; as such, it'll probably end up in the default maven/gradle plugins.
TODO
@Prefab.Compiled
development branch: origin/439-compiled-serialization