Page MenuHomeWildfire Games

[wip] General system for file inclusions in XML files / Generalize paramnode capabilities
AbandonedPublic

Authored by wraitii on Jul 27 2020, 3:27 PM.

Details

Reviewers
None
Summary

This allows including bits of XML files into other XML files. The goal is to make our templates easier to modify, particularly simulation templates.

Design goals:

  • Allow direct inclusion of XML nodes
  • Allow direct inclusion of multiple XML nodes from one <include>
  • Allow "modifying" includes, similar to paramnode includes
  • Allow applying a template to another template.
  • Implement template hotloading.

All of the above should come at no/limited performance reduction.

To check:

  • Might make XMB caching slower. This could matter for "filtered" templates, since I'd now try caching them.

Current flaws:

  • Probably breaks hot-loading of art templates and such I think (not simulation since those don't have it).
  • No handling of filter templates.

TODO:

  • More cleanup
  • Error reporting correctly.

Examples of things I want to clean up:

  • On the simulation templates side:
    • For civs with custom buildings, those are added manually to every builder template. It'd be nice to have a way to include a file.
    • Champion/Hero/Regular templates reuse a lot of similar template code, but aren't so modular because of the "Parent" logic.
  • On the actor template side:
    • We already can include variants, using rather custom code, which this would potentially make redundant / improve upon.

Attached is an example of XML inclusion.


I had a previous go at this using XInclude at D62, which ended up unsuccessfully. I didn't really fix the issues I'm listing above, and xInclude is... not great.

Test Plan

Check out the code.

At the moment I'm mostly interested in whether you think this is a good direction or not.

Event Timeline

wraitii created this revision.Jul 27 2020, 3:27 PM
Owners added a subscriber: Restricted Owners Package.Jul 27 2020, 3:27 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/2259/display/redirect

wraitii edited the summary of this revision. (Show Details)Jul 27 2020, 3:29 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2792/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1160/display/redirect

wraitii updated this revision to Diff 12993.Aug 1 2020, 5:02 PM
wraitii retitled this revision from [very wip] General system for file inclusions in XML files to [wip] General system for file inclusions in XML files.
wraitii edited the summary of this revision. (Show Details)

Much bigger diff.
I went the way of creating a general algorithm for "data file inclusion", which is intended to replace the "transformation" aspect of ParamNode.

The current one operates over XML directly, I'm not entirely sure whether that makes sense or not. I'd be rather easy to add another one for JSON or something since all one has to provide is the functions, the algorithm logic itself is in DataTree (NB -> actual modification of data is on the T/XML side)

Vulcan added a comment.Aug 1 2020, 5:04 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/2293/display/redirect

Vulcan added a comment.Aug 1 2020, 5:04 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2831/display/redirect

Vulcan added a comment.Aug 1 2020, 5:15 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1194/display/redirect

wraitii updated this revision to Diff 13018.Aug 3 2020, 11:36 AM
wraitii retitled this revision from [wip] General system for file inclusions in XML files to [wip] General system for file inclusions in XML files / Generalize paramnode capabilities.
wraitii edited the summary of this revision. (Show Details)

Reimplement "replace", "disable", "op" and token-parsing.

This effectively makes the parent="" logic from paramNode rather redundant, but the paths aren't correct atm and I haven't re-implemented the filtering logic (yet).

I need to think how I want to implement that, and clean up the code a little bit.

I think this is an interesting direction though.

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/2312/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2850/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1213/display/redirect

wraitii updated this revision to Diff 13035.Aug 3 2020, 7:00 PM
wraitii edited the summary of this revision. (Show Details)

Implement include-aware XMB caching.

This wasn't as tricky as I feared. I need to run some performance comparisons though.

Vulcan added a comment.Aug 3 2020, 7:04 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/2322/display/redirect

Vulcan added a comment.Aug 3 2020, 7:11 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1223/display/redirect

Vulcan added a comment.Aug 3 2020, 7:28 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2860/display/redirect

wraitii updated this revision to Diff 13039.Aug 4 2020, 10:39 AM
wraitii edited the summary of this revision. (Show Details)

Implement "applying" a template to another.

Check out what I'm doing with test_cost and test_cost_champ, it's rather cool.

There's still plenty to cleanup but I'm getting there.

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2864/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/2326/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1227/display/redirect

wraitii updated this revision to Diff 13040.Aug 4 2020, 1:50 PM
wraitii edited the summary of this revision. (Show Details)

Update TemplateLoader/ParamNode, implement filters.
I'm now reproducing (in theory) 100% of the existing ParamNode behaviour.

Vulcan added a comment.Aug 4 2020, 1:52 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2865/display/redirect

Vulcan added a comment.Aug 4 2020, 1:55 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/2327/display/redirect

Vulcan added a comment.Aug 4 2020, 1:59 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/1228/display/redirect

wraitii abandoned this revision.Apr 3 2021, 3:38 PM

In truth, this is too complex. It works well as a data metaparser, but that's not really what we need. See D3800 for a lighter, more usable rewrite.