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

Add serialization of built-up DSLs #109

Open
nicopap opened this issue Nov 10, 2023 · 0 comments
Open

Add serialization of built-up DSLs #109

nicopap opened this issue Nov 10, 2023 · 0 comments
Labels
C-chirp relates to the cuicui_chirp file format crate specifically C-dsl relates to the cuicui_dsl crate specifically T-enhancement New feature or request

Comments

@nicopap
Copy link
Owner

nicopap commented Nov 10, 2023

The idea is to keep and store constructed DslBundle for each Entity. To keep track of the hierarchy, we could use the child_count method, similarly to how the AST is handled, and how scenes are loaded in https://github.com/nicopap/bvyfst/tree/main/hollow_scene.

Basically, it's just pre-processing the scene file and save it as an array of the relevant DslBundle.

struct SerializedDslNode<D: SerializableDsl> {
  children_count: usize,
  dsl: D,
}

The primary use case would be obfuscation, but it has a legitimate perf concern:

  1. No need to parse the arguments to each method (using ReflectSerialize), nor run each method. The DslBundle is pre-build.
  2. No need to have each and every concerned component be Reflect or Serialize, the only thing that maters is the DslBundle type.
  3. No need to interpret the AST into a DslBundle, it is pre-built. This means: no need for loading several files, executing templates etc. Although with chirp templates: for statement #94, we would probably need to have a solution for dynamic queries.
  4. Although depending on the serialization format, we might still have considerable parsing overhead. With something like rkvy or bincode, it is likely the parsing overhead is lower
  5. Running a zip compression pass is trivial and could potentially greatly reduce asset sizes
  6. Obfuscation: Preprocessing into a binary format allows delivering files that require more work than just opening with Notepad++
  7. We could eventually gate the parser/AST/interpreter behind a feature flag so that games can be shipped without it.
@nicopap nicopap added T-enhancement New feature or request C-dsl relates to the cuicui_dsl crate specifically C-chirp relates to the cuicui_chirp file format crate specifically labels Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-chirp relates to the cuicui_chirp file format crate specifically C-dsl relates to the cuicui_dsl crate specifically T-enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant