I'm really enjoying component entity approach (I'm currently using ASH haxe, but particular language/framework doesn't really matter).

However the problem is - there're way too many elementary classes that need frequent update.

So I'd like to have something like yml config file for components and nodes, and actual classes to be generated from it. Is there any already existing solution that utilizes such codegen, or maybe some generic codegen solution that should be easy to configure for such task?

  • \$\begingroup\$ Switch to C# and Visual Studio. Then you will be able to simply use the T4 templates: en.wikipedia.org/wiki/Text_Template_Transformation_Toolkit \$\endgroup\$
    – Den
    Oct 29 '14 at 10:17
  • \$\begingroup\$ Any chance you could make that an answer @Den? \$\endgroup\$
    – Shroeder
    Oct 29 '14 at 16:04
  • \$\begingroup\$ @Shroeder OK, done. \$\endgroup\$
    – Den
    Oct 30 '14 at 15:35
  • \$\begingroup\$ @user54415 what are "nodes" by the way? \$\endgroup\$
    – Den
    Oct 30 '14 at 15:36
  • \$\begingroup\$ This appears to be fundamentally a question about "how to generate code from templates," which is not game-development specific. If that isn't the case, please edit your question to provide more details about the specifics the system you would like to build. \$\endgroup\$
    – user1430
    Oct 30 '14 at 15:46

I see two options:

1) Run-time code configuration. Traditional use case would be typical scene (level) data files. Typically a custom implementation is used (could be using a well-known transport such as XML and JSON).

Disadvantages: potentially more work to implement, limited to code configuration rather than generation (scripting aside).

Advantages: run-time configuration potential (e.g. user level editing), high format flexibility.

2) Compile/build time code generation. Typically third-party solutions are used: http://en.wikipedia.org/wiki/Comparison_of_code_generation_tools

Disadvantages: typically limited to compile/build time, very coder-oriented.

Advantages: simpler to get something working, closer to code.

I only have some minor experience using T4 in Visual Studio and it seems that it works. Visual Studio is considered one of the best IDEs and there are some good T4 extensions for it as well.

This topic is very close to Domain Specific Languages design and implementation, so it might be worth exploring as well.


Not the answer you're looking for? Browse other questions tagged or ask your own question.