zdandoh / ecs

Golang ECS library using go generate
MIT License
5 stars 0 forks source link

External config and generation #6

Open delaneyj opened 8 months ago

delaneyj commented 8 months ago

Forcing go generate and reading the AST is limiting. It might be worth it to bite the bullet and create a config that can be constructed in both Go/JSON/X. I have done similar work in https://github.com/delaneyj/gostar

  1. Create a protobuf IDL https://github.com/delaneyj/gostar/blob/main/cfg/specs/v1/elements.proto
  2. Create configs in Go or JSON, https://github.com/delaneyj/gostar/blob/main/cfg/default.go
  3. Generator https://github.com/delaneyj/gostar/blob/main/generator/generators.go
  4. Output https://github.com/delaneyj/gostar/tree/main/elements

This can be run by task runners like Air or Taskfile as a dependency. Also means you can be much more explicit with the Select so you are defining Query in config and generating named functions, like the components. I've done some work in this vein for ECS and would be nice to swap notes.