Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassArtemisSerializer #439

Closed
1 of 10 tasks
junkdog opened this issue Jun 21, 2016 · 9 comments
Closed
1 of 10 tasks

ClassArtemisSerializer #439

junkdog opened this issue Jun 21, 2016 · 9 comments

Comments

@junkdog
Copy link
Owner

junkdog commented Jun 21, 2016

  • fastest/most efficient solution; GC-friendly
  • save to source or directly to .class compile to class
  • load from class Prefab intercepts via @Prefab.Compiled(Class); set by artemis-odb plugin
  • offer way to auto-convert json blob -> .class, to simplify making it into an optimization at build-time
    • artemis-odb plugin (think compile-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

  • entity json -> nodes
  • generate createEntities
  • compile file
  • node should understand entity references
  • map ref vs new entityIds
  • node: arrays
  • node: maps
  • asm: find prefabs
  • option: delete original json
  • tag prefab @Prefab.Compiled

development branch: origin/439-compiled-serialization

@Namek
Copy link
Contributor

Namek commented Jun 21, 2016

what about some bandtwith-efficient approach rather than JSON? I'm thinking of https://github.com/Namek/artemis-odb-entity-tracker here

@junkdog
Copy link
Owner Author

junkdog commented Jun 22, 2016

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.

@junkdog
Copy link
Owner Author

junkdog commented Jan 11, 2017

development branch: origin/439-compiled-serialization

@DaanVanYperen
Copy link
Collaborator

@junkdog is this salvageable? otherwise perhaps close.

@DaanVanYperen
Copy link
Collaborator

DaanVanYperen commented Dec 21, 2017

Just some observations after updating the wiki and #510.

  • BasePrefab hierarchy feels a bit smelly. It looks like a convenience harness but has some json logic leaking in. Maybe cleaner to delegate all loading logic to the reader? (including the SERIALIZER generic and abstract create). Will make it a bit easier to understand and create custom implementations.
  • The naming feels a bit unidiomatic. I realize idiomatic names might make it a bit too generic, but make it easier to find in wiki etc. Something like 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() .
  • Couldn't find it, is there DI for prefabs like for the component mappers?

@junkdog
Copy link
Owner Author

junkdog commented Jan 5, 2018

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).

@junkdog junkdog modified the milestones: artemis-2.2.0, artemis-2.3.0 Jan 5, 2018
@junkdog
Copy link
Owner Author

junkdog commented Jan 5, 2018

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.

@DaanVanYperen
Copy link
Collaborator

@junkdog cleaning out stale branches, still sponsoring this?

@junkdog
Copy link
Owner Author

junkdog commented Jan 14, 2019

Ice-boxing this for now, but I wouldn't mind revisiting it - if it fulfills a need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants